BurnyCoder commited on
Commit
1ef0d0e
·
verified ·
1 Parent(s): 4b1a82f

Archive hybrid implementation, locked dependencies and new tests before running models

Browse files
Files changed (3) hide show
  1. explorer.js +8 -3
  2. index.html +4 -1
  3. study.json +0 -0
explorer.js CHANGED
@@ -15,6 +15,10 @@ const metrics = {
15
  raw_third: ["Third-derivative norm estimate", "squared Frobenius estimate"],
16
  raw_trace: ["Hessian trace estimate", "signed trace estimate"],
17
  raw_hessian_norm: ["Squared Hessian norm estimate", "squared Frobenius estimate"],
 
 
 
 
18
  };
19
  const axes = {tokens: "training target tokens", train_seconds: "training seconds", step: "optimizer steps"};
20
  const numeric = value => typeof value === "number" && Number.isFinite(value);
@@ -67,7 +71,8 @@ function rebuildFilters() {
67
  function showTotals() {
68
  element("runs-count").textContent = number(study.runs.filter(isComplete).length, 0);
69
  for (const [field, target] of [["tokens", "tokens-count"], ["train_seconds", "hours-count"]]) {
70
- const values = study.runs.map(run => run[field]).filter(numeric);
 
71
  const total = values.reduce((a, b) => a + b, 0);
72
  element(target).textContent = values.length ? (field === "tokens" ? compact(total) : number(total / 3600, 2) + " h") : "—";
73
  if (values.length) element(target).title = number(total, 0) + (field === "tokens" ? " training tokens" : " seconds");
@@ -155,7 +160,7 @@ function draw() {
155
  if (metric.endsWith("accuracy")) {
156
  low = 0; high = 100;
157
  } else {
158
- const pad = (high - low || Math.max(Math.abs(high) * .1, .01)) * .09;
159
  low -= pad; high += pad;
160
  if (["dev_nll", "loss", "raw_third", "raw_hessian_norm"].includes(metric)) low = Math.max(0, low);
161
  }
@@ -205,7 +210,7 @@ function draw() {
205
  ctx.fillStyle = "white"; ctx.strokeStyle = methodColor(p.run.method); ctx.lineWidth = 2.3;
206
  ctx.beginPath(); ctx.arc(p.px, p.py, 4.7, 0, Math.PI * 2); ctx.fill(); ctx.stroke();
207
  element("point").textContent = p.run.id + " · " + number(p.x, axis === "train_seconds" ? 1 : 0) +
208
- " " + axes[axis] + " · " + number(p.y, 4) + " " + metrics[metric][1];
209
  }
210
  }
211
 
 
15
  raw_third: ["Third-derivative norm estimate", "squared Frobenius estimate"],
16
  raw_trace: ["Hessian trace estimate", "signed trace estimate"],
17
  raw_hessian_norm: ["Squared Hessian norm estimate", "squared Frobenius estimate"],
18
+ width: ["Directional width", "Euclidean weight distance"], width_probe_nll: ["Width-probe loss", "nats / target token"],
19
+ curvature_rms: ["Rolling RMS curvature", "RMS Hessian eigenvalue estimate"],
20
+ third_lambda: ["Third-derivative coefficient", "coefficient"], trace_lambda: ["Trace coefficient", "coefficient"],
21
+ gradient_norm: ["Unclipped gradient norm", "Euclidean gradient norm"],
22
  };
23
  const axes = {tokens: "training target tokens", train_seconds: "training seconds", step: "optimizer steps"};
24
  const numeric = value => typeof value === "number" && Number.isFinite(value);
 
71
  function showTotals() {
72
  element("runs-count").textContent = number(study.runs.filter(isComplete).length, 0);
73
  for (const [field, target] of [["tokens", "tokens-count"], ["train_seconds", "hours-count"]]) {
74
+ const values = study.runs.filter(run => numeric(run[field])).map(run =>
75
+ Math.max(0,run[field] - (run["inherited_" + field] || 0)));
76
  const total = values.reduce((a, b) => a + b, 0);
77
  element(target).textContent = values.length ? (field === "tokens" ? compact(total) : number(total / 3600, 2) + " h") : "—";
78
  if (values.length) element(target).title = number(total, 0) + (field === "tokens" ? " training tokens" : " seconds");
 
160
  if (metric.endsWith("accuracy")) {
161
  low = 0; high = 100;
162
  } else {
163
+ const pad = (high - low || Math.abs(high) * .1 || .01) * .09;
164
  low -= pad; high += pad;
165
  if (["dev_nll", "loss", "raw_third", "raw_hessian_norm"].includes(metric)) low = Math.max(0, low);
166
  }
 
210
  ctx.fillStyle = "white"; ctx.strokeStyle = methodColor(p.run.method); ctx.lineWidth = 2.3;
211
  ctx.beginPath(); ctx.arc(p.px, p.py, 4.7, 0, Math.PI * 2); ctx.fill(); ctx.stroke();
212
  element("point").textContent = p.run.id + " · " + number(p.x, axis === "train_seconds" ? 1 : 0) +
213
+ " " + axes[axis] + " · " + (p.y !== 0 && Math.abs(p.y)<.0001 ? p.y.toExponential(4) : number(p.y, 4)) + " " + metrics[metric][1];
214
  }
215
  }
216
 
index.html CHANGED
@@ -49,6 +49,9 @@
49
  <option value="dev_accuracy">Development accuracy</option><option value="accuracy">Training accuracy</option>
50
  <option value="penalty">Weighted active penalty</option><option value="raw_third">Third-derivative norm estimate</option>
51
  <option value="raw_trace">Hessian trace estimate</option><option value="raw_hessian_norm">Squared Hessian norm estimate</option>
 
 
 
52
  </select></label>
53
  <label>Horizontal axis<select id="axis"><option value="tokens">Training tokens</option><option value="train_seconds">Training time</option><option value="step">Optimizer steps</option></select></label>
54
  </div>
@@ -95,7 +98,7 @@
95
  <p class="prose">Hochreiter and Schmidhuber proposed that among equally good training fits, flatter minima may generalize better. If weights can be rounded more coarsely and still fit, a good predictor can take fewer bits to describe. Here the test of generalization is how well the model predicts unseen tokens. <a href="https://people.idsia.ch/~juergen/fm/node1.html">Flat Minima (1997) ↗</a></p>
96
  <p class="prose">The Hessian describes local loss curvature. On active updates, two independent random sign vectors estimate how quickly that curvature changes for the next-token loss of two text windows. The derivatives cover all TinyStories decoder weights or only Pythia’s trainable attention adapters, including interactions between trainable weights.</p>
97
  <p class="prose">When moving away from a flat bottom makes curvature change faster, the third-derivative penalty can pull the weights back. A steep bowl with constant curvature receives zero penalty from this term. Whether the optimizer finds wider minima is a separate question from the measured next-token loss.</p>
98
- <p class="prose">A proposed TinyStories follow-up would keep the trace active and increase the weight on the third-derivative penalty once loss and recent curvature are low. Keeping that weight high could discourage later steps toward an edge where curvature changes rapidly. The experiment would compare the width retained with a fixed late start. <a href="https://huggingface.co/BurnyCoder/thirdloss-study/blob/main/research/reports/plan.md#curvature-dependent-penalty-weight">Schedule and planned controls ↗</a></p>
99
  <img class="architecture" src="figures/penalty-directions.png" alt="Analytic loss curves. Trace and third-derivative penalties push in opposite directions at an asymmetric minimum. They pull displaced weights back in a flat quartic and give zero update in a steep quadratic." loading="lazy">
100
  <p class="curve-note">Circles mark the ordinary loss minima. Arrows show downhill directions for each penalty. The vertical scales vary by panel. <a href="https://huggingface.co/BurnyCoder/thirdloss-study/blob/main/research/docs/third-derivative-penalty.md#when-can-the-penalty-favor-a-wider-minimum">Worked examples and the basin-width bound ↗</a></p>
101
  <img class="architecture" src="figures/architecture.png" alt="TinyStories full-weight training and Pythia QKV adaptation feed next-token cross-entropy, a Hessian contraction, a third derivative and the regularized objective." loading="lazy">
 
49
  <option value="dev_accuracy">Development accuracy</option><option value="accuracy">Training accuracy</option>
50
  <option value="penalty">Weighted active penalty</option><option value="raw_third">Third-derivative norm estimate</option>
51
  <option value="raw_trace">Hessian trace estimate</option><option value="raw_hessian_norm">Squared Hessian norm estimate</option>
52
+ <option value="width">Directional width</option><option value="width_probe_nll">Width-probe training NLL</option>
53
+ <option value="curvature_rms">Rolling RMS curvature</option><option value="third_lambda">Third-derivative coefficient</option>
54
+ <option value="trace_lambda">Trace coefficient</option><option value="gradient_norm">Unclipped gradient norm</option>
55
  </select></label>
56
  <label>Horizontal axis<select id="axis"><option value="tokens">Training tokens</option><option value="train_seconds">Training time</option><option value="step">Optimizer steps</option></select></label>
57
  </div>
 
98
  <p class="prose">Hochreiter and Schmidhuber proposed that among equally good training fits, flatter minima may generalize better. If weights can be rounded more coarsely and still fit, a good predictor can take fewer bits to describe. Here the test of generalization is how well the model predicts unseen tokens. <a href="https://people.idsia.ch/~juergen/fm/node1.html">Flat Minima (1997) ↗</a></p>
99
  <p class="prose">The Hessian describes local loss curvature. On active updates, two independent random sign vectors estimate how quickly that curvature changes for the next-token loss of two text windows. The derivatives cover all TinyStories decoder weights or only Pythia’s trainable attention adapters, including interactions between trainable weights.</p>
100
  <p class="prose">When moving away from a flat bottom makes curvature change faster, the third-derivative penalty can pull the weights back. A steep bowl with constant curvature receives zero penalty from this term. Whether the optimizer finds wider minima is a separate question from the measured next-token loss.</p>
101
+ <p class="prose">The TinyStories hybrid follow-up keeps the trace active. Its adaptive arm raises the third-derivative coefficient when recent curvature and training loss fall. Use the hybrid phase and directional width or coefficient measurements above to compare the adaptive arm, fixed ramp and replay controls. <a href="https://huggingface.co/BurnyCoder/thirdloss-study/blob/main/research/reports/hybrid/results.md">Widths, development scores and raw rays ↗</a></p>
102
  <img class="architecture" src="figures/penalty-directions.png" alt="Analytic loss curves. Trace and third-derivative penalties push in opposite directions at an asymmetric minimum. They pull displaced weights back in a flat quartic and give zero update in a steep quadratic." loading="lazy">
103
  <p class="curve-note">Circles mark the ordinary loss minima. Arrows show downhill directions for each penalty. The vertical scales vary by panel. <a href="https://huggingface.co/BurnyCoder/thirdloss-study/blob/main/research/docs/third-derivative-penalty.md#when-can-the-penalty-favor-a-wider-minimum">Worked examples and the basin-width bound ↗</a></p>
104
  <img class="architecture" src="figures/architecture.png" alt="TinyStories full-weight training and Pythia QKV adaptation feed next-token cross-entropy, a Hessian contraction, a third derivative and the regularized objective." loading="lazy">
study.json CHANGED
The diff for this file is too large to render. See raw diff