BurnyCoder commited on
Commit
82872ac
·
verified ·
1 Parent(s): abc99c1

Measure training-window flatness for abstracts-pilot-s00-trace-r01-fp64

Browse files
README.md CHANGED
@@ -80,6 +80,72 @@ How far can the weights move before next-token loss rises by 0.1 nats on eight f
80
  | Cross-seed replay | 22 | 15.403 | 13.218 | One seed | 12.987–13.496 | 0/32 |
81
  | Always-on hybrid | 21, 22, 23 | 15.256 | 13.229 | 13.060–13.334 | 13.085–13.390 | 0/96 |
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  **TinyStories pretraining · development pilots · seeds 0 · 2,097,152 training targets**
84
 
85
  | Flatness statistic | AdamW | Hessian trace | Third order |
@@ -132,7 +198,7 @@ The remaining controls are paired independently. Each row uses only seeds that f
132
 
133
  **Pythia-410M adapters** · Secondary pilot comparisons are pending.
134
 
135
- **Untrained references · zero training targets**
136
 
137
  | Stage | Initial NLL<br>↓ Lower is better | Unigram NLL<br>↓ Lower is better | Initial accuracy<br>↑ Higher is better | Unigram accuracy<br>↑ Higher is better |
138
  | --- | --- | --- | --- | --- |
 
80
  | Cross-seed replay | 22 | 15.403 | 13.218 | One seed | 12.987–13.496 | 0/32 |
81
  | Always-on hybrid | 21, 22, 23 | 15.256 | 13.229 | 13.060–13.334 | 13.085–13.390 | 0/96 |
82
 
83
+ #### All variants and baselines
84
+
85
+ Each row uses the same fixed training windows and probe directions within its stage. Parentheses give measured / planned seeds for that cell. Targets count next-token examples used for optimizer updates in this study. The unigram uses counts from the full training split, and initial Pythia retains its pretrained backbone. Compare rows with matching targets and seeds. Larger **weight width** means greater tolerance to moving the model’s trainable parameters. Larger **common score width** means that all token scores can tolerate a larger shared bias before NLL rises by 0.1 nats, measured in RMS logit units. The unigram has zero trainable model weights and shares the score test with every neural predictor. Both widths have an unknown relationship to better held-out prediction. [All-model measurement design](https://huggingface.co/BurnyCoder/thirdloss-study/blob/main/research/reports/amendments/all-model-flatness.md)
86
+
87
+ **TinyStories · all model weights**
88
+
89
+ | Variant | Training targets | Seed cohort | Weight width<br>↑ Wider is flatter | RMS weight curvature<br>↓ Less local bending | Common score width<br>↑ More score tolerance |
90
+ | --- | --- | --- | --- | --- | --- |
91
+ | Initial checkpoint | 0 | 0 | Pending | Pending | Pending |
92
+ | Unigram | 0 | 0 | N/A · no weights | N/A · no weights | Pending |
93
+ | Ordinary AdamW | 2,097,152 | 0 | 15.579 (1/1) | 0.45329 (1/1) | Pending |
94
+ | Hessian trace (1%) | 2,097,152 | 0 | 15.686 (1/1) | 0.44772 (1/1) | Pending |
95
+ | Third derivative (1%) | 2,097,152 | 0 | 15.640 (1/1) | 0.44739 (1/1) | Pending |
96
+ | Squared Hessian norm (3%) | 2,097,152 | 0 | Pending | Pending | Pending |
97
+ | Randomized gradient signs (1%) | 2,097,152 | 0 | Pending | Pending | Pending |
98
+ | Trace + third derivative (1%) | 2,097,152 | 0 | Pending | Pending | Pending |
99
+ | Ordinary AdamW · confirmation | 16,777,216 | 1–8 | Pending | Pending | Pending |
100
+ | Hessian trace · confirmation | 16,777,216 | 1–8 | Pending | Pending | Pending |
101
+ | Third derivative · confirmation | 16,777,216 | 1–8 | Pending | Pending | Pending |
102
+ | Shared trace checkpoint | 8,388,608 | 21–28 | 15.143 (3/8) | Pending | Pending |
103
+ | Curvature-dependent hybrid · hybrid study | 16,777,216 | 21–28 | 13.157 (3/8) | Pending | Pending |
104
+ | Fixed late hybrid · hybrid study | 16,777,216 | 21–28 | 13.215 (3/8) | Pending | Pending |
105
+ | Hessian trace · hybrid study | 16,777,216 | 21–28 | 13.154 (3/8) | Pending | Pending |
106
+ | Stronger trace · hybrid study | 16,777,216 | 21–28 | 13.175 (3/8) | Pending | Pending |
107
+ | Cross-seed replay · hybrid study | 16,777,216 | 21–28 | 13.218 (1/8) | Pending | Pending |
108
+ | Always-on hybrid · hybrid study | 16,777,216 | 21–28 | 13.229 (3/8) | Pending | Pending |
109
+
110
+ <details><summary>TinyStories · all model weights · other pilot strengths and precision diagnostics</summary>
111
+
112
+ | Variant | Training targets | Seed cohort | Weight width<br>↑ Wider is flatter | RMS weight curvature<br>↓ Less local bending | Common score width<br>↑ More score tolerance |
113
+ | --- | --- | --- | --- | --- | --- |
114
+ | Hessian trace (3%) | 2,097,152 | 0 | Pending | Pending | Pending |
115
+ | Hessian trace (10%) | 2,097,152 | 0 | Pending | Pending | Pending |
116
+ | Third derivative (3%) | 2,097,152 | 0 | Pending | Pending | Pending |
117
+ | Third derivative (10%) | 2,097,152 | 0 | Pending | Pending | Pending |
118
+
119
+ </details>
120
+
121
+ **Pythia-410M · adapter weights**
122
+
123
+ | Variant | Training targets | Seed cohort | Weight width<br>↑ Wider is flatter | RMS weight curvature<br>↓ Less local bending | Common score width<br>↑ More score tolerance |
124
+ | --- | --- | --- | --- | --- | --- |
125
+ | Initial checkpoint | 0 | 0 | Pending | Pending | Pending |
126
+ | Unigram | 0 | 0 | N/A · no weights | N/A · no weights | Pending |
127
+ | Ordinary AdamW | 65,536 | 0 | 19.784 (1/1) | 1.2868 (1/1) | Pending |
128
+ | Hessian trace (1%) | 65,536 | 0 | 19.751 (1/1) | 1.1818 (1/1) | Pending |
129
+ | Third derivative (1%) | 65,536 | 0 | Pending | Pending | Pending |
130
+ | Squared Hessian norm (3%) | 65,536 | 0 | Pending | Pending | Pending |
131
+ | Randomized gradient signs (1%) | 65,536 | 0 | Pending | Pending | Pending |
132
+ | Trace + third derivative (1%) | 65,536 | 0 | Pending | Pending | Pending |
133
+ | Ordinary AdamW · confirmation | 524,288 | 1–8 | Pending | Pending | Pending |
134
+ | Hessian trace · confirmation | 524,288 | 1–8 | Pending | Pending | Pending |
135
+ | Third derivative · confirmation | 524,288 | 1–8 | Pending | Pending | Pending |
136
+
137
+ <details><summary>Pythia-410M · adapter weights · other pilot strengths and precision diagnostics</summary>
138
+
139
+ | Variant | Training targets | Seed cohort | Weight width<br>↑ Wider is flatter | RMS weight curvature<br>↓ Less local bending | Common score width<br>↑ More score tolerance |
140
+ | --- | --- | --- | --- | --- | --- |
141
+ | Hessian trace (3%) | 65,536 | 0 | Pending | Pending | Pending |
142
+ | Hessian trace (10%) | 65,536 | 0 | Pending | Pending | Pending |
143
+ | Third derivative (3%) | 65,536 | 0 | Pending | Pending | Pending |
144
+ | Third derivative (10%) | 65,536 | 0 | Pending | Pending | Pending |
145
+ | Third derivative (3%) · excluded precision diagnostic | 65,536 | 0 | Pending | Pending | Pending |
146
+
147
+ </details>
148
+
149
  **TinyStories pretraining · development pilots · seeds 0 · 2,097,152 training targets**
150
 
151
  | Flatness statistic | AdamW | Hessian trace | Third order |
 
198
 
199
  **Pythia-410M adapters** · Secondary pilot comparisons are pending.
200
 
201
+ **Zero-update references** · The unigram uses training-split frequencies. Initial Pythia uses its pretrained weights.
202
 
203
  | Stage | Initial NLL<br>↓ Lower is better | Unigram NLL<br>↓ Lower is better | Initial accuracy<br>↑ Higher is better | Unigram accuracy<br>↑ Higher is better |
204
  | --- | --- | --- | --- | --- |
logs/all-model-flatness-release.log ADDED
@@ -0,0 +1 @@
 
 
1
+ findfont: Failed to find font weight semibold for DejaVu Sans, now using 700.
logs/all-model-flatness-render.log ADDED
@@ -0,0 +1 @@
 
 
1
+ findfont: Failed to find font weight semibold for DejaVu Sans, now using 700.
logs/checkpoint-flatness-20261125T163331Z-stderr.log CHANGED
@@ -185,3 +185,67 @@ findfont: Failed to find font weight semibold for DejaVu Sans, now using 700.
185
 
186
  : 100%|##########| 662kB / 662kB
187
 
188
  findfont: Failed to find font weight semibold for DejaVu Sans, now using 700.
 
 
 
 
189
  : 95%|#########4| 627kB / 662kB 
 
 
190
  : 95%|#########4| 627kB / 662kB 
 
 
191
  : 95%|#########4| 627kB / 662kB 
 
 
192
  : 95%|#########4| 627kB / 662kB 
 
 
193
  : 95%|#########4| 627kB / 662kB 
 
 
194
  : 95%|#########4| 627kB / 662kB 
 
 
195
  : 95%|#########4| 627kB / 662kB 
 
 
196
  : 95%|#########4| 627kB / 662kB 
 
 
197
  : 95%|#########4| 627kB / 662kB 
 
 
198
  : 100%|##########| 662kB / 662kB 
 
 
 
199
  : 100%|##########| 662kB / 662kB 
 
 
200
  : 100%|##########| 662kB / 662kB 
 
 
201
  : 100%|##########| 662kB / 662kB 
 
 
202
  : 100%|##########| 662kB / 662kB 
 
 
203
  : 100%|##########| 662kB / 662kB 
 
 
 
 
 
 
 
 
204
  : 100%|##########| 662kB / 662kB 
 
 
 
 
 
205
  : 100%|##########| 662kB / 662kB 
 
 
 
 
 
206
  : 100%|##########| 662kB / 662kB 
 
 
 
 
 
207
  : 100%|##########| 662kB / 662kB 
 
 
 
 
 
 
208
  : 100%|##########| 662kB / 662kB
 
 
 
185
 
186
  : 100%|##########| 662kB / 662kB
187
 
188
  findfont: Failed to find font weight semibold for DejaVu Sans, now using 700.
189
+
190
+
191
+
192
+
193
  : 95%|#########4| 627kB / 662kB 
194
+
195
+
196
  : 95%|#########4| 627kB / 662kB 
197
+
198
+
199
  : 95%|#########4| 627kB / 662kB 
200
+
201
+
202
  : 95%|#########4| 627kB / 662kB 
203
+
204
+
205
  : 95%|#########4| 627kB / 662kB 
206
+
207
+
208
  : 95%|#########4| 627kB / 662kB 
209
+
210
+
211
  : 95%|#########4| 627kB / 662kB 
212
+
213
+
214
  : 95%|#########4| 627kB / 662kB 
215
+
216
+
217
  : 95%|#########4| 627kB / 662kB 
218
+
219
+
220
  : 100%|##########| 662kB / 662kB 
221
+
222
+
223
+
224
  : 100%|##########| 662kB / 662kB 
225
+
226
+
227
  : 100%|##########| 662kB / 662kB 
228
+
229
+
230
  : 100%|##########| 662kB / 662kB 
231
+
232
+
233
  : 100%|##########| 662kB / 662kB 
234
+
235
+
236
  : 100%|##########| 662kB / 662kB 
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
  : 100%|##########| 662kB / 662kB 
246
+
247
+
248
+
249
+
250
+
251
  : 100%|##########| 662kB / 662kB 
252
+
253
+
254
+
255
+
256
+
257
  : 100%|##########| 662kB / 662kB 
258
+
259
+
260
+
261
+
262
+
263
  : 100%|##########| 662kB / 662kB 
264
+
265
+
266
+
267
+
268
+
269
+
270
  : 100%|##########| 662kB / 662kB
271
+
272
+ findfont: Failed to find font weight semibold for DejaVu Sans, now using 700.
logs/checkpoint-flatness-20261125T163331Z.log CHANGED
@@ -8,3 +8,5 @@
8
  2026-11-25T16:40:55+00:00 stories-pilot-s00-third-r01 width=15.64013671875 RMS curvature=0.447394
9
  2026-11-25T16:41:21+00:00 Measuring checkpoint flatness for abstracts-pilot-s00-ce-r00
10
  2026-11-25T16:44:05+00:00 abstracts-pilot-s00-ce-r00 width=19.7841796875 RMS curvature=1.28684
 
 
 
8
  2026-11-25T16:40:55+00:00 stories-pilot-s00-third-r01 width=15.64013671875 RMS curvature=0.447394
9
  2026-11-25T16:41:21+00:00 Measuring checkpoint flatness for abstracts-pilot-s00-ce-r00
10
  2026-11-25T16:44:05+00:00 abstracts-pilot-s00-ce-r00 width=19.7841796875 RMS curvature=1.28684
11
+ 2026-11-25T16:44:34+00:00 Measuring checkpoint flatness for abstracts-pilot-s00-trace-r01-fp64
12
+ 2026-11-25T16:49:22+00:00 abstracts-pilot-s00-trace-r01-fp64 width=19.7509765625 RMS curvature=1.18181
publication.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "collection": "BurnyCoder/third-derivatives-in-language-model-training-6b067fb7d5ae3eca49ebb378",
3
- "git_revision": "57c80c5b04695c1c670338b51d9b4c2319cc0b68",
4
  "repositories": {
5
  "BurnyCoder/thirdloss-arxiv-abstracts-2024": {
6
  "files": {
@@ -61,9 +61,9 @@
61
  "size": 7098
62
  },
63
  "explorer.js": {
64
- "git_blob": "22799876fd3a245b596d1e5e7ee075892f1f109c",
65
- "sha256": "7af9e6ebba73a742362aa1a290578367be2d3a365a8e956b05fc6cc0cf7740c1",
66
- "size": 18510
67
  },
68
  "figures/architecture.png": {
69
  "git_blob": "2c41c712a9edfcc9f53e1ac8f76e751e54dc8924",
@@ -86,17 +86,17 @@
86
  "size": 156490
87
  },
88
  "index.html": {
89
- "git_blob": "6748c79821b0904714ac1971b101ab5928a597fc",
90
- "sha256": "bc5010988105dd566c5c8450a9f5264c6695be221ff7a040079cf0d69064da23",
91
- "size": 9629
92
  },
93
  "study.json": {
94
- "git_blob": "10e4fa3c2524673c3922b6bc051afd3270d4ff41",
95
- "sha256": "9939629a88eb848fc4e131cd4d53854f3b137d956a2c99a51d50425ca353c1ec",
96
- "size": 2499883
97
  }
98
  },
99
- "revision": "8437465e5e8f7b01ab7b5d0bc7433263ef98b142",
100
  "type": "space"
101
  },
102
  "BurnyCoder/thirdloss-pythia-410m-adapters": {
@@ -1419,9 +1419,9 @@
1419
  "BurnyCoder/thirdloss-study": {
1420
  "files": {
1421
  "README.md": {
1422
- "git_blob": "2a275bec5c200d2dfd02fdd076905b1790fb8b18",
1423
- "sha256": "0caa09009c7d634a41413e11adefdd5a8b87dcd6d17e03247a9773a0285f6708",
1424
- "size": 17525
1425
  },
1426
  "logs/abstracts-control-s00-initial-r00-20261125T083205378751Z.jsonl": {
1427
  "git_blob": "7afe7d20a699dfd5a611daca6298f2fa091c694c",
@@ -1493,6 +1493,16 @@
1493
  "sha256": "eef9ca7966fccfc27b3454cccd0107f2009ff422c2af5a4c54a694395d1e0bac",
1494
  "size": 1155
1495
  },
 
 
 
 
 
 
 
 
 
 
1496
  "logs/backfill-first-adapter.log": {
1497
  "git_blob": "1a3a93a4c8f183b4dd24d429880022f4e6410290",
1498
  "sha256": "2088274297f663dab5fa0b48e33456396ee7946758ba91f8bd96cb1718ac3198",
@@ -1504,14 +1514,14 @@
1504
  "size": 164140
1505
  },
1506
  "logs/checkpoint-flatness-20261125T163331Z-stderr.log": {
1507
- "git_blob": "a8f28e6bf5f02395b1f5e8cf0c4ef87fc1be9bfb",
1508
- "sha256": "19c63faf741ca479d697d660e0f0fd2a03e520bc1e7124ccc48c13a941d78064",
1509
- "size": 11835
1510
  },
1511
  "logs/checkpoint-flatness-20261125T163331Z.log": {
1512
- "git_blob": "4a680bd8e9b0d6d7350fece547a455e9bde2cda6",
1513
- "sha256": "510b33937ff83f55779f50d71e28236d8efe710255dc094cfd8442bd28d843d4",
1514
- "size": 889
1515
  },
1516
  "logs/dashboard-20261125T151603Z-errors.log": {
1517
  "git_blob": "05368bd6bcb80dae3bb7fee1ce931ef41f1811fe",
@@ -1989,9 +1999,9 @@
1989
  "size": 786
1990
  },
1991
  "research/README.md": {
1992
- "git_blob": "afd5dcd5aeb8d48c43715d44a118996039017ad3",
1993
- "sha256": "14831b1b1c3ad2e655ebc052f096107d7416225dc3d9dbb8618cdfc758c816ab",
1994
- "size": 31131
1995
  },
1996
  "research/docs/data.md": {
1997
  "git_blob": "1d0a74102cee4ed06b783085ca2ce823c6bf3a42",
@@ -2004,9 +2014,9 @@
2004
  "size": 7098
2005
  },
2006
  "research/docs/explorer.js": {
2007
- "git_blob": "22799876fd3a245b596d1e5e7ee075892f1f109c",
2008
- "sha256": "7af9e6ebba73a742362aa1a290578367be2d3a365a8e956b05fc6cc0cf7740c1",
2009
- "size": 18510
2010
  },
2011
  "research/docs/figures/architecture.png": {
2012
  "git_blob": "2c41c712a9edfcc9f53e1ac8f76e751e54dc8924",
@@ -2044,9 +2054,9 @@
2044
  "size": 1583
2045
  },
2046
  "research/docs/hub/archive.md": {
2047
- "git_blob": "2a275bec5c200d2dfd02fdd076905b1790fb8b18",
2048
- "sha256": "0caa09009c7d634a41413e11adefdd5a8b87dcd6d17e03247a9773a0285f6708",
2049
- "size": 17525
2050
  },
2051
  "research/docs/hub/space.md": {
2052
  "git_blob": "156f128287f1772dc3f22b423fbfb268f53b0136",
@@ -2059,19 +2069,19 @@
2059
  "size": 1435
2060
  },
2061
  "research/docs/index.html": {
2062
- "git_blob": "2dc4e5af5f48ff4f1df423136f875f2e6f43edeb",
2063
- "sha256": "cace84c8c8c8fcceb321db703d17e23729ac5d0e8d5075bd1c0c38f38a5b506c",
2064
- "size": 9925
2065
  },
2066
  "research/docs/runbook.md": {
2067
- "git_blob": "ea48f635e9f0453e7ec601c56ca2f14ec7150d4e",
2068
- "sha256": "edf84a54a921d611af0e262d338457c4b82f29eabf1a3b0e05d41f31e72ef4c8",
2069
- "size": 9147
2070
  },
2071
  "research/docs/study.json": {
2072
- "git_blob": "10e4fa3c2524673c3922b6bc051afd3270d4ff41",
2073
- "sha256": "9939629a88eb848fc4e131cd4d53854f3b137d956a2c99a51d50425ca353c1ec",
2074
- "size": 2499883
2075
  },
2076
  "research/docs/third-derivative-penalty.md": {
2077
  "git_blob": "ef2f9eaf958073e25771c60e97a4ce10b2a1b687",
@@ -2529,9 +2539,9 @@
2529
  "size": 236
2530
  },
2531
  "research/reports/flatness.md": {
2532
- "git_blob": "e4cbeeab7feec16802158305367d48fad20d3ab9",
2533
- "sha256": "417ef45aaff4ba6457768338baa5bc8f083fdf37bd6fd7f3ceaa6de37fd923a5",
2534
- "size": 2298
2535
  },
2536
  "research/reports/hybrid/preregistration.md": {
2537
  "git_blob": "0729e47d30933f401253bf21feac164c0217f7b4",
@@ -2549,9 +2559,9 @@
2549
  "size": 7290
2550
  },
2551
  "research/reports/paper.pdf": {
2552
- "git_blob": "246f5152a98637ca1ef5dddb95839bd509666aa9",
2553
- "sha256": "eeb9efd9d4d539ba00abb4df93f075f1fbdbb92cc3637d0ac0b55fbd148e9005",
2554
- "size": 661739
2555
  },
2556
  "research/reports/plan.md": {
2557
  "git_blob": "d15ec7b2f2324e3aedb389d2fd95208a31978596",
@@ -2559,9 +2569,9 @@
2559
  "size": 8376
2560
  },
2561
  "research/reports/planned-runs.md": {
2562
- "git_blob": "0384622ea612424eb7ff96cf1221542561310aa2",
2563
- "sha256": "3beee743e90034cf859ae089548738826571c5d401142302a50018f134a8bef9",
2564
- "size": 2942
2565
  },
2566
  "research/reports/preregistration.md": {
2567
  "git_blob": "3411a501f8cb3f3be0d31b70ee410094dae5dd95",
@@ -2569,8 +2579,8 @@
2569
  "size": 5234
2570
  },
2571
  "research/reports/progress.md": {
2572
- "git_blob": "6f3d8ebce072e9cd1cd723d838c5f2b55f1f8642",
2573
- "sha256": "a4edb498c8024715ab144ef315ae6b64a472dcd02eb48e4f96b737e0939619b2",
2574
  "size": 2289
2575
  },
2576
  "research/reports/reviews/adapter-verification.md": {
@@ -2798,6 +2808,11 @@
2798
  "sha256": "ffdb6a19f4a109ea003c98e7b5acb598e8012765e043e06996e03019d911ca79",
2799
  "size": 9277
2800
  },
 
 
 
 
 
2801
  "research/results/abstracts-pilot-s00-trace-r01-fp64/samples.jsonl": {
2802
  "git_blob": "95c97dc58c2266db68a67647645e41245266a7b4",
2803
  "sha256": "d2a99c73d4392f3b5ef547a36975c53afea90da977ad5983d18b82cb5e21376f",
@@ -4104,14 +4119,14 @@
4104
  "size": 9767
4105
  },
4106
  "research/src/thirdloss/checkpoint_flatness.py": {
4107
- "git_blob": "e983ebbf16c8059a2f793572432db6dfcea3d8bf",
4108
- "sha256": "6309ce5832b4d6818cf629c8d4d3a6ba53efb8a3dc30bf96d792caa12d35007e",
4109
- "size": 6022
4110
  },
4111
  "research/src/thirdloss/cli.py": {
4112
- "git_blob": "30fb1cc27083490d54849fc0fe11a20d5479ac58",
4113
- "sha256": "1f2780c809df053fafc628a8008d7a0101965ca406973be59811ec61c2551360",
4114
- "size": 7853
4115
  },
4116
  "research/src/thirdloss/data.py": {
4117
  "git_blob": "9b06438a0bce64f8d491cd65156ebe8aa04e8916",
@@ -4124,14 +4139,14 @@
4124
  "size": 4522
4125
  },
4126
  "research/src/thirdloss/flatness_stats.py": {
4127
- "git_blob": "0069e0f952944d0f654ff50452806bd4cea46666",
4128
- "sha256": "496cd383749c625c1dd144140fbd5a2c8f9b6434abdad0eaa807e70bdfbb4d1e",
4129
- "size": 1671
4130
  },
4131
  "research/src/thirdloss/flatness_tables.py": {
4132
- "git_blob": "964b675f55d3b927ecd8a580bc594546923cb8df",
4133
- "sha256": "c3f12cc36a351a1b2351ef6aed425117ba8d68cd0b05716b8e9fef898168a2b8",
4134
- "size": 5803
4135
  },
4136
  "research/src/thirdloss/hub_archive.py": {
4137
  "git_blob": "9a24c6c6f0f3f6e06fa43c775b47a5a03c1d12f6",
@@ -4189,9 +4204,9 @@
4189
  "size": 11879
4190
  },
4191
  "research/src/thirdloss/readme_comparisons.py": {
4192
- "git_blob": "f13ff404573a6db0fd24619f76930caf755513e6",
4193
- "sha256": "65f970adc80408894c4de0e2fac89979ea7ef53b891eb82cf9d8ea63a1de11d1",
4194
- "size": 22476
4195
  },
4196
  "research/src/thirdloss/records.py": {
4197
  "git_blob": "a800de00d42944f13a89d8d2f91ce9b2103bbd45",
@@ -4209,20 +4224,25 @@
4209
  "size": 10129
4210
  },
4211
  "research/src/thirdloss/report_paper.py": {
4212
- "git_blob": "989db9b040c8371cdd45bcee42c2e6528ef68207",
4213
- "sha256": "35e3ad2250698abc58da11aa7baec070e25873d1caebd27365693762a703646c",
4214
- "size": 35302
4215
  },
4216
  "research/src/thirdloss/report_records.py": {
4217
- "git_blob": "ff096fcc23b557db64119ba2f0bbe74cfe1c22f8",
4218
- "sha256": "049780f002bef0c8ebc92d6eccc545476d23d94c08365ea4447644b0ff0669bd",
4219
- "size": 15122
4220
  },
4221
  "research/src/thirdloss/reporting.py": {
4222
  "git_blob": "206d59a27fae7713677392a8e9d32769a7437239",
4223
  "sha256": "68ff0fca6554c91c0a77318e2ada25ea821a725f4b683775a89bf787101586bc",
4224
  "size": 21553
4225
  },
 
 
 
 
 
4226
  "research/src/thirdloss/study.py": {
4227
  "git_blob": "d3ef0cf8d4b40e1ce0f6996eedb8ee24415a86ab",
4228
  "sha256": "d5b1782a1a2ece89c5c0f11256a235dd3d004c2b536b4a4c2366111e6e981e19",
@@ -4239,9 +4259,9 @@
4239
  "size": 4135
4240
  },
4241
  "research/src/thirdloss/width.py": {
4242
- "git_blob": "271ad17ba188a064e6ae5a98fa54281b72c55e8e",
4243
- "sha256": "aabe0f894cb7d90650e6ede6e34bb684ca0a1442bec2b630d2ea13aeca821501",
4244
- "size": 3357
4245
  },
4246
  "research/src/thirdloss/windows.py": {
4247
  "git_blob": "2000a312e8326b97f88acead4b5c53e6d26eeab2",
@@ -4264,9 +4284,9 @@
4264
  "size": 16607
4265
  },
4266
  "research/tests/test_flatness.py": {
4267
- "git_blob": "c045f1d7aca3ee9e610d70a7aa4acf8e25f5c736",
4268
- "sha256": "8f4899df24688ee0da65f44d80ee02c55681dcdb13880ae28da04732a327781d",
4269
- "size": 2947
4270
  },
4271
  "research/tests/test_hub_archive.py": {
4272
  "git_blob": "4c8dc24e6eb5f0aa7fc5e63be56ba0efa3ad4ec4",
@@ -4348,5 +4368,5 @@
4348
  "type": "dataset"
4349
  }
4350
  },
4351
- "verified_at": "2026-11-25T16:44:27+00:00"
4352
  }
 
1
  {
2
  "collection": "BurnyCoder/third-derivatives-in-language-model-training-6b067fb7d5ae3eca49ebb378",
3
+ "git_revision": "f8c7ce90aed29b77911641f73716a41abaf877aa",
4
  "repositories": {
5
  "BurnyCoder/thirdloss-arxiv-abstracts-2024": {
6
  "files": {
 
61
  "size": 7098
62
  },
63
  "explorer.js": {
64
+ "git_blob": "cc8286c0876674074eefd770ddbb6f07a45c28a9",
65
+ "sha256": "a739ef1a7f33be360742878eb7ab666071e1ece2a1e8ccdd37e3041fe9d7d81d",
66
+ "size": 18706
67
  },
68
  "figures/architecture.png": {
69
  "git_blob": "2c41c712a9edfcc9f53e1ac8f76e751e54dc8924",
 
86
  "size": 156490
87
  },
88
  "index.html": {
89
+ "git_blob": "8554a72cc5f8e4a5d659c47d9c324e69289080ae",
90
+ "sha256": "c73d7163008db3270b8d22cae81303db04454d90f2fb79ca0ab9d165bb8cd77a",
91
+ "size": 9809
92
  },
93
  "study.json": {
94
+ "git_blob": "37092b9d2ea1aa45a7608ed9476a2355d2ce9135",
95
+ "sha256": "97b3ca72f40d4ae8f8e5fdee7da5801ded54e1112a745b9f3cfd8cfb8ae06a24",
96
+ "size": 2500700
97
  }
98
  },
99
+ "revision": "00b4b4fc380451df6830fcd80328d9032ee7102b",
100
  "type": "space"
101
  },
102
  "BurnyCoder/thirdloss-pythia-410m-adapters": {
 
1419
  "BurnyCoder/thirdloss-study": {
1420
  "files": {
1421
  "README.md": {
1422
+ "git_blob": "4ed969174922605e301d2d560fc35714ba731ecf",
1423
+ "sha256": "8f28c1db751c92c71e17acf6a54a577fdc97e7bd44e697cbf1fe05791877cda0",
1424
+ "size": 22775
1425
  },
1426
  "logs/abstracts-control-s00-initial-r00-20261125T083205378751Z.jsonl": {
1427
  "git_blob": "7afe7d20a699dfd5a611daca6298f2fa091c694c",
 
1493
  "sha256": "eef9ca7966fccfc27b3454cccd0107f2009ff422c2af5a4c54a694395d1e0bac",
1494
  "size": 1155
1495
  },
1496
+ "logs/all-model-flatness-release.log": {
1497
+ "git_blob": "37bbb4bdbd164007d9e8e84ddbdb5e73b2a11e1d",
1498
+ "sha256": "2ae7e37a0d60013de1b3d6870314f24554d6f4af83d0ce06b372b1eed3a9b1c6",
1499
+ "size": 79
1500
+ },
1501
+ "logs/all-model-flatness-render.log": {
1502
+ "git_blob": "37bbb4bdbd164007d9e8e84ddbdb5e73b2a11e1d",
1503
+ "sha256": "2ae7e37a0d60013de1b3d6870314f24554d6f4af83d0ce06b372b1eed3a9b1c6",
1504
+ "size": 79
1505
+ },
1506
  "logs/backfill-first-adapter.log": {
1507
  "git_blob": "1a3a93a4c8f183b4dd24d429880022f4e6410290",
1508
  "sha256": "2088274297f663dab5fa0b48e33456396ee7946758ba91f8bd96cb1718ac3198",
 
1514
  "size": 164140
1515
  },
1516
  "logs/checkpoint-flatness-20261125T163331Z-stderr.log": {
1517
+ "git_blob": "1e8f60d166cfa2c73ee3d3b79fee9c9efe003bb3",
1518
+ "sha256": "aed9391275ea0df7a16acd93393030ec11bb7ebb9dd0ff3e260820bb0dafbf9d",
1519
+ "size": 18700
1520
  },
1521
  "logs/checkpoint-flatness-20261125T163331Z.log": {
1522
+ "git_blob": "8b9a61e424d79cf58539351be75550f74fede645",
1523
+ "sha256": "5d070059de19012a6b457e801d785ae106a085443b668b0457b6e9bb6d76220f",
1524
+ "size": 1089
1525
  },
1526
  "logs/dashboard-20261125T151603Z-errors.log": {
1527
  "git_blob": "05368bd6bcb80dae3bb7fee1ce931ef41f1811fe",
 
1999
  "size": 786
2000
  },
2001
  "research/README.md": {
2002
+ "git_blob": "966e14f902454ef99813927004f32e572536f6f1",
2003
+ "sha256": "02fd9bc4dc8a70f5b37d99f9ffd144bd7d1842344a39fea23c5f3e6154122c5e",
2004
+ "size": 36312
2005
  },
2006
  "research/docs/data.md": {
2007
  "git_blob": "1d0a74102cee4ed06b783085ca2ce823c6bf3a42",
 
2014
  "size": 7098
2015
  },
2016
  "research/docs/explorer.js": {
2017
+ "git_blob": "cc8286c0876674074eefd770ddbb6f07a45c28a9",
2018
+ "sha256": "a739ef1a7f33be360742878eb7ab666071e1ece2a1e8ccdd37e3041fe9d7d81d",
2019
+ "size": 18706
2020
  },
2021
  "research/docs/figures/architecture.png": {
2022
  "git_blob": "2c41c712a9edfcc9f53e1ac8f76e751e54dc8924",
 
2054
  "size": 1583
2055
  },
2056
  "research/docs/hub/archive.md": {
2057
+ "git_blob": "4ed969174922605e301d2d560fc35714ba731ecf",
2058
+ "sha256": "8f28c1db751c92c71e17acf6a54a577fdc97e7bd44e697cbf1fe05791877cda0",
2059
+ "size": 22775
2060
  },
2061
  "research/docs/hub/space.md": {
2062
  "git_blob": "156f128287f1772dc3f22b423fbfb268f53b0136",
 
2069
  "size": 1435
2070
  },
2071
  "research/docs/index.html": {
2072
+ "git_blob": "7c1b5891c342f05d50874302e28759ab032d2ec4",
2073
+ "sha256": "e9c612153e3c0137364f770bf87ff0c348ba96d4e104fd4d1d25b294472cb951",
2074
+ "size": 10105
2075
  },
2076
  "research/docs/runbook.md": {
2077
+ "git_blob": "3d5a18e9b25fc4650b3c966263a211288e7b8664",
2078
+ "sha256": "083ac2fd172314370536b9dbed1e329652a83380e41b7e885ff73593e64d6428",
2079
+ "size": 9458
2080
  },
2081
  "research/docs/study.json": {
2082
+ "git_blob": "37092b9d2ea1aa45a7608ed9476a2355d2ce9135",
2083
+ "sha256": "97b3ca72f40d4ae8f8e5fdee7da5801ded54e1112a745b9f3cfd8cfb8ae06a24",
2084
+ "size": 2500700
2085
  },
2086
  "research/docs/third-derivative-penalty.md": {
2087
  "git_blob": "ef2f9eaf958073e25771c60e97a4ce10b2a1b687",
 
2539
  "size": 236
2540
  },
2541
  "research/reports/flatness.md": {
2542
+ "git_blob": "86881907dcee32bae5182cd6773635183a4a24de",
2543
+ "sha256": "ca13fc692657bfe6cf04e30089477c9d7a3cc421e047fd609fadeb09e02e0294",
2544
+ "size": 7244
2545
  },
2546
  "research/reports/hybrid/preregistration.md": {
2547
  "git_blob": "0729e47d30933f401253bf21feac164c0217f7b4",
 
2559
  "size": 7290
2560
  },
2561
  "research/reports/paper.pdf": {
2562
+ "git_blob": "f4bfe3b324c0131b45d754396896e60558aee582",
2563
+ "sha256": "c12e007b8fee2f0031057680091480d92df03b5513977808805e0f73c8e024a5",
2564
+ "size": 667675
2565
  },
2566
  "research/reports/plan.md": {
2567
  "git_blob": "d15ec7b2f2324e3aedb389d2fd95208a31978596",
 
2569
  "size": 8376
2570
  },
2571
  "research/reports/planned-runs.md": {
2572
+ "git_blob": "3bbd81926ef3b2a14eeab1853ed76ba2ad720a5c",
2573
+ "sha256": "8974a6b35f8ec3f6fe7f1d41b4113538458356f4395149c04232985e14b9f910",
2574
+ "size": 3279
2575
  },
2576
  "research/reports/preregistration.md": {
2577
  "git_blob": "3411a501f8cb3f3be0d31b70ee410094dae5dd95",
 
2579
  "size": 5234
2580
  },
2581
  "research/reports/progress.md": {
2582
+ "git_blob": "a0738665672ff72a00e88b6f62c38bbc031b959d",
2583
+ "sha256": "774ee1fbb60d47e63f46d2a0150bf472c3cf54ab28a64eae1e7186a5dd69b7f3",
2584
  "size": 2289
2585
  },
2586
  "research/reports/reviews/adapter-verification.md": {
 
2808
  "sha256": "ffdb6a19f4a109ea003c98e7b5acb598e8012765e043e06996e03019d911ca79",
2809
  "size": 9277
2810
  },
2811
+ "research/results/abstracts-pilot-s00-trace-r01-fp64/flatness.json": {
2812
+ "git_blob": "d88a6f0305f1f4edd48a85f1d07df5d3ce4804b1",
2813
+ "sha256": "693e9ee77ef25f179fc33b85a81572f341534e144d8878aaf38d170f2c31c3a3",
2814
+ "size": 5841
2815
+ },
2816
  "research/results/abstracts-pilot-s00-trace-r01-fp64/samples.jsonl": {
2817
  "git_blob": "95c97dc58c2266db68a67647645e41245266a7b4",
2818
  "sha256": "d2a99c73d4392f3b5ef547a36975c53afea90da977ad5983d18b82cb5e21376f",
 
4119
  "size": 9767
4120
  },
4121
  "research/src/thirdloss/checkpoint_flatness.py": {
4122
+ "git_blob": "45909d2b16a195b46bacdbbcce2b4184d63ae64f",
4123
+ "sha256": "e5a003bf9692737d029c957e8e88a2a4511d1b70ed558c5e274476bd62a377fe",
4124
+ "size": 9070
4125
  },
4126
  "research/src/thirdloss/cli.py": {
4127
+ "git_blob": "56d46d00cce2a4a8cb0a1c89b07a16eaf0c4c315",
4128
+ "sha256": "9ddb4e2802eb58be24ad0a67e6ce056686d06496a8c59c10ef1cd8bd6973fdff",
4129
+ "size": 7982
4130
  },
4131
  "research/src/thirdloss/data.py": {
4132
  "git_blob": "9b06438a0bce64f8d491cd65156ebe8aa04e8916",
 
4139
  "size": 4522
4140
  },
4141
  "research/src/thirdloss/flatness_stats.py": {
4142
+ "git_blob": "8b700fff44c830264e264f301628720035862ba8",
4143
+ "sha256": "d746679db10fc8d8cb1e2f75b25a7d6334a000992195fd95358225a89791f4d2",
4144
+ "size": 2394
4145
  },
4146
  "research/src/thirdloss/flatness_tables.py": {
4147
+ "git_blob": "8631c395f6017144cc2e3db425db4999863c86b2",
4148
+ "sha256": "63f96bf61c8f810a20bf6ef68770100d233a796c02b2deb85d1fc99a2c495550",
4149
+ "size": 10613
4150
  },
4151
  "research/src/thirdloss/hub_archive.py": {
4152
  "git_blob": "9a24c6c6f0f3f6e06fa43c775b47a5a03c1d12f6",
 
4204
  "size": 11879
4205
  },
4206
  "research/src/thirdloss/readme_comparisons.py": {
4207
+ "git_blob": "c66dbe09e167a56393697607b5c824fc000aca92",
4208
+ "sha256": "5f8f64b22498e9a18160535130c1bdfca6b2c16a8bc9d2f7cab9831c408bca88",
4209
+ "size": 23696
4210
  },
4211
  "research/src/thirdloss/records.py": {
4212
  "git_blob": "a800de00d42944f13a89d8d2f91ce9b2103bbd45",
 
4224
  "size": 10129
4225
  },
4226
  "research/src/thirdloss/report_paper.py": {
4227
+ "git_blob": "6514a743800254bc6a2fedfe61cb232d786a5d6d",
4228
+ "sha256": "02050e7488a0fa2a9b8df86f8958629dad4cc3d906c1e8f070fb0e617d2aef6b",
4229
+ "size": 36366
4230
  },
4231
  "research/src/thirdloss/report_records.py": {
4232
+ "git_blob": "63fb6adff6bb01d15fcb12841f3e299c5364ff4a",
4233
+ "sha256": "dec67007c3338c62f6479c9bd6de50a7db9688261bdfaab702664608381bda53",
4234
+ "size": 16009
4235
  },
4236
  "research/src/thirdloss/reporting.py": {
4237
  "git_blob": "206d59a27fae7713677392a8e9d32769a7437239",
4238
  "sha256": "68ff0fca6554c91c0a77318e2ada25ea821a725f4b683775a89bf787101586bc",
4239
  "size": 21553
4240
  },
4241
+ "research/src/thirdloss/score_flatness.py": {
4242
+ "git_blob": "bc0df88c71f2ebef66bd546be84bb353aa25feee",
4243
+ "sha256": "0fb9fde75fd83f6e00725dad04773c36747846ecc92ba095c571f27d5d593639",
4244
+ "size": 2205
4245
+ },
4246
  "research/src/thirdloss/study.py": {
4247
  "git_blob": "d3ef0cf8d4b40e1ce0f6996eedb8ee24415a86ab",
4248
  "sha256": "d5b1782a1a2ece89c5c0f11256a235dd3d004c2b536b4a4c2366111e6e981e19",
 
4259
  "size": 4135
4260
  },
4261
  "research/src/thirdloss/width.py": {
4262
+ "git_blob": "65eee35435beb909c7a217dd92ea68db3cac4fca",
4263
+ "sha256": "f71e372f910606956a420983515b1021e8275d2b94b9c9a1e41501265deb406f",
4264
+ "size": 2817
4265
  },
4266
  "research/src/thirdloss/windows.py": {
4267
  "git_blob": "2000a312e8326b97f88acead4b5c53e6d26eeab2",
 
4284
  "size": 16607
4285
  },
4286
  "research/tests/test_flatness.py": {
4287
+ "git_blob": "3ab0346c1456439a596832372403916b5a408b6b",
4288
+ "sha256": "c5b21b092707e5ab3ae4db48833ff69fe870fb74aabaf6d3c4c7f1e83a73c29c",
4289
+ "size": 5512
4290
  },
4291
  "research/tests/test_hub_archive.py": {
4292
  "git_blob": "4c8dc24e6eb5f0aa7fc5e63be56ba0efa3ad4ec4",
 
4368
  "type": "dataset"
4369
  }
4370
  },
4371
+ "verified_at": "2026-11-25T16:49:39+00:00"
4372
  }
research/README.md CHANGED
@@ -123,6 +123,72 @@ How far can the weights move before next-token loss rises by 0.1 nats on eight f
123
  | Cross-seed replay | 22 | 15.403 | 13.218 | One seed | 12.987–13.496 | 0/32 |
124
  | Always-on hybrid | 21, 22, 23 | 15.256 | 13.229 | 13.060–13.334 | 13.085–13.390 | 0/96 |
125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  **TinyStories pretraining · development pilots · seeds 0 · 2,097,152 training targets**
127
 
128
  | Flatness statistic | AdamW | Hessian trace | Third order |
@@ -175,7 +241,7 @@ The remaining controls are paired independently. Each row uses only seeds that f
175
 
176
  **Pythia-410M adapters** · Secondary pilot comparisons are pending.
177
 
178
- **Untrained references · zero training targets**
179
 
180
  | Stage | Initial NLL<br>↓ Lower is better | Unigram NLL<br>↓ Lower is better | Initial accuracy<br>↑ Higher is better | Unigram accuracy<br>↑ Higher is better |
181
  | --- | --- | --- | --- | --- |
 
123
  | Cross-seed replay | 22 | 15.403 | 13.218 | One seed | 12.987–13.496 | 0/32 |
124
  | Always-on hybrid | 21, 22, 23 | 15.256 | 13.229 | 13.060–13.334 | 13.085–13.390 | 0/96 |
125
 
126
+ #### All variants and baselines
127
+
128
+ Each row uses the same fixed training windows and probe directions within its stage. Parentheses give measured / planned seeds for that cell. Targets count next-token examples used for optimizer updates in this study. The unigram uses counts from the full training split, and initial Pythia retains its pretrained backbone. Compare rows with matching targets and seeds. Larger **weight width** means greater tolerance to moving the model’s trainable parameters. Larger **common score width** means that all token scores can tolerate a larger shared bias before NLL rises by 0.1 nats, measured in RMS logit units. The unigram has zero trainable model weights and shares the score test with every neural predictor. Both widths have an unknown relationship to better held-out prediction. [All-model measurement design](reports/amendments/all-model-flatness.md)
129
+
130
+ **TinyStories · all model weights**
131
+
132
+ | Variant | Training targets | Seed cohort | Weight width<br>↑ Wider is flatter | RMS weight curvature<br>↓ Less local bending | Common score width<br>↑ More score tolerance |
133
+ | --- | --- | --- | --- | --- | --- |
134
+ | Initial checkpoint | 0 | 0 | Pending | Pending | Pending |
135
+ | Unigram | 0 | 0 | N/A · no weights | N/A · no weights | Pending |
136
+ | Ordinary AdamW | 2,097,152 | 0 | 15.579 (1/1) | 0.45329 (1/1) | Pending |
137
+ | Hessian trace (1%) | 2,097,152 | 0 | 15.686 (1/1) | 0.44772 (1/1) | Pending |
138
+ | Third derivative (1%) | 2,097,152 | 0 | 15.640 (1/1) | 0.44739 (1/1) | Pending |
139
+ | Squared Hessian norm (3%) | 2,097,152 | 0 | Pending | Pending | Pending |
140
+ | Randomized gradient signs (1%) | 2,097,152 | 0 | Pending | Pending | Pending |
141
+ | Trace + third derivative (1%) | 2,097,152 | 0 | Pending | Pending | Pending |
142
+ | Ordinary AdamW · confirmation | 16,777,216 | 1–8 | Pending | Pending | Pending |
143
+ | Hessian trace · confirmation | 16,777,216 | 1–8 | Pending | Pending | Pending |
144
+ | Third derivative · confirmation | 16,777,216 | 1–8 | Pending | Pending | Pending |
145
+ | Shared trace checkpoint | 8,388,608 | 21–28 | 15.143 (3/8) | Pending | Pending |
146
+ | Curvature-dependent hybrid · hybrid study | 16,777,216 | 21–28 | 13.157 (3/8) | Pending | Pending |
147
+ | Fixed late hybrid · hybrid study | 16,777,216 | 21–28 | 13.215 (3/8) | Pending | Pending |
148
+ | Hessian trace · hybrid study | 16,777,216 | 21–28 | 13.154 (3/8) | Pending | Pending |
149
+ | Stronger trace · hybrid study | 16,777,216 | 21–28 | 13.175 (3/8) | Pending | Pending |
150
+ | Cross-seed replay · hybrid study | 16,777,216 | 21–28 | 13.218 (1/8) | Pending | Pending |
151
+ | Always-on hybrid · hybrid study | 16,777,216 | 21–28 | 13.229 (3/8) | Pending | Pending |
152
+
153
+ <details><summary>TinyStories · all model weights · other pilot strengths and precision diagnostics</summary>
154
+
155
+ | Variant | Training targets | Seed cohort | Weight width<br>↑ Wider is flatter | RMS weight curvature<br>↓ Less local bending | Common score width<br>↑ More score tolerance |
156
+ | --- | --- | --- | --- | --- | --- |
157
+ | Hessian trace (3%) | 2,097,152 | 0 | Pending | Pending | Pending |
158
+ | Hessian trace (10%) | 2,097,152 | 0 | Pending | Pending | Pending |
159
+ | Third derivative (3%) | 2,097,152 | 0 | Pending | Pending | Pending |
160
+ | Third derivative (10%) | 2,097,152 | 0 | Pending | Pending | Pending |
161
+
162
+ </details>
163
+
164
+ **Pythia-410M · adapter weights**
165
+
166
+ | Variant | Training targets | Seed cohort | Weight width<br>↑ Wider is flatter | RMS weight curvature<br>↓ Less local bending | Common score width<br>↑ More score tolerance |
167
+ | --- | --- | --- | --- | --- | --- |
168
+ | Initial checkpoint | 0 | 0 | Pending | Pending | Pending |
169
+ | Unigram | 0 | 0 | N/A · no weights | N/A · no weights | Pending |
170
+ | Ordinary AdamW | 65,536 | 0 | 19.784 (1/1) | 1.2868 (1/1) | Pending |
171
+ | Hessian trace (1%) | 65,536 | 0 | 19.751 (1/1) | 1.1818 (1/1) | Pending |
172
+ | Third derivative (1%) | 65,536 | 0 | Pending | Pending | Pending |
173
+ | Squared Hessian norm (3%) | 65,536 | 0 | Pending | Pending | Pending |
174
+ | Randomized gradient signs (1%) | 65,536 | 0 | Pending | Pending | Pending |
175
+ | Trace + third derivative (1%) | 65,536 | 0 | Pending | Pending | Pending |
176
+ | Ordinary AdamW · confirmation | 524,288 | 1–8 | Pending | Pending | Pending |
177
+ | Hessian trace · confirmation | 524,288 | 1–8 | Pending | Pending | Pending |
178
+ | Third derivative · confirmation | 524,288 | 1–8 | Pending | Pending | Pending |
179
+
180
+ <details><summary>Pythia-410M · adapter weights · other pilot strengths and precision diagnostics</summary>
181
+
182
+ | Variant | Training targets | Seed cohort | Weight width<br>↑ Wider is flatter | RMS weight curvature<br>↓ Less local bending | Common score width<br>↑ More score tolerance |
183
+ | --- | --- | --- | --- | --- | --- |
184
+ | Hessian trace (3%) | 65,536 | 0 | Pending | Pending | Pending |
185
+ | Hessian trace (10%) | 65,536 | 0 | Pending | Pending | Pending |
186
+ | Third derivative (3%) | 65,536 | 0 | Pending | Pending | Pending |
187
+ | Third derivative (10%) | 65,536 | 0 | Pending | Pending | Pending |
188
+ | Third derivative (3%) · excluded precision diagnostic | 65,536 | 0 | Pending | Pending | Pending |
189
+
190
+ </details>
191
+
192
  **TinyStories pretraining · development pilots · seeds 0 · 2,097,152 training targets**
193
 
194
  | Flatness statistic | AdamW | Hessian trace | Third order |
 
241
 
242
  **Pythia-410M adapters** · Secondary pilot comparisons are pending.
243
 
244
+ **Zero-update references** · The unigram uses training-split frequencies. Initial Pythia uses its pretrained weights.
245
 
246
  | Stage | Initial NLL<br>↓ Lower is better | Unigram NLL<br>↓ Lower is better | Initial accuracy<br>↑ Higher is better | Unigram accuracy<br>↑ Higher is better |
247
  | --- | --- | --- | --- | --- |
research/docs/explorer.js CHANGED
@@ -18,6 +18,8 @@ const metrics = {
18
  width: ["Directional width", "Euclidean weight distance · wider is flatter"], width_probe_nll: ["Width-probe loss", "nats / target token"],
19
  checkpoint_rms: ["Checkpoint RMS curvature", "RMS curvature · lower means less bending"],
20
  checkpoint_signed_trace: ["Checkpoint signed trace / parameter", "mean signed curvature · no preferred direction"],
 
 
21
  curvature_rms: ["Rolling RMS curvature", "RMS Hessian eigenvalue estimate"],
22
  third_lambda: ["Third-derivative coefficient", "coefficient"], trace_lambda: ["Trace coefficient", "coefficient"],
23
  gradient_norm: ["Unclipped gradient norm", "Euclidean gradient norm"],
 
18
  width: ["Directional width", "Euclidean weight distance · wider is flatter"], width_probe_nll: ["Width-probe loss", "nats / target token"],
19
  checkpoint_rms: ["Checkpoint RMS curvature", "RMS curvature · lower means less bending"],
20
  checkpoint_signed_trace: ["Checkpoint signed trace / parameter", "mean signed curvature · no preferred direction"],
21
+ score_width: ["Common score width", "RMS logit distance · wider tolerates larger score changes"],
22
+ score_curvature: ["Common score curvature", "mean local bending under shared logit biases"],
23
  curvature_rms: ["Rolling RMS curvature", "RMS Hessian eigenvalue estimate"],
24
  third_lambda: ["Third-derivative coefficient", "coefficient"], trace_lambda: ["Trace coefficient", "coefficient"],
25
  gradient_norm: ["Unclipped gradient norm", "Euclidean gradient norm"],
research/docs/hub/archive.md CHANGED
@@ -80,6 +80,72 @@ How far can the weights move before next-token loss rises by 0.1 nats on eight f
80
  | Cross-seed replay | 22 | 15.403 | 13.218 | One seed | 12.987–13.496 | 0/32 |
81
  | Always-on hybrid | 21, 22, 23 | 15.256 | 13.229 | 13.060–13.334 | 13.085–13.390 | 0/96 |
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  **TinyStories pretraining · development pilots · seeds 0 · 2,097,152 training targets**
84
 
85
  | Flatness statistic | AdamW | Hessian trace | Third order |
@@ -132,7 +198,7 @@ The remaining controls are paired independently. Each row uses only seeds that f
132
 
133
  **Pythia-410M adapters** · Secondary pilot comparisons are pending.
134
 
135
- **Untrained references · zero training targets**
136
 
137
  | Stage | Initial NLL<br>↓ Lower is better | Unigram NLL<br>↓ Lower is better | Initial accuracy<br>↑ Higher is better | Unigram accuracy<br>↑ Higher is better |
138
  | --- | --- | --- | --- | --- |
 
80
  | Cross-seed replay | 22 | 15.403 | 13.218 | One seed | 12.987–13.496 | 0/32 |
81
  | Always-on hybrid | 21, 22, 23 | 15.256 | 13.229 | 13.060–13.334 | 13.085–13.390 | 0/96 |
82
 
83
+ #### All variants and baselines
84
+
85
+ Each row uses the same fixed training windows and probe directions within its stage. Parentheses give measured / planned seeds for that cell. Targets count next-token examples used for optimizer updates in this study. The unigram uses counts from the full training split, and initial Pythia retains its pretrained backbone. Compare rows with matching targets and seeds. Larger **weight width** means greater tolerance to moving the model’s trainable parameters. Larger **common score width** means that all token scores can tolerate a larger shared bias before NLL rises by 0.1 nats, measured in RMS logit units. The unigram has zero trainable model weights and shares the score test with every neural predictor. Both widths have an unknown relationship to better held-out prediction. [All-model measurement design](https://huggingface.co/BurnyCoder/thirdloss-study/blob/main/research/reports/amendments/all-model-flatness.md)
86
+
87
+ **TinyStories · all model weights**
88
+
89
+ | Variant | Training targets | Seed cohort | Weight width<br>↑ Wider is flatter | RMS weight curvature<br>↓ Less local bending | Common score width<br>↑ More score tolerance |
90
+ | --- | --- | --- | --- | --- | --- |
91
+ | Initial checkpoint | 0 | 0 | Pending | Pending | Pending |
92
+ | Unigram | 0 | 0 | N/A · no weights | N/A · no weights | Pending |
93
+ | Ordinary AdamW | 2,097,152 | 0 | 15.579 (1/1) | 0.45329 (1/1) | Pending |
94
+ | Hessian trace (1%) | 2,097,152 | 0 | 15.686 (1/1) | 0.44772 (1/1) | Pending |
95
+ | Third derivative (1%) | 2,097,152 | 0 | 15.640 (1/1) | 0.44739 (1/1) | Pending |
96
+ | Squared Hessian norm (3%) | 2,097,152 | 0 | Pending | Pending | Pending |
97
+ | Randomized gradient signs (1%) | 2,097,152 | 0 | Pending | Pending | Pending |
98
+ | Trace + third derivative (1%) | 2,097,152 | 0 | Pending | Pending | Pending |
99
+ | Ordinary AdamW · confirmation | 16,777,216 | 1–8 | Pending | Pending | Pending |
100
+ | Hessian trace · confirmation | 16,777,216 | 1–8 | Pending | Pending | Pending |
101
+ | Third derivative · confirmation | 16,777,216 | 1–8 | Pending | Pending | Pending |
102
+ | Shared trace checkpoint | 8,388,608 | 21–28 | 15.143 (3/8) | Pending | Pending |
103
+ | Curvature-dependent hybrid · hybrid study | 16,777,216 | 21–28 | 13.157 (3/8) | Pending | Pending |
104
+ | Fixed late hybrid · hybrid study | 16,777,216 | 21–28 | 13.215 (3/8) | Pending | Pending |
105
+ | Hessian trace · hybrid study | 16,777,216 | 21–28 | 13.154 (3/8) | Pending | Pending |
106
+ | Stronger trace · hybrid study | 16,777,216 | 21–28 | 13.175 (3/8) | Pending | Pending |
107
+ | Cross-seed replay · hybrid study | 16,777,216 | 21–28 | 13.218 (1/8) | Pending | Pending |
108
+ | Always-on hybrid · hybrid study | 16,777,216 | 21–28 | 13.229 (3/8) | Pending | Pending |
109
+
110
+ <details><summary>TinyStories · all model weights · other pilot strengths and precision diagnostics</summary>
111
+
112
+ | Variant | Training targets | Seed cohort | Weight width<br>↑ Wider is flatter | RMS weight curvature<br>↓ Less local bending | Common score width<br>↑ More score tolerance |
113
+ | --- | --- | --- | --- | --- | --- |
114
+ | Hessian trace (3%) | 2,097,152 | 0 | Pending | Pending | Pending |
115
+ | Hessian trace (10%) | 2,097,152 | 0 | Pending | Pending | Pending |
116
+ | Third derivative (3%) | 2,097,152 | 0 | Pending | Pending | Pending |
117
+ | Third derivative (10%) | 2,097,152 | 0 | Pending | Pending | Pending |
118
+
119
+ </details>
120
+
121
+ **Pythia-410M · adapter weights**
122
+
123
+ | Variant | Training targets | Seed cohort | Weight width<br>↑ Wider is flatter | RMS weight curvature<br>↓ Less local bending | Common score width<br>↑ More score tolerance |
124
+ | --- | --- | --- | --- | --- | --- |
125
+ | Initial checkpoint | 0 | 0 | Pending | Pending | Pending |
126
+ | Unigram | 0 | 0 | N/A · no weights | N/A · no weights | Pending |
127
+ | Ordinary AdamW | 65,536 | 0 | 19.784 (1/1) | 1.2868 (1/1) | Pending |
128
+ | Hessian trace (1%) | 65,536 | 0 | 19.751 (1/1) | 1.1818 (1/1) | Pending |
129
+ | Third derivative (1%) | 65,536 | 0 | Pending | Pending | Pending |
130
+ | Squared Hessian norm (3%) | 65,536 | 0 | Pending | Pending | Pending |
131
+ | Randomized gradient signs (1%) | 65,536 | 0 | Pending | Pending | Pending |
132
+ | Trace + third derivative (1%) | 65,536 | 0 | Pending | Pending | Pending |
133
+ | Ordinary AdamW · confirmation | 524,288 | 1–8 | Pending | Pending | Pending |
134
+ | Hessian trace · confirmation | 524,288 | 1–8 | Pending | Pending | Pending |
135
+ | Third derivative · confirmation | 524,288 | 1–8 | Pending | Pending | Pending |
136
+
137
+ <details><summary>Pythia-410M · adapter weights · other pilot strengths and precision diagnostics</summary>
138
+
139
+ | Variant | Training targets | Seed cohort | Weight width<br>↑ Wider is flatter | RMS weight curvature<br>↓ Less local bending | Common score width<br>↑ More score tolerance |
140
+ | --- | --- | --- | --- | --- | --- |
141
+ | Hessian trace (3%) | 65,536 | 0 | Pending | Pending | Pending |
142
+ | Hessian trace (10%) | 65,536 | 0 | Pending | Pending | Pending |
143
+ | Third derivative (3%) | 65,536 | 0 | Pending | Pending | Pending |
144
+ | Third derivative (10%) | 65,536 | 0 | Pending | Pending | Pending |
145
+ | Third derivative (3%) · excluded precision diagnostic | 65,536 | 0 | Pending | Pending | Pending |
146
+
147
+ </details>
148
+
149
  **TinyStories pretraining · development pilots · seeds 0 · 2,097,152 training targets**
150
 
151
  | Flatness statistic | AdamW | Hessian trace | Third order |
 
198
 
199
  **Pythia-410M adapters** · Secondary pilot comparisons are pending.
200
 
201
+ **Zero-update references** · The unigram uses training-split frequencies. Initial Pythia uses its pretrained weights.
202
 
203
  | Stage | Initial NLL<br>↓ Lower is better | Unigram NLL<br>↓ Lower is better | Initial accuracy<br>↑ Higher is better | Unigram accuracy<br>↑ Higher is better |
204
  | --- | --- | --- | --- | --- |
research/docs/index.html CHANGED
@@ -52,6 +52,8 @@
52
  <option value="width">Directional width</option><option value="width_probe_nll">Width-probe training NLL</option>
53
  <option value="checkpoint_rms">Checkpoint RMS curvature (lower is flatter locally)</option>
54
  <option value="checkpoint_signed_trace">Checkpoint signed trace per parameter</option>
 
 
55
  <option value="curvature_rms">Rolling RMS curvature</option><option value="third_lambda">Third-derivative coefficient</option>
56
  <option value="trace_lambda">Trace coefficient</option><option value="gradient_norm">Unclipped gradient norm</option>
57
  </select></label>
 
52
  <option value="width">Directional width</option><option value="width_probe_nll">Width-probe training NLL</option>
53
  <option value="checkpoint_rms">Checkpoint RMS curvature (lower is flatter locally)</option>
54
  <option value="checkpoint_signed_trace">Checkpoint signed trace per parameter</option>
55
+ <option value="score_width">Common score width (all model types)</option>
56
+ <option value="score_curvature">Common score curvature (all model types)</option>
57
  <option value="curvature_rms">Rolling RMS curvature</option><option value="third_lambda">Third-derivative coefficient</option>
58
  <option value="trace_lambda">Trace coefficient</option><option value="gradient_norm">Unclipped gradient norm</option>
59
  </select></label>
research/docs/runbook.md CHANGED
@@ -57,6 +57,6 @@ With `study --publish`, the local trainer sends active loss, accuracy, probe est
57
 
58
  ## Checkpoint flatness
59
 
60
- Run `uv run --locked thirdloss flatness --stage both --phase pilot --publish` to measure the selected models and fitted pilot controls. Use `--phase confirm` for the eight-seed checkpoints. Each call checks the training stream and exported weights, resumes from saved measurements and publishes each newly measured checkpoint. Schedule this command between timed training runs on the same GPU. Run `uv run --locked thirdloss report` to rebuild the statistics from the saved measurements. [Design](../reports/amendments/checkpoint-flatness.md) · [Results and raw probes](../reports/flatness.md)
61
 
62
  For a complete sequential run, use `uv run --locked thirdloss study --with-hybrid --with-flatness --publish`. The final flatness pass picks up any outstanding primary checkpoints. The explorer’s measurement menu includes directional width, checkpoint RMS curvature and signed trace per parameter. [Live explorer](https://huggingface.co/spaces/BurnyCoder/thirdloss-explorer)
 
57
 
58
  ## Checkpoint flatness
59
 
60
+ Run `uv run --locked thirdloss flatness --stage both --phase pilot --publish` for all pilot strengths and zero-update controls. Use `--phase hybrid` for the shared trunks and six hybrid arms, `--phase confirm` for the eight-seed primary runs, or `--phase all` for the complete research ledger. `--run-id RUN` restricts the command to one checkpoint. Every predictor receives the common logit test, including the empirical unigram. Neural predictors also receive the weight-space width and Hessian tests. Each call checks the training stream and exported weights and resumes from its saved probe files. Run it between timed training runs on a shared GPU. Run `uv run --locked thirdloss report` to rebuild the comparisons. [Weight probes](../reports/amendments/checkpoint-flatness.md) · [All-model comparison](../reports/amendments/all-model-flatness.md) · [Results and raw probes](../reports/flatness.md)
61
 
62
  For a complete sequential run, use `uv run --locked thirdloss study --with-hybrid --with-flatness --publish`. The final flatness pass picks up any outstanding primary checkpoints. The explorer’s measurement menu includes directional width, checkpoint RMS curvature and signed trace per parameter. [Live explorer](https://huggingface.co/spaces/BurnyCoder/thirdloss-explorer)
research/docs/study.json CHANGED
The diff for this file is too large to render. See raw diff
 
research/reports/flatness.md CHANGED
@@ -15,11 +15,78 @@ Widths are measured in each model’s trainable coordinates. A larger width is f
15
 
16
  The seed range and directional spread describe variability. The rays at the limit give measurement coverage. Compare matching seeds for differences between arms. [Every crossing and paired comparison](hybrid/results.md)
17
 
18
- ## Secondary checkpoint measurements
19
-
20
- | Stage | Horizon | Seed | Arm | Width ↑ | Middle 50% of directions | Rays at limit / tested | RMS curvature ↓ | Signed trace / parameter | Evidence |
21
- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
22
- | abstracts | pilot | 0 | Ordinary AdamW | 19.784 | 19.185–20.320 | 0/32 | 1.28684 | +0.00312322 | [All probes](../results/abstracts-pilot-s00-ce-r00/flatness.json) |
23
- | stories | pilot | 0 | Ordinary AdamW | 15.579 | 15.297–16.037 | 0/32 | 0.453288 | +0.0036281 | [All probes](../results/stories-pilot-s00-ce-r00/flatness.json) |
24
- | stories | pilot | 0 | Third derivative | 15.640 | 15.382–16.118 | 0/32 | 0.447394 | +0.00357761 | [All probes](../results/stories-pilot-s00-third-r01/flatness.json) |
25
- | stories | pilot | 0 | Hessian trace | 15.686 | 15.431–16.102 | 0/32 | 0.447721 | +0.00356145 | [All probes](../results/stories-pilot-s00-trace-r01/flatness.json) |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  The seed range and directional spread describe variability. The rays at the limit give measurement coverage. Compare matching seeds for differences between arms. [Every crossing and paired comparison](hybrid/results.md)
17
 
18
+ ## Every variant and baseline
19
+
20
+ Parentheses give measured / planned seeds. A unigram has only the common score-space measurement. [Shared score perturbations](amendments/all-model-flatness.md)
21
+
22
+ **TinyStories · all model weights**
23
+
24
+ | Variant | Training targets | Seed cohort | Weight width<br>↑ Wider is flatter | RMS weight curvature<br>↓ Less local bending | Common score width<br>↑ More score tolerance |
25
+ | --- | --- | --- | --- | --- | --- |
26
+ | Initial checkpoint | 0 | 0 | Pending | Pending | Pending |
27
+ | Unigram | 0 | 0 | N/A · no weights | N/A · no weights | Pending |
28
+ | Ordinary AdamW | 2,097,152 | 0 | 15.579 (1/1) | 0.45329 (1/1) | Pending |
29
+ | Hessian trace (1%) | 2,097,152 | 0 | 15.686 (1/1) | 0.44772 (1/1) | Pending |
30
+ | Third derivative (1%) | 2,097,152 | 0 | 15.640 (1/1) | 0.44739 (1/1) | Pending |
31
+ | Squared Hessian norm (3%) | 2,097,152 | 0 | Pending | Pending | Pending |
32
+ | Randomized gradient signs (1%) | 2,097,152 | 0 | Pending | Pending | Pending |
33
+ | Trace + third derivative (1%) | 2,097,152 | 0 | Pending | Pending | Pending |
34
+ | Ordinary AdamW · confirmation | 16,777,216 | 1–8 | Pending | Pending | Pending |
35
+ | Hessian trace · confirmation | 16,777,216 | 1–8 | Pending | Pending | Pending |
36
+ | Third derivative · confirmation | 16,777,216 | 1–8 | Pending | Pending | Pending |
37
+ | Shared trace checkpoint | 8,388,608 | 21–28 | 15.143 (3/8) | Pending | Pending |
38
+ | Curvature-dependent hybrid · hybrid study | 16,777,216 | 21–28 | 13.157 (3/8) | Pending | Pending |
39
+ | Fixed late hybrid · hybrid study | 16,777,216 | 21–28 | 13.215 (3/8) | Pending | Pending |
40
+ | Hessian trace · hybrid study | 16,777,216 | 21–28 | 13.154 (3/8) | Pending | Pending |
41
+ | Stronger trace · hybrid study | 16,777,216 | 21–28 | 13.175 (3/8) | Pending | Pending |
42
+ | Cross-seed replay · hybrid study | 16,777,216 | 21–28 | 13.218 (1/8) | Pending | Pending |
43
+ | Always-on hybrid · hybrid study | 16,777,216 | 21–28 | 13.229 (3/8) | Pending | Pending |
44
+
45
+ <details><summary>TinyStories · all model weights · other pilot strengths and precision diagnostics</summary>
46
+
47
+ | Variant | Training targets | Seed cohort | Weight width<br>↑ Wider is flatter | RMS weight curvature<br>↓ Less local bending | Common score width<br>↑ More score tolerance |
48
+ | --- | --- | --- | --- | --- | --- |
49
+ | Hessian trace (3%) | 2,097,152 | 0 | Pending | Pending | Pending |
50
+ | Hessian trace (10%) | 2,097,152 | 0 | Pending | Pending | Pending |
51
+ | Third derivative (3%) | 2,097,152 | 0 | Pending | Pending | Pending |
52
+ | Third derivative (10%) | 2,097,152 | 0 | Pending | Pending | Pending |
53
+
54
+ </details>
55
+
56
+ **Pythia-410M · adapter weights**
57
+
58
+ | Variant | Training targets | Seed cohort | Weight width<br>↑ Wider is flatter | RMS weight curvature<br>↓ Less local bending | Common score width<br>↑ More score tolerance |
59
+ | --- | --- | --- | --- | --- | --- |
60
+ | Initial checkpoint | 0 | 0 | Pending | Pending | Pending |
61
+ | Unigram | 0 | 0 | N/A · no weights | N/A · no weights | Pending |
62
+ | Ordinary AdamW | 65,536 | 0 | 19.784 (1/1) | 1.2868 (1/1) | Pending |
63
+ | Hessian trace (1%) | 65,536 | 0 | 19.751 (1/1) | 1.1818 (1/1) | Pending |
64
+ | Third derivative (1%) | 65,536 | 0 | Pending | Pending | Pending |
65
+ | Squared Hessian norm (3%) | 65,536 | 0 | Pending | Pending | Pending |
66
+ | Randomized gradient signs (1%) | 65,536 | 0 | Pending | Pending | Pending |
67
+ | Trace + third derivative (1%) | 65,536 | 0 | Pending | Pending | Pending |
68
+ | Ordinary AdamW · confirmation | 524,288 | 1–8 | Pending | Pending | Pending |
69
+ | Hessian trace · confirmation | 524,288 | 1–8 | Pending | Pending | Pending |
70
+ | Third derivative · confirmation | 524,288 | 1–8 | Pending | Pending | Pending |
71
+
72
+ <details><summary>Pythia-410M · adapter weights · other pilot strengths and precision diagnostics</summary>
73
+
74
+ | Variant | Training targets | Seed cohort | Weight width<br>↑ Wider is flatter | RMS weight curvature<br>↓ Less local bending | Common score width<br>↑ More score tolerance |
75
+ | --- | --- | --- | --- | --- | --- |
76
+ | Hessian trace (3%) | 65,536 | 0 | Pending | Pending | Pending |
77
+ | Hessian trace (10%) | 65,536 | 0 | Pending | Pending | Pending |
78
+ | Third derivative (3%) | 65,536 | 0 | Pending | Pending | Pending |
79
+ | Third derivative (10%) | 65,536 | 0 | Pending | Pending | Pending |
80
+ | Third derivative (3%) · excluded precision diagnostic | 65,536 | 0 | Pending | Pending | Pending |
81
+
82
+ </details>
83
+
84
+ ## Per-run checkpoint measurements
85
+
86
+ | Stage | Horizon | Seed | Arm | Strength | Weight width ↑ | Weight middle 50% | Weight rays at limit | RMS curvature ↓ | Signed trace / parameter | Score width ↑ | Score middle 50% | Score rays at limit | Mean score curvature | Evidence |
87
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
88
+ | abstracts | pilot | 0 | Ordinary AdamW | 0% | 19.784 | 19.185–20.320 | 0/32 | 1.28684 | +0.00312322 | Pending | Pending | Pending | Pending | [Weight probes](../results/abstracts-pilot-s00-ce-r00/flatness.json) |
89
+ | abstracts | pilot | 0 | Hessian trace | 1% | 19.751 | 19.179–20.260 | 0/32 | 1.18181 | +0.00404879 | Pending | Pending | Pending | Pending | [Weight probes](../results/abstracts-pilot-s00-trace-r01-fp64/flatness.json) |
90
+ | stories | pilot | 0 | Ordinary AdamW | 0% | 15.579 | 15.297–16.037 | 0/32 | 0.453288 | +0.0036281 | Pending | Pending | Pending | Pending | [Weight probes](../results/stories-pilot-s00-ce-r00/flatness.json) |
91
+ | stories | pilot | 0 | Third derivative | 1% | 15.640 | 15.382–16.118 | 0/32 | 0.447394 | +0.00357761 | Pending | Pending | Pending | Pending | [Weight probes](../results/stories-pilot-s00-third-r01/flatness.json) |
92
+ | stories | pilot | 0 | Hessian trace | 1% | 15.686 | 15.431–16.102 | 0/32 | 0.447721 | +0.00356145 | Pending | Pending | Pending | Pending | [Weight probes](../results/stories-pilot-s00-trace-r01/flatness.json) |
research/reports/paper.pdf CHANGED
Binary files a/research/reports/paper.pdf and b/research/reports/paper.pdf differ
 
research/reports/planned-runs.md CHANGED
@@ -23,3 +23,5 @@ The six TinyStories arms share eight paired seeds. Five branch from a common tra
23
  ## Secondary flatness measurements
24
 
25
  Measure the saved AdamW, Hessian-trace and third-order checkpoints at the selected pilot horizon and the full confirmatory horizon in each stage. Include the three fitted pilot controls. Each evaluation records training-window perturbation widths and Hessian curvature in that stage’s trainable coordinates. This analysis was specified after early development results. [Measurement design](amendments/checkpoint-flatness.md) · [Measured statistics](flatness.md)
 
 
 
23
  ## Secondary flatness measurements
24
 
25
  Measure the saved AdamW, Hessian-trace and third-order checkpoints at the selected pilot horizon and the full confirmatory horizon in each stage. Include the three fitted pilot controls. Each evaluation records training-window perturbation widths and Hessian curvature in that stage’s trainable coordinates. This analysis was specified after early development results. [Measurement design](amendments/checkpoint-flatness.md) · [Measured statistics](flatness.md)
26
+
27
+ The coverage extension also measures every other pilot strength, all hybrid arms and shared trunks, the two initial predictors and both unigram references. A common output-score perturbation is defined for all of them. The numerical diagnostic retains its separate label. [All-model flatness protocol](amendments/all-model-flatness.md)
research/reports/progress.md CHANGED
@@ -1,6 +1,6 @@
1
  # Study progress
2
 
3
- Updated 2026-11-25T16:44:12+00:00.
4
 
5
  21 training/control records and 0 final evaluations are complete. This is 17.5% of 120 planned model milestones.
6
 
 
1
  # Study progress
2
 
3
+ Updated 2026-11-25T16:49:28+00:00.
4
 
5
  21 training/control records and 0 final evaluations are complete. This is 17.5% of 120 planned model milestones.
6
 
research/results/abstracts-pilot-s00-trace-r01-fp64/flatness.json ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "protocol": "checkpoint-flatness-v1",
3
+ "run": "abstracts-pilot-s00-trace-r01-fp64",
4
+ "checkpoint_file_sha256": "0ee7f88f1adea83b25390e405b4f4ff4f3ad0992068f85dd4c39d4c1c582c44e",
5
+ "data_manifest_sha256": "0638bd23a7d1dc3ecb9138074ecd922211df2637f60736ddfab7e9aec0b3ccb9",
6
+ "width_device": "cuda",
7
+ "timestamp": "2026-11-25T16:49:22+00:00",
8
+ "split": "train",
9
+ "probe_windows_sha256": "33355b4898d409b23633a21a839773f463c5771aaa3a8e2df9840aa647b37e4f",
10
+ "width_windows": 8,
11
+ "curvature_windows": 2,
12
+ "width": {
13
+ "baseline_nll": 2.9101760387420654,
14
+ "delta_nll": 0.1,
15
+ "directions": [
16
+ {
17
+ "direction": 0,
18
+ "positive": {
19
+ "lower": 10.82421875,
20
+ "upper": 10.826171875
21
+ },
22
+ "negative": {
23
+ "lower": 10.193359375,
24
+ "upper": 10.1953125
25
+ }
26
+ },
27
+ {
28
+ "direction": 1,
29
+ "positive": {
30
+ "lower": 8.400390625,
31
+ "upper": 8.40234375
32
+ },
33
+ "negative": {
34
+ "lower": 10.30078125,
35
+ "upper": 10.302734375
36
+ }
37
+ },
38
+ {
39
+ "direction": 2,
40
+ "positive": {
41
+ "lower": 10.4453125,
42
+ "upper": 10.447265625
43
+ },
44
+ "negative": {
45
+ "lower": 9.310546875,
46
+ "upper": 9.3125
47
+ }
48
+ },
49
+ {
50
+ "direction": 3,
51
+ "positive": {
52
+ "lower": 9.79296875,
53
+ "upper": 9.794921875
54
+ },
55
+ "negative": {
56
+ "lower": 9.142578125,
57
+ "upper": 9.14453125
58
+ }
59
+ },
60
+ {
61
+ "direction": 4,
62
+ "positive": {
63
+ "lower": 10.35546875,
64
+ "upper": 10.357421875
65
+ },
66
+ "negative": {
67
+ "lower": 10.302734375,
68
+ "upper": 10.3046875
69
+ }
70
+ },
71
+ {
72
+ "direction": 5,
73
+ "positive": {
74
+ "lower": 9.490234375,
75
+ "upper": 9.4921875
76
+ },
77
+ "negative": {
78
+ "lower": 9.951171875,
79
+ "upper": 9.953125
80
+ }
81
+ },
82
+ {
83
+ "direction": 6,
84
+ "positive": {
85
+ "lower": 9.478515625,
86
+ "upper": 9.48046875
87
+ },
88
+ "negative": {
89
+ "lower": 9.51953125,
90
+ "upper": 9.521484375
91
+ }
92
+ },
93
+ {
94
+ "direction": 7,
95
+ "positive": {
96
+ "lower": 9.15234375,
97
+ "upper": 9.154296875
98
+ },
99
+ "negative": {
100
+ "lower": 10.083984375,
101
+ "upper": 10.0859375
102
+ }
103
+ },
104
+ {
105
+ "direction": 8,
106
+ "positive": {
107
+ "lower": 9.271484375,
108
+ "upper": 9.2734375
109
+ },
110
+ "negative": {
111
+ "lower": 9.5625,
112
+ "upper": 9.564453125
113
+ }
114
+ },
115
+ {
116
+ "direction": 9,
117
+ "positive": {
118
+ "lower": 9.8203125,
119
+ "upper": 9.822265625
120
+ },
121
+ "negative": {
122
+ "lower": 9.921875,
123
+ "upper": 9.923828125
124
+ }
125
+ },
126
+ {
127
+ "direction": 10,
128
+ "positive": {
129
+ "lower": 10.83203125,
130
+ "upper": 10.833984375
131
+ },
132
+ "negative": {
133
+ "lower": 9.29296875,
134
+ "upper": 9.294921875
135
+ }
136
+ },
137
+ {
138
+ "direction": 11,
139
+ "positive": {
140
+ "lower": 10.064453125,
141
+ "upper": 10.06640625
142
+ },
143
+ "negative": {
144
+ "lower": 10.796875,
145
+ "upper": 10.798828125
146
+ }
147
+ },
148
+ {
149
+ "direction": 12,
150
+ "positive": {
151
+ "lower": 12.94921875,
152
+ "upper": 12.951171875
153
+ },
154
+ "negative": {
155
+ "lower": 9.8671875,
156
+ "upper": 9.869140625
157
+ }
158
+ },
159
+ {
160
+ "direction": 13,
161
+ "positive": {
162
+ "lower": 10.095703125,
163
+ "upper": 10.09765625
164
+ },
165
+ "negative": {
166
+ "lower": 9.78515625,
167
+ "upper": 9.787109375
168
+ }
169
+ },
170
+ {
171
+ "direction": 14,
172
+ "positive": {
173
+ "lower": 10.109375,
174
+ "upper": 10.111328125
175
+ },
176
+ "negative": {
177
+ "lower": 9.884765625,
178
+ "upper": 9.88671875
179
+ }
180
+ },
181
+ {
182
+ "direction": 15,
183
+ "positive": {
184
+ "lower": 9.689453125,
185
+ "upper": 9.69140625
186
+ },
187
+ "negative": {
188
+ "lower": 9.84375,
189
+ "upper": 9.845703125
190
+ }
191
+ }
192
+ ],
193
+ "width_lower": 19.7490234375,
194
+ "width_upper": 19.7529296875,
195
+ "width": 19.7509765625,
196
+ "censored_rays": 0,
197
+ "weights_sha256": "5df031f78ec677dc5fbd0a28e1643b5a17ddc1057567ea1b1ff793e6b5463468",
198
+ "weights_restored": true,
199
+ "seconds": 231.8875212999992
200
+ },
201
+ "curvature": {
202
+ "dimensions": 786432,
203
+ "draws": [
204
+ {
205
+ "index": 0,
206
+ "trace_per_parameter": 0.002017029226796575,
207
+ "squared_rms": 0.30359075429894494
208
+ },
209
+ {
210
+ "index": 1,
211
+ "trace_per_parameter": 0.011375821833780692,
212
+ "squared_rms": 5.558236726130382
213
+ },
214
+ {
215
+ "index": 2,
216
+ "trace_per_parameter": 0.003073199553484087,
217
+ "squared_rms": 0.5580516212190562
218
+ },
219
+ {
220
+ "index": 3,
221
+ "trace_per_parameter": 0.005567907101112614,
222
+ "squared_rms": 2.10054837866491
223
+ },
224
+ {
225
+ "index": 4,
226
+ "trace_per_parameter": 0.001637857362413852,
227
+ "squared_rms": 0.28017183220599534
228
+ },
229
+ {
230
+ "index": 5,
231
+ "trace_per_parameter": 0.0033649399103422273,
232
+ "squared_rms": 0.41735848689410354
233
+ },
234
+ {
235
+ "index": 6,
236
+ "trace_per_parameter": 0.002283413699140181,
237
+ "squared_rms": 0.7363704887502874
238
+ },
239
+ {
240
+ "index": 7,
241
+ "trace_per_parameter": 0.003070116608722761,
242
+ "squared_rms": 1.219143476473667
243
+ }
244
+ ],
245
+ "device": "cpu",
246
+ "dtype": "torch.float64",
247
+ "trace_per_parameter": 0.004048785661974124,
248
+ "rms_curvature": 1.1818138476848494
249
+ }
250
+ }
research/src/thirdloss/checkpoint_flatness.py CHANGED
@@ -1,6 +1,7 @@
1
  """Secondary training-window geometry of saved language-model checkpoints, outside timed training."""
2
 
3
  import hashlib
 
4
  import math
5
  import subprocess
6
  import sys
@@ -9,9 +10,11 @@ from statistics import mean
9
  import torch
10
  from filelock import FileLock
11
 
12
- from .models import logits_of,token_loss,widen_pythia
 
13
  from .penalties import inner,partials,random_signs
14
- from .records import HORIZONS,read_json,run_name,sha256,time_now,write_json
 
15
  from .study import load_trained_model
16
  from .width import measure_width
17
  from .windows import TrainingWindows,generator
@@ -39,24 +42,39 @@ def hessian_statistics(loss,parameters):
39
  "rms_curvature":math.sqrt(mean(r["squared_rms"] for r in draws))}
40
 
41
 
42
- def measure_checkpoint(project,storage,row,device):
43
- """Restore one verified export and compute both local curvature and finite-radius width."""
44
- corpus=storage/"data"/row["stage"]
45
- path=project/"results"/row["id"]/"flatness.json"
46
- identity={"protocol":PROTOCOL,"run":row["id"],"checkpoint_file_sha256":row["weights_sha256"],
47
- "data_manifest_sha256":sha256(corpus/"manifest.json"),"width_device":device.type}
48
- if identity["data_manifest_sha256"]!=row["data_manifest_sha256"]:
49
- raise ValueError(f"Training manifest changed for {row['id']}")
50
- if path.exists():
51
- existing=read_json(path)
52
- if any(existing.get(k)!=v for k,v in identity.items()):
53
- raise ValueError(f"Saved flatness provenance differs for {row['id']}")
54
- return path
55
- print(f"{time_now()} Measuring checkpoint flatness for {row['id']}",flush=True)
56
- model=load_trained_model(storage,row,device).eval()
57
- inputs,targets=TrainingWindows(corpus/"train.bin",88731,8).get(0,device)
58
- fingerprint=hashlib.sha256(inputs.cpu().numpy().tobytes()+targets.cpu().numpy().tobytes()).hexdigest()
59
- width=measure_width(model,lambda:token_loss(logits_of(model,inputs),targets))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  if row["stage"]=="abstracts":
61
  model=widen_pythia(model.cpu())
62
  else:
@@ -64,45 +82,84 @@ def measure_checkpoint(project,storage,row,device):
64
  hessian_device=next(model.parameters()).device
65
  loss=token_loss(logits_of(model,inputs[:2].to(hessian_device)),targets[:2].to(hessian_device))
66
  statistics=hessian_statistics(loss,tuple(p for p in model.parameters() if p.requires_grad))
67
- write_json(path,{**identity,"timestamp":time_now(),"split":"train","probe_windows_sha256":fingerprint,
68
- "width_windows":8,"curvature_windows":2,"width":width,"curvature":statistics})
69
- print(f"{time_now()} {row['id']} width={width['width']} RMS curvature={statistics['rms_curvature']:.6g}",flush=True)
70
- return path
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
 
73
- def flatness_study(project,storage,stages,phase,device,publish):
74
- """Measure all available prespecified matches; resume from independently verified per-run records."""
75
  from .release import publish_snapshot
76
- for stage in stages:
 
 
 
 
 
 
 
77
  data=storage/"data"/stage
78
- if (project/"results"/"selection"/f"{stage}.json").exists():
79
- if sha256(data/"train.bin")!=read_json(data/"manifest.json")["artifacts"]["train.bin"]["sha256"]:
80
- raise ValueError(f"Training tokens differ from their registered digest for {stage}")
81
- for group in (("ce","trace","third"),("hessian_norm","sham","combined")):
82
- for stage in stages:
83
- selection=project/"results"/"selection"/f"{stage}.json"
84
- if not selection.exists():
85
- continue
86
- ratios=read_json(selection)["ratios"]
87
- strength={"ce":0.,"hessian_norm":.03,"sham":ratios["third"],"combined":ratios["third"],**ratios}
88
- for kind in (("pilot","confirm") if phase=="all" else (phase,)):
89
- if kind=="confirm" and "ce" not in group:
90
- continue
91
- for seed in ((0,) if kind=="pilot" else range(1,9)):
92
- for method in group:
93
- run=run_name(stage,method,kind,seed,strength[method])
94
- summary=project/"results"/run/"summary.json"
95
- if not summary.exists():
96
- continue
97
- row=read_json(summary)
98
- if row["tokens"]!=(HORIZONS[stage]//8 if kind=="pilot" else HORIZONS[stage]):
99
- raise ValueError(f"Flatness comparison requires the complete registered horizon: {run}")
100
- with FileLock(str(storage/"locks"/(run+"-flatness.lock"))):
101
- measured=measure_checkpoint(project,storage,row,device)
102
- marker=storage/"releases"/("flatness-"+run+".json")
103
- digest=sha256(measured)
104
- if publish and (not marker.exists() or read_json(marker)["sha256"]!=digest):
105
- subprocess.run([sys.executable,"-m","thirdloss.cli","--project",str(project),"report"],
106
- cwd=project,check=True)
107
- revision=publish_snapshot(project,f"Measure training-window flatness for {run}")
108
- write_json(marker,{"sha256":digest,"git_revision":revision})
 
1
  """Secondary training-window geometry of saved language-model checkpoints, outside timed training."""
2
 
3
  import hashlib
4
+ import json
5
  import math
6
  import subprocess
7
  import sys
 
10
  import torch
11
  from filelock import FileLock
12
 
13
+ from .evaluation import unigram_distribution
14
+ from .models import build_model,logits_of,token_loss,trainable_digest,widen_pythia
15
  from .penalties import inner,partials,random_signs
16
+ from .records import read_json,sha256,time_now,write_json
17
+ from .score_flatness import score_width
18
  from .study import load_trained_model
19
  from .width import measure_width
20
  from .windows import TrainingWindows,generator
 
42
  "rms_curvature":math.sqrt(mean(r["squared_rms"] for r in draws))}
43
 
44
 
45
+ def _initial_model(project,storage,corpus,row,device):
46
+ """Reconstruct zero-update weights, with an independent forward check for the earliest seed."""
47
+ model=build_model(row["stage"],row["seed"],device,storage).eval()
48
+ digest=trainable_digest(model)
49
+ if row.get("initial_trainable_sha256"):
50
+ if digest!=row["initial_trainable_sha256"]:
51
+ raise ValueError("Reconstructed initial weights differ from their saved digest")
52
+ return model,{"initial_trainable_sha256":digest,"verification":"recorded initial weight digest"}
53
+ if row["stage"]!="stories" or row["seed"]!=0:
54
+ raise ValueError("Missing initialization provenance for this reference")
55
+ source="stories-pilot-s00-ce-r00"
56
+ with (project/"results"/source/"events.jsonl").open(encoding="utf-8") as f:
57
+ first=json.loads(next(f))
58
+ inputs,targets=TrainingWindows(corpus/"train.bin",0,row["batch_windows"]).get(0,device)
59
+ with torch.no_grad():
60
+ logits=logits_of(model,inputs)
61
+ loss=float(token_loss(logits,targets))
62
+ accuracy=float((logits.argmax(-1)==targets).double().mean())
63
+ if (first["step"]!=1 or targets.numel()!=first["tokens"] or abs(loss-first["loss"])>1e-5
64
+ or abs(accuracy-first["accuracy"])>1e-8):
65
+ raise ValueError("Reconstructed scratch reference differs on its recorded first training batch")
66
+ return model,{"initial_trainable_sha256":digest,"first_update_source":source,"nll":loss,"accuracy":accuracy}
67
+
68
+
69
+ def _native_geometry(model,row,folder,inputs,targets):
70
+ """Reuse a digest-matched registered hybrid width, then measure local curvature on the fixed batch."""
71
+ registered=folder/f"width-{row['steps']}.json"
72
+ if row["phase"] in {"hybrid","branch"}:
73
+ width=read_json(registered)
74
+ if width["weights_sha256"]!=trainable_digest(model) or not width["weights_restored"]:
75
+ raise ValueError("Registered width belongs to different trained weights")
76
+ else:
77
+ width=measure_width(model,lambda:token_loss(logits_of(model,inputs),targets))
78
  if row["stage"]=="abstracts":
79
  model=widen_pythia(model.cpu())
80
  else:
 
82
  hessian_device=next(model.parameters()).device
83
  loss=token_loss(logits_of(model,inputs[:2].to(hessian_device)),targets[:2].to(hessian_device))
84
  statistics=hessian_statistics(loss,tuple(p for p in model.parameters() if p.requires_grad))
85
+ return {"width_windows":8,"curvature_windows":2,"width":width,"curvature":statistics}
86
+
87
+
88
+ def measure_checkpoint(project,storage,row,device):
89
+ """Use shared output-score coordinates for every predictor and native coordinates where they exist."""
90
+ folder=project/"results"/row["id"]
91
+ corpus=storage/"data"/row["stage"]
92
+ native,score=folder/"flatness.json",folder/"score-flatness.json"
93
+ unigram=row["method"]=="unigram"
94
+ if unigram:
95
+ # A single frequency vector needs no network forward pass or GPU memory.
96
+ device=torch.device("cpu")
97
+ paths=[score] if unigram else [native,score]
98
+ identity={"run":row["id"],"checkpoint_file_sha256":row.get("weights_sha256"),
99
+ "data_manifest_sha256":sha256(corpus/"manifest.json"),"width_device":device.type}
100
+ if identity["data_manifest_sha256"]!=row["data_manifest_sha256"]:
101
+ raise ValueError(f"Training manifest changed for {row['id']}")
102
+ for path in paths:
103
+ if path.exists():
104
+ saved=read_json(path)
105
+ expected={**identity,"protocol":PROTOCOL if path==native else "shared-logit-width-v1"}
106
+ if any(saved.get(k)!=v for k,v in expected.items()):
107
+ raise ValueError(f"Saved flatness provenance differs for {row['id']}")
108
+ if all(path.exists() for path in paths):
109
+ return paths
110
+ print(f"{time_now()} Measuring flatness for {row['id']}",flush=True)
111
+ inputs,targets=TrainingWindows(corpus/"train.bin",88731,8).get(0,device)
112
+ windows=hashlib.sha256(inputs.cpu().numpy().tobytes()+targets.cpu().numpy().tobytes()).hexdigest()
113
+ common={**identity,"split":"train","probe_windows_sha256":windows,"timestamp":time_now()}
114
+ if row["method"]=="initial":
115
+ model,common["reference"]=_initial_model(project,storage,corpus,row,device)
116
+ elif not unigram:
117
+ model=load_trained_model(storage,row,device).eval()
118
+ if not score.exists():
119
+ with torch.no_grad():
120
+ if unigram:
121
+ distribution=unigram_distribution(corpus/"train.bin",read_json(corpus/"manifest.json")["model_vocab_size"])
122
+ common["reference"]={"distribution_sha256":hashlib.sha256(distribution.tobytes()).hexdigest()}
123
+ logits=torch.as_tensor(distribution,device=device).log()[None,:]
124
+ else:
125
+ logits=logits_of(model,inputs)
126
+ output=score_width(logits,targets)
127
+ del logits
128
+ write_json(score,{**common,"protocol":"shared-logit-width-v1","score":output})
129
+ if not unigram and not native.exists():
130
+ data=_native_geometry(model,row,folder,inputs,targets)
131
+ write_json(native,{**common,"protocol":PROTOCOL,**data})
132
+ return paths
133
 
134
 
135
+ def flatness_study(project,storage,stages,phase,device,publish,run_id=None):
136
+ """Visit saved study runs deterministically, including zero-update references and all strengths."""
137
  from .release import publish_snapshot
138
+ phases={"pilot":{"pilot","control"},"confirm":{"confirm"},"hybrid":{"branch","hybrid"},
139
+ "all":{"pilot","control","confirm","branch","hybrid"}}[phase]
140
+ candidates=[read_json(p) for p in (project/"results").glob("*/summary.json")]
141
+ rows=[r for r in candidates if r.get("stage") in stages and r.get("phase") in phases and
142
+ r.get("status")=="complete" and (run_id is None or r["id"]==run_id)]
143
+ if run_id is not None and not rows:
144
+ raise ValueError(f"No completed study checkpoint matches {run_id}")
145
+ for stage in {r["stage"] for r in rows}:
146
  data=storage/"data"/stage
147
+ if sha256(data/"train.bin")!=read_json(data/"manifest.json")["artifacts"]["train.bin"]["sha256"]:
148
+ raise ValueError(f"Training tokens differ from their registered digest for {stage}")
149
+ # Show each kind of model early; the ordering is independent of every performance measurement.
150
+ by_kind={}
151
+ for r in sorted(rows,key=lambda r:(r["seed"],r["ratio"],r["id"])):
152
+ by_kind.setdefault((r["stage"],r["phase"],r["method"]),[]).append(r)
153
+ ordered=[items[i] for i in range(max(map(len,by_kind.values()),default=0)) for items in by_kind.values() if i<len(items)]
154
+ for row in ordered:
155
+ run=row["id"]
156
+ if row["tokens"]!=row["token_budget"]:
157
+ raise ValueError(f"Flatness comparison requires the complete registered horizon: {run}")
158
+ with FileLock(str(storage/"locks"/(run+"-flatness.lock"))):
159
+ paths=measure_checkpoint(project,storage,row,device)
160
+ artifacts={p.name:sha256(p) for p in paths}
161
+ marker=storage/"releases"/("flatness-"+run+".json")
162
+ if publish and (not marker.exists() or read_json(marker).get("artifacts")!=artifacts):
163
+ subprocess.run([sys.executable,"-m","thirdloss.cli","--project",str(project),"report"],cwd=project,check=True)
164
+ revision=publish_snapshot(project,f"Measure comparable flatness for {run}")
165
+ write_json(marker,{"artifacts":artifacts,"git_revision":revision})
 
 
 
 
 
 
 
 
 
 
 
 
research/src/thirdloss/cli.py CHANGED
@@ -45,7 +45,8 @@ def parser():
45
  if action in {"train","study","hybrid","evaluate","flatness"}:
46
  sub.add_argument("--device",default="cuda")
47
  if action=="flatness":
48
- sub.add_argument("--phase",choices=("pilot","confirm","all"),default="all")
 
49
  if action=="study":
50
  sub.add_argument("--with-hybrid",action="store_true",help="Include the registered TinyStories hybrid follow-up on the same GPU")
51
  sub.add_argument("--with-flatness",action="store_true",help="Also measure training-window geometry at saved primary checkpoints")
@@ -131,7 +132,7 @@ def main(argv=None):
131
  device = setup_device(args.device)
132
  if args.action=="flatness":
133
  from .checkpoint_flatness import flatness_study
134
- flatness_study(project,storage,stages,args.phase,device,args.publish)
135
  return
136
  if args.action in {"study","hybrid"}:
137
  from contextlib import nullcontext
 
45
  if action in {"train","study","hybrid","evaluate","flatness"}:
46
  sub.add_argument("--device",default="cuda")
47
  if action=="flatness":
48
+ sub.add_argument("--phase",choices=("pilot","confirm","hybrid","all"),default="all")
49
+ sub.add_argument("--run-id",help="Measure a single completed run in the selected phase")
50
  if action=="study":
51
  sub.add_argument("--with-hybrid",action="store_true",help="Include the registered TinyStories hybrid follow-up on the same GPU")
52
  sub.add_argument("--with-flatness",action="store_true",help="Also measure training-window geometry at saved primary checkpoints")
 
132
  device = setup_device(args.device)
133
  if args.action=="flatness":
134
  from .checkpoint_flatness import flatness_study
135
+ flatness_study(project,storage,stages,args.phase,device,args.publish,run_id=args.run_id)
136
  return
137
  if args.action in {"study","hybrid"}:
138
  from contextlib import nullcontext
research/src/thirdloss/flatness_stats.py CHANGED
@@ -1,6 +1,20 @@
1
  """Order statistics for two-sided perturbation widths with finite bisection and open upper bounds."""
2
 
3
  import math
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
 
6
  def _quantile(values, fraction):
 
1
  """Order statistics for two-sided perturbation widths with finite bisection and open upper bounds."""
2
 
3
  import math
4
+ from statistics import median
5
+
6
+
7
+ def width_statistics(rays):
8
+ """The registered endpoint uses the medians of both crossing brackets, including open ends."""
9
+ lows,highs=[],[]
10
+ for ray in rays:
11
+ bounds=(ray["positive"],ray["negative"])
12
+ lows.append(sum(b["lower"] for b in bounds))
13
+ highs.append(sum(b["upper"] if b["upper"] is not None else math.inf for b in bounds))
14
+ lower,upper=median(lows),median(highs)
15
+ return {"directions":rays,"width_lower":lower,"width_upper":upper if math.isfinite(upper) else None,
16
+ "width":(lower+upper)/2 if math.isfinite(upper) else None,
17
+ "censored_rays":sum(ray[s]["upper"] is None for ray in rays for s in ("positive","negative"))}
18
 
19
 
20
  def _quantile(values, fraction):
research/src/thirdloss/flatness_tables.py CHANGED
@@ -3,6 +3,7 @@
3
  from statistics import median
4
 
5
  from .flatness_stats import quantile_bounds
 
6
  from .report_records import METHODS,completed,markdown_table
7
 
8
 
@@ -83,15 +84,82 @@ def primary_flatness_rows(pairs):
83
  ]
84
 
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  def flatness_ledger(study):
87
  """Provide one evidence link per measured checkpoint, including secondary controls and censored rays."""
88
  rows=[]
89
  for r in study["runs"]:
90
- if "flatness" in r:
91
- p=r["flatness"]
92
- rows.append([r["stage"],r["phase"],r["seed"],METHODS[r["method"]],_width_stat([p],.5),
93
- _spread([p]),_ray_count([p]),f"{p['rms_curvature']:.6g}",f"{p['trace_per_parameter']:+.6g}",
94
- f"[All probes](../results/{r['id']}/flatness.json)"])
 
 
 
 
 
95
  text=["# Flatness at saved checkpoints",
96
  "Widths are measured in each model’s trainable coordinates. A larger width is flatter at the specified "
97
  "training-loss tolerance. A smaller RMS curvature means less local bending. Opposite curvature signs "
@@ -99,8 +167,11 @@ def flatness_ledger(study):
99
  "## Registered TinyStories hybrids",hybrid_flatness_table(study["runs"]),
100
  "The seed range and directional spread describe variability. The rays at the limit give measurement coverage. "
101
  "Compare matching seeds for differences between arms. [Every crossing and paired comparison](hybrid/results.md)",
102
- "## Secondary checkpoint measurements"]
103
- text.append(markdown_table(rows,["Stage","Horizon","Seed","Arm","Width ↑","Middle 50% of directions",
104
- "Rays at limit / tested","RMS curvature ↓","Signed trace / parameter","Evidence"])
 
 
 
105
  if rows else "Awaiting the first saved primary-checkpoint measurement.")
106
  return "\n\n".join(text)+"\n"
 
3
  from statistics import median
4
 
5
  from .flatness_stats import quantile_bounds
6
+ from .records import HORIZONS,RATIOS
7
  from .report_records import METHODS,completed,markdown_table
8
 
9
 
 
84
  ]
85
 
86
 
87
+ def all_arm_groups(study):
88
+ """Include every registered predictor, hyperparameter and control with explicit coverage denominators."""
89
+ groups=[]
90
+ for stage,name in (("stories","TinyStories · all model weights"),("abstracts","Pythia-410M · adapter weights")):
91
+ ratios=study["context"][stage]["selection"].get("ratios",{})
92
+ target=HORIZONS[stage]
93
+ stage_runs=[r for r in study["runs"] if r.get("stage")==stage and completed(r)]
94
+ measured=[r["score_flatness"] for r in stage_runs if "score_flatness" in r]
95
+ if len({(p["protocol"],p["probe_windows_sha256"],p["direction_sha256"],p["vocab"]) for p in measured})>1:
96
+ raise ValueError(f"The output-space comparison for {stage} mixes probes or vocabularies")
97
+ def line(phase,method,ratio,budget,seeds,label=None):
98
+ runs=[r for r in stage_runs if r["phase"]==phase and r["method"]==method and r["seed"] in seeds
99
+ and r["tokens"]==budget and (ratio is None or r["ratio"]==ratio)]
100
+ widths=[];curvature=[];scores=[]
101
+ for r in runs:
102
+ w=r.get("flatness") or r.get("widths",{}).get(str(r.get("steps")))
103
+ if w and "width" in w:
104
+ widths.append(w)
105
+ if "flatness" in r:
106
+ curvature.append(r["flatness"]["rms_curvature"])
107
+ if "score_flatness" in r:
108
+ scores.append(r["score_flatness"])
109
+ def value(points,formatter):
110
+ return (formatter(points)+f" ({len(points)}/{len(seeds)})") if points else "Pending"
111
+ cohort=str(seeds[0]) if len(seeds)==1 else f"{seeds[0]}–{seeds[-1]}"
112
+ native=value(widths,lambda items:_width_stat(items,.5)) if method!="unigram" else "N/A · no weights"
113
+ rms=value(curvature,lambda items:f"{median(items):.5g}") if method!="unigram" else "N/A · no weights"
114
+ return [label or METHODS[method],f"{budget:,}",cohort,native,rms,value(scores,lambda items:_width_stat(items,.5))]
115
+ one=(0,); confirm=range(1,9); follow=range(21,29)
116
+ rows=[line("control",m,0.,0,one) for m in ("initial","unigram")]
117
+ arms={"ce":0.,"trace":ratios.get("trace"),"third":ratios.get("third"),"hessian_norm":.03,
118
+ "sham":ratios.get("third"),"combined":ratios.get("third")}
119
+ for m,r in arms.items():
120
+ if r is not None:
121
+ rows.append(line("pilot",m,r,target//8,one,METHODS[m]+(f" ({r:.0%})" if r else "")))
122
+ for m in ("ce","trace","third"):
123
+ rows.append(line("confirm",m,arms[m],target,confirm,METHODS[m]+" · confirmation"))
124
+ if stage=="stories":
125
+ rows.append(line("branch","trunk",.01,target//2,follow))
126
+ for m in ("adaptive","late","trace","strong","replay","always"):
127
+ rows.append(line("hybrid",m,.01,target,follow,METHODS[m]+" · hybrid study"))
128
+ extra=[line("pilot",m,r,target//8,one,f"{METHODS[m]} ({r:.0%})") for m in ("trace","third")
129
+ for r in RATIOS if r!=arms[m]]
130
+ for row in stage_runs:
131
+ if row["phase"]=="diagnostic":
132
+ extra.append(line("diagnostic",row["method"],row["ratio"],row["tokens"],(row["seed"],),
133
+ f"{METHODS[row['method']]} ({row['ratio']:.0%}) · excluded precision diagnostic"))
134
+ groups.append((name,rows,extra))
135
+ return groups
136
+
137
+
138
+ def all_arm_tables(study):
139
+ headers=["Variant","Training targets","Seed cohort","Weight width<br>↑ Wider is flatter",
140
+ "RMS weight curvature<br>↓ Less local bending","Common score width<br>↑ More score tolerance"]
141
+ tables=[]
142
+ for name,rows,extra in all_arm_groups(study):
143
+ tables.extend([f"**{name}**",markdown_table(rows,headers)])
144
+ tables.append(f"<details><summary>{name} · other pilot strengths and precision diagnostics</summary>\n\n"
145
+ +markdown_table(extra,headers)+"\n\n</details>")
146
+ return tables
147
+
148
+
149
  def flatness_ledger(study):
150
  """Provide one evidence link per measured checkpoint, including secondary controls and censored rays."""
151
  rows=[]
152
  for r in study["runs"]:
153
+ p=r.get("flatness")
154
+ s=r.get("score_flatness")
155
+ if p or s:
156
+ base=f"../results/{r['id']}/"
157
+ links=([f"[Weight probes]({base}flatness.json)"] if p else [])+([f"[Score probes]({base}score-flatness.json)"] if s else [])
158
+ rows.append([r["stage"],r["phase"],r["seed"],METHODS[r["method"]],f"{r['ratio']:.0%}",
159
+ *([_width_stat([p],.5),_spread([p]),_ray_count([p]),f"{p['rms_curvature']:.6g}",
160
+ f"{p['trace_per_parameter']:+.6g}"] if p else ["N/A" if r["method"]=="unigram" else "Pending"]*5),
161
+ *([_width_stat([s],.5),_spread([s]),_ray_count([s]),f"{s['mean_directional_curvature']:.6g}"] if s else ["Pending"]*4),
162
+ " · ".join(links)])
163
  text=["# Flatness at saved checkpoints",
164
  "Widths are measured in each model’s trainable coordinates. A larger width is flatter at the specified "
165
  "training-loss tolerance. A smaller RMS curvature means less local bending. Opposite curvature signs "
 
167
  "## Registered TinyStories hybrids",hybrid_flatness_table(study["runs"]),
168
  "The seed range and directional spread describe variability. The rays at the limit give measurement coverage. "
169
  "Compare matching seeds for differences between arms. [Every crossing and paired comparison](hybrid/results.md)",
170
+ "## Every variant and baseline","Parentheses give measured / planned seeds. A unigram has only the common score-space measurement. "
171
+ "[Shared score perturbations](amendments/all-model-flatness.md)",*all_arm_tables(study),
172
+ "## Per-run checkpoint measurements"]
173
+ text.append(markdown_table(rows,["Stage","Horizon","Seed","Arm","Strength","Weight width ↑","Weight middle 50%",
174
+ "Weight rays at limit","RMS curvature ↓","Signed trace / parameter","Score width ↑",
175
+ "Score middle 50%","Score rays at limit","Mean score curvature","Evidence"])
176
  if rows else "Awaiting the first saved primary-checkpoint measurement.")
177
  return "\n\n".join(text)+"\n"
research/src/thirdloss/readme_comparisons.py CHANGED
@@ -5,7 +5,7 @@ from html import escape
5
  from statistics import median
6
 
7
  from .analysis import _time_match
8
- from .flatness_tables import hybrid_flatness_table,primary_flatness_rows
9
  from .records import HORIZONS
10
  from .report_records import METHODS, completed, finite, markdown_table, verdict_text
11
 
@@ -271,6 +271,16 @@ def comparison_sections(study):
271
  "The final seed range shows the smallest and largest seed widths. The middle 50% column gives the medians of "
272
  "the within-seed directional quartiles. Spread has no preferred direction. A ray at the search limit supplies a lower bound.",
273
  hybrid_flatness_table(study["runs"])])
 
 
 
 
 
 
 
 
 
 
274
  if geometry_tables:
275
  detail.extend(geometry_tables)
276
  else:
@@ -329,7 +339,7 @@ def comparison_sections(study):
329
  zero.append([name,*[f"{runs[m]['dev_nll']:.6f}" for m in ("initial","unigram")],
330
  *[f"{100*runs[m]['dev_accuracy']:.3f}%" for m in ("initial","unigram")]])
331
  if zero:
332
- controls+=["**Untrained references · zero training targets**",
333
  markdown_table(zero,["Stage","Initial NLL<br>"+NLL.direction,"Unigram NLL<br>"+NLL.direction,
334
  "Initial accuracy<br>"+ACCURACY.direction,"Unigram accuracy<br>"+ACCURACY.direction])]
335
  detail.append("<details><summary>Squared-Hessian, scrambled-gradient, combined and untrained controls</summary>\n\n"
 
5
  from statistics import median
6
 
7
  from .analysis import _time_match
8
+ from .flatness_tables import all_arm_tables,hybrid_flatness_table,primary_flatness_rows
9
  from .records import HORIZONS
10
  from .report_records import METHODS, completed, finite, markdown_table, verdict_text
11
 
 
271
  "The final seed range shows the smallest and largest seed widths. The middle 50% column gives the medians of "
272
  "the within-seed directional quartiles. Spread has no preferred direction. A ray at the search limit supplies a lower bound.",
273
  hybrid_flatness_table(study["runs"])])
274
+ detail.extend(["#### All variants and baselines",
275
+ "Each row uses the same fixed training windows and probe directions within its stage. "
276
+ "Parentheses give measured / planned seeds for that cell. Targets count next-token examples used for optimizer updates in this study. "
277
+ "The unigram uses counts from the full training split, and initial Pythia retains its pretrained backbone. "
278
+ "Compare rows with matching targets and seeds. "
279
+ "Larger **weight width** means greater tolerance to moving the model’s trainable parameters. "
280
+ "Larger **common score width** means that all token scores can tolerate a larger shared bias before NLL rises "
281
+ "by 0.1 nats, measured in RMS logit units. The unigram has zero trainable model weights and shares the score test "
282
+ "with every neural predictor. Both widths have an unknown relationship to better held-out prediction. "
283
+ "[All-model measurement design](reports/amendments/all-model-flatness.md)",*all_arm_tables(study)])
284
  if geometry_tables:
285
  detail.extend(geometry_tables)
286
  else:
 
339
  zero.append([name,*[f"{runs[m]['dev_nll']:.6f}" for m in ("initial","unigram")],
340
  *[f"{100*runs[m]['dev_accuracy']:.3f}%" for m in ("initial","unigram")]])
341
  if zero:
342
+ controls+=["**Zero-update references** · The unigram uses training-split frequencies. Initial Pythia uses its pretrained weights.",
343
  markdown_table(zero,["Stage","Initial NLL<br>"+NLL.direction,"Unigram NLL<br>"+NLL.direction,
344
  "Initial accuracy<br>"+ACCURACY.direction,"Unigram accuracy<br>"+ACCURACY.direction])]
345
  detail.append("<details><summary>Squared-Hessian, scrambled-gradient, combined and untrained controls</summary>\n\n"
research/src/thirdloss/report_paper.py CHANGED
@@ -408,6 +408,18 @@ def write_paper(study: dict, output: Path, figure_dir: Path, figures: dict) -> N
408
  "Individual CUDA kernel durations were not profiled.", "caption")
409
  flow.append(_grid(styles,["Corpus","Seed","Cutoff (s)","AdamW NLL (lag s)",
410
  "Trace NLL (lag s)","Third NLL (lag s)"],nonhost,[82,34,65,98,98,98]))
 
 
 
 
 
 
 
 
 
 
 
 
411
  pair_rows = [[STAGES[stage], METHODS.get(base, base), pair["seed"],
412
  fmt(pair["third_nll"], 5), fmt(pair["baseline_nll"], 5), fmt(pair["delta"], 5)]
413
  for stage, outcome in study["stages"].items()
 
408
  "Individual CUDA kernel durations were not profiled.", "caption")
409
  flow.append(_grid(styles,["Corpus","Seed","Cutoff (s)","AdamW NLL (lag s)",
410
  "Trace NLL (lag s)","Third NLL (lag s)"],nonhost,[82,34,65,98,98,98]))
411
+ from .flatness_tables import all_arm_groups
412
+ p("Appendix · Flatness by model and reference","heading")
413
+ p("Each entry gives a median and the measured/planned seed count. A wider interval of permitted weight or "
414
+ "score displacement is flatter under its corresponding perturbation. Smaller RMS Hessian curvature indicates "
415
+ "less local bending. Common score width uses identical token-level logit biases for every predictor within a "
416
+ "stage, including the unigram. The retained strength-search and diagnostic measurements follow each stage. "
417
+ f"{_link(REPOSITORY + '/blob/main/reports/amendments/all-model-flatness.md','Common measurement protocol')} · "
418
+ f"{_link(REPOSITORY + '/blob/main/reports/flatness.md','Per-run evidence')}")
419
+ for name,main_arms,other_arms in all_arm_groups(study):
420
+ p(name,"subheading")
421
+ flow.append(_grid(styles,["Variant","Training targets","Seeds","Weight width ↑","RMS curvature ↓","Score width ↑"],
422
+ main_arms+other_arms,[124,71,45,79,79,78]))
423
  pair_rows = [[STAGES[stage], METHODS.get(base, base), pair["seed"],
424
  fmt(pair["third_nll"], 5), fmt(pair["baseline_nll"], 5), fmt(pair["delta"], 5)]
425
  for stage, outcome in study["stages"].items()
research/src/thirdloss/report_records.py CHANGED
@@ -193,6 +193,16 @@ def run_record(folder: Path) -> dict:
193
  record["events"].append({"step":record["steps"],"tokens":record["tokens"],"train_seconds":record["train_seconds"],
194
  "width":diagnostic["width"]["width"],"checkpoint_rms":diagnostic["curvature"]["rms_curvature"],
195
  "checkpoint_signed_trace":diagnostic["curvature"]["trace_per_parameter"]})
 
 
 
 
 
 
 
 
 
 
196
  record["samples"] = read_lines(folder / "samples.jsonl")
197
  return record
198
 
@@ -202,7 +212,7 @@ def display_events(events: list[dict], maximum: int = 240) -> list[dict]:
202
  if len(events) <= maximum:
203
  return events
204
  keep = {round(i * (len(events) - 1) / (maximum - 1)) for i in range(maximum)}
205
- keep.update(i for i, event in enumerate(events) if finite(event.get("dev_nll")) or "width" in event)
206
  return [events[i] for i in sorted(keep)]
207
 
208
 
 
193
  record["events"].append({"step":record["steps"],"tokens":record["tokens"],"train_seconds":record["train_seconds"],
194
  "width":diagnostic["width"]["width"],"checkpoint_rms":diagnostic["curvature"]["rms_curvature"],
195
  "checkpoint_signed_trace":diagnostic["curvature"]["trace_per_parameter"]})
196
+ output=read_json(folder/"score-flatness.json")
197
+ if output:
198
+ if (output["run"]!=folder.name or output["checkpoint_file_sha256"]!=record.get("weights_sha256")
199
+ or output["split"]!="train" or output["data_manifest_sha256"]!=record.get("data_manifest_sha256")):
200
+ raise ValueError(f"Output-score geometry provenance differs for {folder.name}")
201
+ record["score_flatness"]={**compact_width(output["score"]),"probe_windows_sha256":output["probe_windows_sha256"],
202
+ "protocol":output["protocol"]}
203
+ record["events"].append({"step":record["steps"],"tokens":record["tokens"],"train_seconds":record["train_seconds"],
204
+ "score_width":output["score"]["width"],
205
+ "score_curvature":output["score"]["mean_directional_curvature"]})
206
  record["samples"] = read_lines(folder / "samples.jsonl")
207
  return record
208
 
 
212
  if len(events) <= maximum:
213
  return events
214
  keep = {round(i * (len(events) - 1) / (maximum - 1)) for i in range(maximum)}
215
+ keep.update(i for i, event in enumerate(events) if finite(event.get("dev_nll")) or "width" in event or "score_width" in event)
216
  return [events[i] for i in sorted(keep)]
217
 
218
 
research/src/thirdloss/score_flatness.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """A shared output-space perturbation applies to a causal LM or an empirical unigram predictor."""
2
+
3
+ import hashlib
4
+ from statistics import mean
5
+
6
+ import numpy as np
7
+ import torch
8
+
9
+ from .flatness_stats import width_statistics
10
+ from .width import crossing
11
+ from .windows import generator
12
+
13
+
14
+ def bias_response(positive_mass,mean_target_sign):
15
+ """Factor the log-softmax partition into the positive and negative sign groups on each target."""
16
+ mass=np.clip(positive_mass,0.,1.)
17
+ with np.errstate(divide="ignore"):
18
+ plus,minus=np.log(mass),np.log1p(-mass)
19
+ def change(radius):
20
+ return float(np.logaddexp(plus+radius,minus-radius).mean()-radius*mean_target_sign)
21
+ return change,float(np.mean(4*mass*(1-mass)))
22
+
23
+
24
+ @torch.no_grad()
25
+ def score_width(logits,targets):
26
+ """Use exactly the same vocabulary signs for every predictor and RMS-logit units for its radius."""
27
+ vocab=logits.shape[-1]
28
+ target=targets.reshape(-1)
29
+ logp=logits.reshape(-1,vocab).double().log_softmax(-1)
30
+ if logp.shape[0] not in (1,target.numel()):
31
+ raise ValueError("A score probe requires one distribution per target or a single shared unigram")
32
+ signs=torch.ones((vocab,16),dtype=torch.int8)
33
+ for i in range(16):
34
+ permutation=torch.randperm(vocab,generator=generator("cpu",88731,i,991))
35
+ signs[permutation[:vocab//2],i]=-1
36
+ digest=hashlib.sha256(signs.numpy().tobytes()).hexdigest()
37
+ signs=signs.to(logp.device)
38
+ plus=(logp.exp() @ (signs>0).double()).cpu().numpy()
39
+ average_sign=signs[target].double().mean(0).cpu().tolist()
40
+ selected=logp[0,target] if logp.shape[0]==1 else logp.gather(1,target[:,None]).squeeze(1)
41
+ rays=[]
42
+ for i,s in enumerate(average_sign):
43
+ change,curvature=bias_response(plus[:,i],s)
44
+ rays.append({"direction":i,"positive":crossing(change,.1),"negative":crossing(lambda r:change(-r),.1),
45
+ "curvature":curvature})
46
+ return {"baseline_nll":float(-selected.mean()),"delta_nll":.1,"units":"RMS logit displacement",
47
+ "vocab":vocab,"targets":target.numel(),"direction_sha256":digest,**width_statistics(rays),
48
+ "mean_directional_curvature":mean(ray["curvature"] for ray in rays)}
research/src/thirdloss/width.py CHANGED
@@ -1,11 +1,11 @@
1
  """Directional width of an unregularized loss level set in the original weight coordinates."""
2
 
3
  import math
4
- import statistics
5
  import time
6
 
7
  import torch
8
 
 
9
  from .models import trainable_digest
10
  from .penalties import random_signs
11
  from .windows import generator
@@ -64,14 +64,5 @@ def measure_width(model, loss, directions=16):
64
  module.training = mode
65
  if trainable_digest(model)!=digest:
66
  raise RuntimeError("Width measurement changed the training weights")
67
- lows,highs = [],[]
68
- for row in rays:
69
- bounds = [row["positive"],row["negative"]]
70
- lows.append(sum(x["lower"] for x in bounds))
71
- highs.append(sum(x["upper"] if x["upper"] is not None else math.inf for x in bounds))
72
- lower,upper = statistics.median(lows),statistics.median(highs)
73
- return {"baseline_nll":base,"delta_nll":.1,"directions":rays,"width_lower":lower,
74
- "width_upper":upper if math.isfinite(upper) else None,
75
- "width":(lower+upper)/2 if math.isfinite(upper) else None,
76
- "censored_rays":sum(ray[s]["upper"] is None for ray in rays for s in ("positive","negative")),
77
  "weights_sha256":digest,"weights_restored":True,"seconds":time.perf_counter()-started}
 
1
  """Directional width of an unregularized loss level set in the original weight coordinates."""
2
 
3
  import math
 
4
  import time
5
 
6
  import torch
7
 
8
+ from .flatness_stats import width_statistics
9
  from .models import trainable_digest
10
  from .penalties import random_signs
11
  from .windows import generator
 
64
  module.training = mode
65
  if trainable_digest(model)!=digest:
66
  raise RuntimeError("Width measurement changed the training weights")
67
+ return {"baseline_nll":base,"delta_nll":.1,**width_statistics(rays),
 
 
 
 
 
 
 
 
 
68
  "weights_sha256":digest,"weights_restored":True,"seconds":time.perf_counter()-started}
research/tests/test_flatness.py CHANGED
@@ -52,3 +52,45 @@ def test_primary_flatness_summary_compares_only_common_probe_provenance():
52
  arm["flatness"]["probe_windows_sha256"]="different"
53
  with pytest.raises(ValueError,match="same probes"):
54
  primary_flatness_rows(pairs)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  arm["flatness"]["probe_windows_sha256"]="different"
53
  with pytest.raises(ValueError,match="same probes"):
54
  primary_flatness_rows(pairs)
55
+
56
+
57
+ def test_common_logit_probe_matches_direct_softmax_and_its_second_derivative():
58
+ from thirdloss.score_flatness import bias_response
59
+ logits=torch.tensor([[.1,.2,-.3,1.],[-1.,2.,.7,-.3]],dtype=torch.float64)
60
+ target=torch.tensor([1,0])
61
+ signs=torch.tensor([1.,-1.,-1.,1.],dtype=torch.float64)
62
+ plus=logits.softmax(-1)[:,signs>0].sum(-1).numpy()
63
+ loss=torch.nn.functional.cross_entropy(logits,target)
64
+ delta,curvature=bias_response(plus,float(signs[target].mean()))
65
+ for r in (-1.,.5):
66
+ assert delta(r)==pytest.approx(float(torch.nn.functional.cross_entropy(logits+r*signs,target)-loss))
67
+ radius=torch.tensor(0.,dtype=torch.float64,requires_grad=True)
68
+ derivative=torch.autograd.grad(torch.nn.functional.cross_entropy(logits+radius*signs,target),radius,create_graph=True)[0]
69
+ assert curvature==pytest.approx(float(torch.autograd.grad(derivative,radius)[0]))
70
+
71
+
72
+ def test_unigram_uses_identical_score_coordinates_to_a_constant_neural_predictor():
73
+ from thirdloss.score_flatness import score_width
74
+ logits=torch.tensor([[0.,.25,.5,-.5]],dtype=torch.float64)
75
+ targets=torch.tensor([3,1,3,2,1])
76
+ table=score_width(logits,targets)
77
+ network=score_width(logits.expand(targets.numel(),-1)+13,targets)
78
+ assert table["width"]==network["width"] and table["direction_sha256"]==network["direction_sha256"]
79
+ assert table["mean_directional_curvature"]==pytest.approx(network["mean_directional_curvature"])
80
+
81
+
82
+ def test_all_arm_table_keeps_weightless_reference_and_every_control(tmp_path):
83
+ from thirdloss.flatness_tables import all_arm_tables
84
+ from thirdloss.report_records import study_snapshot
85
+ study=study_snapshot(tmp_path)
86
+ for stage in study["context"].values():
87
+ stage["selection"]={"ratios":{"trace":.01,"third":.03}}
88
+ point={"width":.9,"width_lower":.8999,"width_upper":.9001,"direction_sha256":"same","protocol":"scores",
89
+ "probe_windows_sha256":"same","vocab":4096}
90
+ study["runs"]=[{"stage":"stories","phase":"control","method":"unigram","status":"complete",
91
+ "ratio":0.,"seed":0,"tokens":0,"score_flatness":point}]
92
+ text="\n".join(all_arm_tables(study))
93
+ assert "| Unigram | 0 | 0 | N/A · no weights | N/A · no weights | 0.900 (1/1) |" in text
94
+ assert all(name in text for name in ("Squared Hessian norm","Randomized gradient signs","Trace + third derivative",
95
+ "Cross-seed replay","Shared trace checkpoint","Always-on hybrid"))
96
+ assert "Hessian trace (10%)" in text and "Third derivative (1%)" in text