karlexmarin Claude Opus 4.7 (1M context) commited on
Commit
2f0a86a
·
1 Parent(s): ec50bb7

v0.8.9: auto-open Diagnostics + summary pill when γ Validity Gate fires

Browse files

When the γ Validity Gate would fire on initial render (η outside
[0.85, 1.15] OR regime ∈ {fraud, compressed, overpade, swa, unknown}
for the pre-populated γ_observed = γ_decomposed ?? γ_pade), the TAF
Card now opens the Diagnostics <details> section by default and shows
a "⚠ Validity gate" pill in its summary bar. This surfaces the warning
banner without requiring the user to manually expand the section.

For models where γ_decomposed ≈ γ_pade and there is no anomaly,
Diagnostics stays collapsed as before.

Localized in en/es/fr/zh via gamma_check.validity.summary_pill.

Also fixes a pre-existing locale bug exposed during testing:
gc-gobs <input type="number"> was pre-populated via formatN() which
calls toLocaleString → in es/fr locales it produced "0,8734" with a
comma, which the number input rejects, leaving the field empty.
Switched the pre-fill to v.toFixed(4) which always emits a dot.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files changed (2) hide show
  1. js/i18n.js +4 -0
  2. js/main.js +15 -2
js/i18n.js CHANGED
@@ -1061,6 +1061,7 @@ export const TRANSLATIONS = {
1061
  "gamma_check.validity.overpade.hint": "Hint: η > 1.5 may indicate an undertrained early checkpoint, a Lerch-corrected regime, or correction terms beyond the Padé approximation.",
1062
  "gamma_check.validity.swa.hint": "Hint: Sliding-window architectures (Mistral, Gemma) violate the full-attention assumption of the closed-form by design.",
1063
  "gamma_check.validity.unknown.hint": "Hint: γ_obs out of physical range or measurement noise. Verify your inputs and re-measure.",
 
1064
  "gamma_check.glossary.title": "ⓘ Glossary — what these variables mean",
1065
  "gamma_check.glossary.gamma_pade": "<strong>γ_Padé</strong>: closed-form prediction (2−z)/(2+z), z = T√2/θ. Paper §sec:gamma_decomposition.",
1066
  "gamma_check.glossary.gamma_obs": "<strong>γ_observed</strong>: empirically measured from your model's attention scores (run the Diagnose CLI on real weights).",
@@ -1211,6 +1212,7 @@ export const TRANSLATIONS = {
1211
  "gamma_check.validity.overpade.hint": "Pista: η > 1.5 puede indicar checkpoint temprano sub-entrenado, régimen Lerch-corregido, o términos de corrección más allá de la aproximación de Padé.",
1212
  "gamma_check.validity.swa.hint": "Pista: arquitecturas sliding-window (Mistral, Gemma) violan por diseño la asunción de full-attention de la fórmula cerrada.",
1213
  "gamma_check.validity.unknown.hint": "Pista: γ_obs fuera de rango físico o ruido de medición. Verifica entradas y vuelve a medir.",
 
1214
  "gamma_check.glossary.title": "ⓘ Glosario — significado de las variables",
1215
  "gamma_check.glossary.gamma_pade": "<strong>γ_Padé</strong>: predicción cerrada (2−z)/(2+z), z = T√2/θ. Paper §sec:gamma_decomposition.",
1216
  "gamma_check.glossary.gamma_obs": "<strong>γ_observado</strong>: medido empíricamente desde los attention scores (ejecuta Diagnose CLI sobre pesos reales).",
@@ -2334,6 +2336,7 @@ export const TRANSLATIONS = {
2334
  "gamma_check.validity.overpade.hint": "Indice : η > 1.5 peut indiquer un checkpoint précoce sous-entraîné, un régime Lerch-corrigé, ou des termes de correction au-delà de l'approximation de Padé.",
2335
  "gamma_check.validity.swa.hint": "Indice : les architectures sliding-window (Mistral, Gemma) violent par conception l'hypothèse de full-attention de la forme close.",
2336
  "gamma_check.validity.unknown.hint": "Indice : γ_obs hors plage physique ou bruit de mesure. Vérifiez vos entrées et remesurez.",
 
2337
  "gamma_check.glossary.title": "ⓘ Glossaire — signification des variables",
2338
  "gamma_check.glossary.gamma_pade": "<strong>γ_Padé</strong> : prédiction fermée (2−z)/(2+z), z = T√2/θ. Paper §sec:gamma_decomposition.",
2339
  "gamma_check.glossary.gamma_obs": "<strong>γ_observé</strong> : mesuré empiriquement à partir des attention scores (exécutez Diagnose CLI sur poids réels).",
@@ -3457,6 +3460,7 @@ export const TRANSLATIONS = {
3457
  "gamma_check.validity.overpade.hint": "提示:η > 1.5 可能表示欠训练早期 checkpoint、Lerch 修正体制、或超出 Padé 近似的修正项。",
3458
  "gamma_check.validity.swa.hint": "提示:滑动窗口架构 (Mistral, Gemma) 在设计上违反闭式公式的 full-attention 假设。",
3459
  "gamma_check.validity.unknown.hint": "提示:γ_obs 超出物理范围或测量噪声。请核验输入并重新测量。",
 
3460
  "gamma_check.glossary.title": "ⓘ 词汇表 — 变量含义",
3461
  "gamma_check.glossary.gamma_pade": "<strong>γ_Padé</strong>:闭式预测 (2−z)/(2+z), z = T√2/θ。论文 §sec:gamma_decomposition。",
3462
  "gamma_check.glossary.gamma_obs": "<strong>γ_观测</strong>:从注意力分数经验测得 (在真实权重上运行 Diagnose CLI)。",
 
1061
  "gamma_check.validity.overpade.hint": "Hint: η > 1.5 may indicate an undertrained early checkpoint, a Lerch-corrected regime, or correction terms beyond the Padé approximation.",
1062
  "gamma_check.validity.swa.hint": "Hint: Sliding-window architectures (Mistral, Gemma) violate the full-attention assumption of the closed-form by design.",
1063
  "gamma_check.validity.unknown.hint": "Hint: γ_obs out of physical range or measurement noise. Verify your inputs and re-measure.",
1064
+ "gamma_check.validity.summary_pill": "⚠ Validity gate",
1065
  "gamma_check.glossary.title": "ⓘ Glossary — what these variables mean",
1066
  "gamma_check.glossary.gamma_pade": "<strong>γ_Padé</strong>: closed-form prediction (2−z)/(2+z), z = T√2/θ. Paper §sec:gamma_decomposition.",
1067
  "gamma_check.glossary.gamma_obs": "<strong>γ_observed</strong>: empirically measured from your model's attention scores (run the Diagnose CLI on real weights).",
 
1212
  "gamma_check.validity.overpade.hint": "Pista: η > 1.5 puede indicar checkpoint temprano sub-entrenado, régimen Lerch-corregido, o términos de corrección más allá de la aproximación de Padé.",
1213
  "gamma_check.validity.swa.hint": "Pista: arquitecturas sliding-window (Mistral, Gemma) violan por diseño la asunción de full-attention de la fórmula cerrada.",
1214
  "gamma_check.validity.unknown.hint": "Pista: γ_obs fuera de rango físico o ruido de medición. Verifica entradas y vuelve a medir.",
1215
+ "gamma_check.validity.summary_pill": "⚠ Gate de validez",
1216
  "gamma_check.glossary.title": "ⓘ Glosario — significado de las variables",
1217
  "gamma_check.glossary.gamma_pade": "<strong>γ_Padé</strong>: predicción cerrada (2−z)/(2+z), z = T√2/θ. Paper §sec:gamma_decomposition.",
1218
  "gamma_check.glossary.gamma_obs": "<strong>γ_observado</strong>: medido empíricamente desde los attention scores (ejecuta Diagnose CLI sobre pesos reales).",
 
2336
  "gamma_check.validity.overpade.hint": "Indice : η > 1.5 peut indiquer un checkpoint précoce sous-entraîné, un régime Lerch-corrigé, ou des termes de correction au-delà de l'approximation de Padé.",
2337
  "gamma_check.validity.swa.hint": "Indice : les architectures sliding-window (Mistral, Gemma) violent par conception l'hypothèse de full-attention de la forme close.",
2338
  "gamma_check.validity.unknown.hint": "Indice : γ_obs hors plage physique ou bruit de mesure. Vérifiez vos entrées et remesurez.",
2339
+ "gamma_check.validity.summary_pill": "⚠ Garde de validité",
2340
  "gamma_check.glossary.title": "ⓘ Glossaire — signification des variables",
2341
  "gamma_check.glossary.gamma_pade": "<strong>γ_Padé</strong> : prédiction fermée (2−z)/(2+z), z = T√2/θ. Paper §sec:gamma_decomposition.",
2342
  "gamma_check.glossary.gamma_obs": "<strong>γ_observé</strong> : mesuré empiriquement à partir des attention scores (exécutez Diagnose CLI sur poids réels).",
 
3460
  "gamma_check.validity.overpade.hint": "提示:η > 1.5 可能表示欠训练早期 checkpoint、Lerch 修正体制、或超出 Padé 近似的修正项。",
3461
  "gamma_check.validity.swa.hint": "提示:滑动窗口架构 (Mistral, Gemma) 在设计上违反闭式公式的 full-attention 假设。",
3462
  "gamma_check.validity.unknown.hint": "提示:γ_obs 超出物理范围或测量噪声。请核验输入并重新测量。",
3463
+ "gamma_check.validity.summary_pill": "⚠ 有效性门",
3464
  "gamma_check.glossary.title": "ⓘ 词汇表 — 变量含义",
3465
  "gamma_check.glossary.gamma_pade": "<strong>γ_Padé</strong>:闭式预测 (2−z)/(2+z), z = T√2/θ。论文 §sec:gamma_decomposition。",
3466
  "gamma_check.glossary.gamma_obs": "<strong>γ_观测</strong>:从注意力分数经验测得 (在真实权重上运行 Diagnose CLI)。",
js/main.js CHANGED
@@ -2396,6 +2396,18 @@ function renderProfile(p, params) {
2396
  const gammaForPill = kn.gamma_decomposed ?? kn.gamma_pade;
2397
  const recipeCount = Object.keys(p.recipes).length;
2398
 
 
 
 
 
 
 
 
 
 
 
 
 
2399
  $("profile-box").innerHTML = `
2400
  <div class="taf-card">
2401
  <div class="taf-hero">
@@ -2427,9 +2439,10 @@ function renderProfile(p, params) {
2427
  </div>
2428
  </details>
2429
 
2430
- <details class="taf-section">
2431
  <summary>
2432
  <span data-i18n="tafcard.diag_title">🔬 Diagnostics — numbers + γ check + what-if</span>
 
2433
  </summary>
2434
  <div class="taf-section-body">
2435
  <h4 style="margin-top:0.3em;" data-i18n="tafcard.numbers_title">🔢 Key numbers (paper §26)</h4>
@@ -2444,7 +2457,7 @@ function renderProfile(p, params) {
2444
  <label><span data-i18n="gamma_check.gobs_label">γ_observed</span>
2445
  <span class="info"><span class="tooltip" data-i18n="gamma_check.gobs_tip">Empirically measured γ from your model's attention scores. Use the Diagnose CLI to obtain this from real weights.</span></span>
2446
  </label>
2447
- <input type="number" id="gc-gobs" step="0.0001" value="${formatN(kn.gamma_decomposed ?? kn.gamma_pade)}" />
2448
  </div>
2449
  <div class="form-field">
2450
  <label><span data-i18n="gamma_check.random_label">Random corpus?</span>
 
2396
  const gammaForPill = kn.gamma_decomposed ?? kn.gamma_pade;
2397
  const recipeCount = Object.keys(p.recipes).length;
2398
 
2399
+ // v0.8.9: pre-compute γ Validity Gate state so we can auto-expand Diagnostics when banner fires.
2400
+ const _initGObs = kn.gamma_decomposed ?? kn.gamma_pade;
2401
+ const _initGCheck = (typeof _initGObs === "number" && Number.isFinite(_initGObs))
2402
+ ? gammaCheckAll({ theta: params.theta, T: params.T_eval, gObs: _initGObs, isRandom: false })
2403
+ : null;
2404
+ const _validitySet = new Set(["fraud", "compressed", "overpade", "swa", "unknown"]);
2405
+ const initialBannerActive = _initGCheck && (
2406
+ _validitySet.has(_initGCheck.regime) ||
2407
+ (Number.isFinite(_initGCheck.efficiency) && (_initGCheck.efficiency < 0.85 || _initGCheck.efficiency > 1.15))
2408
+ );
2409
+ const diagOpenAttr = initialBannerActive ? " open" : "";
2410
+
2411
  $("profile-box").innerHTML = `
2412
  <div class="taf-card">
2413
  <div class="taf-hero">
 
2439
  </div>
2440
  </details>
2441
 
2442
+ <details class="taf-section"${diagOpenAttr}>
2443
  <summary>
2444
  <span data-i18n="tafcard.diag_title">🔬 Diagnostics — numbers + γ check + what-if</span>
2445
+ ${initialBannerActive ? `<span class="section-count" style="background:rgba(210,153,34,0.18); color:#d29922; border:1px solid rgba(210,153,34,0.4);" data-i18n="gamma_check.validity.summary_pill">⚠ Validity gate</span>` : ""}
2446
  </summary>
2447
  <div class="taf-section-body">
2448
  <h4 style="margin-top:0.3em;" data-i18n="tafcard.numbers_title">🔢 Key numbers (paper §26)</h4>
 
2457
  <label><span data-i18n="gamma_check.gobs_label">γ_observed</span>
2458
  <span class="info"><span class="tooltip" data-i18n="gamma_check.gobs_tip">Empirically measured γ from your model's attention scores. Use the Diagnose CLI to obtain this from real weights.</span></span>
2459
  </label>
2460
+ <input type="number" id="gc-gobs" step="0.0001" value="${(() => { const v = kn.gamma_decomposed ?? kn.gamma_pade; return (typeof v === "number" && Number.isFinite(v)) ? v.toFixed(4) : ""; })()}" />
2461
  </div>
2462
  <div class="form-field">
2463
  <label><span data-i18n="gamma_check.random_label">Random corpus?</span>