Archive hybrid implementation, locked dependencies and new tests before running models
Browse filesFiles changed (36)
- logs/hybrid-implementation-release.logAdded+1
- logs/study-20261125T105025-confirmation.log+15
- publication.json+141-81
- research/README.md+4-2
- research/docs/explorer.js+8-3
- research/docs/index.html+4-1
- research/docs/runbook.md+2
- research/docs/study.json
- research/reports/experiments/abstracts-pilot-s00-hessian_norm-r03-fp64/experiment.mdAdded+11
- research/reports/experiments/abstracts-pilot-s00-hessian_norm-r03-fp64/learnings.mdAdded+5
- research/reports/experiments/experiments.md+1
- research/reports/experiments/learnings.md+2
- research/reports/hybrid/results.mdAdded+9
- research/reports/paper.pdf
- research/reports/progress.md+12-2
- research/reports/summary.md+4-2
- research/results/abstracts-pilot-s00-hessian_norm-r03-fp64/state.jsonAdded+17
- research/results/feasibility/abstracts.jsonAdded+28
- research/results/feasibility/one-week.jsonAdded+77
- research/results/selection/abstracts.jsonAdded+43
- research/src/thirdloss/analysis.py+17-6
- research/src/thirdloss/cli.py+11-5
- research/src/thirdloss/hybrid.pyAdded+215
- research/src/thirdloss/hybrid_results.pyAdded+47
- research/src/thirdloss/objectives.py+5-4
- research/src/thirdloss/penalties.py+2-2
- research/src/thirdloss/progress.py+5-1
- research/src/thirdloss/release.py+4
- research/src/thirdloss/report_figures.py+27-1
- research/src/thirdloss/report_paper.py+17-7
- research/src/thirdloss/report_records.py+19-2
- research/src/thirdloss/reporting.py+61-2
- research/src/thirdloss/study.py+4-1
- research/src/thirdloss/train.py+52-13
- research/src/thirdloss/width.pyAdded+77
- research/tests/test_hybrid.pyAdded+107
1findfont: Failed to find font weight semibold for DejaVu Sans, now using 700.76 unmodified lines77787980818283848586878889909192939476 unmodified lines{"timestamp": "2026-11-25T10:27:53+00:00", "split": "dev", "prompt": "We investigate the connection between the turnover frequency in the radio\nspectrum, $\\nu", "reference": "_{\\rm TO}$, and the rate of ionising ultra-violet photons,\n$Q_{\\rm HI}$, in extragalactic sources. From a large, optically selected,\nsample we", "continuation": "_{\\rm{break}}$, and the spectral index of the underlying\nspectral index $s_{\\rm{break}}$, and reveal that there is a universal\nrelationship between both quantities that can be used to", "prompt_ids": [1231, 7409, 253, 4602, 875, 253, 25759, 4294, 275, 253, 5553, 187, 39862, 13, 669, 3023], "generated_ids": [1126, 1109, 92, 7054, 12460, 285, 253, 9879, 3605, 273, 253, 6944, 187, 18181, 1544, 3605, 370, 84, 1126, 1109, 92, 7054, 12460, 285, 10313, 326, 627, 310, 247, 10898, 187, 46397, 875, 1097, 13483, 326, 476, 320, 908, 281], "tokens": 40, "sampling_seed": 7403, "temperature": 0.8}
Completed abstracts-pilot-s00-third-r10-fp64 development NLL 3.116312
findfont: Failed to find font weight semibold for DejaVu Sans, now using 700.
2026-11-25T10:29:04+00:00 [calibration] abstracts hessian_norm draw 1/16 estimate 1.15844e+06, CE gradient norm 1.12725, penalty gradient norm 1.4477e+09, 19.75 s
2026-11-25T10:29:23+00:00 [calibration] abstracts hessian_norm draw 2/16 estimate 527714, CE gradient norm 1.17571, penalty gradient norm 1.89463e+08, 18.49 s
2026-11-25T10:29:42+00:00 [calibration] abstracts hessian_norm draw 3/16 estimate 261117, CE gradient norm 1.20218, penalty gradient norm 1.78487e+08, 18.32 s
2026-11-25T10:30:03+00:00 [calibration] abstracts hessian_norm draw 4/16 estimate 2.16188e+06, CE gradient norm 1.0703, penalty gradient norm 2.24502e+09, 18.94 s
2026-11-25T10:30:22+00:00 [calibration] abstracts hessian_norm draw 5/16 estimate 334819, CE gradient norm 1.18184, penalty gradient norm 8.39062e+07, 18.40 s
2026-11-25T10:30:43+00:00 [calibration] abstracts hessian_norm draw 6/16 estimate 605145, CE gradient norm 1.22194, penalty gradient norm 1.45826e+08, 19.12 s
2026-11-25T10:31:02+00:00 [calibration] abstracts hessian_norm draw 7/16 estimate 650125, CE gradient norm 1.11921, penalty gradient norm 1.67848e+08, 17.78 s
2026-11-25T10:31:21+00:00 [calibration] abstracts hessian_norm draw 8/16 estimate 299573, CE gradient norm 1.01186, penalty gradient norm 1.13189e+08, 17.82 s
2026-11-25T10:31:40+00:00 [calibration] abstracts hessian_norm draw 9/16 estimate 379969, CE gradient norm 1.22581, penalty gradient norm 1.42905e+08, 18.51 s
2026-11-25T10:32:01+00:00 [calibration] abstracts hessian_norm draw 10/16 estimate 335985, CE gradient norm 1.168, penalty gradient norm 7.46532e+07, 19.05 s
2026-11-25T10:32:20+00:00 [calibration] abstracts hessian_norm draw 11/16 estimate 659706, CE gradient norm 1.15495, penalty gradient norm 2.09725e+08, 18.26 s
2026-11-25T10:32:40+00:00 [calibration] abstracts hessian_norm draw 12/16 estimate 407203, CE gradient norm 1.06794, penalty gradient norm 9.65231e+07, 19.00 s
2026-11-25T10:33:00+00:00 [calibration] abstracts hessian_norm draw 13/16 estimate 263650, CE gradient norm 1.24234, penalty gradient norm 1.89179e+08, 18.41 s
2026-11-25T10:33:19+00:00 [calibration] abstracts hessian_norm draw 14/16 estimate 403261, CE gradient norm 1.17703, penalty gradient norm 1.83369e+08, 17.56 s
2026-11-25T10:33:38+00:00 [calibration] abstracts hessian_norm draw 15/16 estimate 208510, CE gradient norm 1.19373, penalty gradient norm 3.39152e+07, 17.59 s123345654 unmodified lines61626364656664656667686911 unmodified lines818283848586848586878889909189909192939494959697740 unmodified lines838839840841842843844845846847848145 unmodified lines99499599699299399499799899910001001100261 unmodified lines1064106510661062106310641067106810691070107110726 unmodified lines10791080108110771078107910821083108410851086108741 unmodified lines112911301131112711281129113211331134113511361132113311341137113811391140114111371138113911421143114411451146114740 unmodified lines118811891190119111921193119411951196119711981199120012011202120365 unmodified lines12691270127112571258125912721273127412751276126212631264127712781279128012811282120 unmodified lines1403140414051406140714081409141014111412141314141415141613971398139914171418141914201421142211 unmodified lines14341435143614171418141914371438143914401441144211 unmodified lines14541455145614371438143914571458145914601461146260 unmodified lines15231524152515261527152815291530153115321533209 unmodified lines17431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768295 unmodified lines2064206520662027202820292067206820692070207120322033203420722073207420752076207710 unmodified lines20882089209020912092209320942095209620972098209921002101210221035 unmodified lines2109211021112062206320642112211321142115211621171 unmodified line2119212021212072207320742122212321242125212621276 unmodified lines2134213521362087208820892137213821392140214121421 unmodified line2144214521462097209820992147214821492150215121022103210421522153215421552156210721082109215721582159216021612112211321142162216321642165216621172118211921672168216921702171212221232124217221732174217521762127212821292177217821792180218121822183218421852186218721882189219021912192219319 unmodified lines2213221422152216221722182219222022212222222359 unmodified lines228322842285222622862287{ "collection": "BurnyCoder/third-derivatives-in-language-model-training-6b067fb7d5ae3eca49ebb378", "git_revision": "a8a93b15217df9c328dcd46eceb931e341cddbfa", "git_revision": "809bfea05aed6dbbe848fc800cf09ef935523f6e", "repositories": { "BurnyCoder/thirdloss-arxiv-abstracts-2024": { "files": {54 unmodified lines "size": 7098 }, "explorer.js": { "git_blob": "9fcb175964d5391b110e5aa1a0c368993a672b6c", "sha256": "f864e188a35e62b595f1fd382dd34d2ed7e6f7ae275f613a2c37899cdb13bdab", "size": 17762 "git_blob": "76fa33ca5b2dd5a87c8c392a66971a5e7be2acc0", "sha256": "3142c81efe2857daade3f549d8820c656f5a4413e9519991415c6563ce32815c", "size": 18278 }, "figures/architecture.png": { "git_blob": "2c41c712a9edfcc9f53e1ac8f76e751e54dc8924",11 unmodified lines "size": 156490 }, "index.html": { "git_blob": "d8e22afb8e663422375b1a16fa1173836b31c9da", "sha256": "c3d8177ee2a6a8630119e8ffa748eaedc75dd050195f73169ccb52076a250220", "size": 8827 "git_blob": "f34264333ceb1b0fd0dec1f0814ab6b772e28aee", "sha256": "0f7a122e18ce737a2878064e3d62e4e8a678cb238804e1a8f389d5554d71247f", "size": 9173 }, "study.json": { "git_blob": "73960aedcab320dd73e89b65aaa8cc346878f726", "sha256": "808da90e2d2acafb75427861dec1ac1b94c0d52486ba6baeb156d062e7d49a12", "size": 334907 "git_blob": "450ebf1be137063c3252120d5e9a9d79fafeeb6f", "sha256": "d08a6182a373f8fd6c101873cd168ac82f4976711f81615d67999b501e7d993b", "size": 379457 } }, "revision": "4b1a82f77e3d74fc3ad349f2d76d69bacebf2776", "revision": "1ef0d0e1983fe64d18fd0a0118161e0e03d6ae2e", "type": "space" }, "BurnyCoder/thirdloss-pythia-410m-adapters": {740 unmodified lines "sha256": "1c73007c107dd521eed1fea4cd5cde00d25fca4863773228d18e29582eae50dd", "size": 7536 }, "logs/hybrid-implementation-release.log": { "git_blob": "37bbb4bdbd164007d9e8e84ddbdb5e73b2a11e1d", "sha256": "2ae7e37a0d60013de1b3d6870314f24554d6f4af83d0ce06b372b1eed3a9b1c6", "size": 79 }, "logs/hybrid-registration-release.log": { "git_blob": "2dafb6b7809fb1f853547c6521c01183524f3a75", "sha256": "4f3296506f987dce6ded9ce5cf76e91cc678cebb8c6f2c3565c584e32dddc3bd",145 unmodified lines "size": 19482 }, "logs/study-20261125T105025-confirmation.log": { "git_blob": "9f4a3e212887ebad8387d6ca5282d0a275d1bd10", "sha256": "7d0f997e96d844bb01225f2acda15fa064e01e62b94c4fe249bbd2d1a44a322e", "size": 30403 "git_blob": "1f62ae28845eddd788f46570012a73125a3b2635", "sha256": "1c13abe825e2bd8c3f93f19dbce229889dad1082f8f174c5760cbd69ccd0d873", "size": 32815 }, "logs/update-diagnostic-modelcard.log": { "git_blob": "86afaf365d1f2181f812d84b59017f771f2e9683",61 unmodified lines "size": 786 }, "research/README.md": { "git_blob": "0306dda8e0dcdb69e217dcd855497e08d3c34ed8", "sha256": "d0d2fd89185db70890a2ee8adacb4c5c7a130856b65f5b25f807c76b7c07d747", "size": 25741 "git_blob": "ec5382f432adf1c4ccb61b3100b468e56329c762", "sha256": "a1f53440f62982bb54408811b1446310b308d8097fa09170ef15c876337c1676", "size": 25971 }, "research/docs/data.md": { "git_blob": "1d0a74102cee4ed06b783085ca2ce823c6bf3a42",6 unmodified lines "size": 7098 }, "research/docs/explorer.js": { "git_blob": "9fcb175964d5391b110e5aa1a0c368993a672b6c", "sha256": "f864e188a35e62b595f1fd382dd34d2ed7e6f7ae275f613a2c37899cdb13bdab", "size": 17762 "git_blob": "76fa33ca5b2dd5a87c8c392a66971a5e7be2acc0", "sha256": "3142c81efe2857daade3f549d8820c656f5a4413e9519991415c6563ce32815c", "size": 18278 }, "research/docs/figures/architecture.png": { "git_blob": "2c41c712a9edfcc9f53e1ac8f76e751e54dc8924",41 unmodified lines "size": 1435 }, "research/docs/index.html": { "git_blob": "23df1a0a6a4faeed3ac2a3a5e154a4cb3072472b", "sha256": "c16b32ced77952ca14a3e36913183b36199a2adc0ce0b519cdc86aafd4ab8899", "size": 9057 "git_blob": "2321fd840e4a9af8570f7ae2a675a23b5f20d1a2", "sha256": "807bf1ef6cf2b38cf5eabdaa94469be783518dbd626c3e20b6a16f2f4f56106d", "size": 9403 }, "research/docs/runbook.md": { "git_blob": "938491e0017ce70a66a69c6784238cc4c809bbe5", "sha256": "69da6528aa791b7cd2fa84f0a97720b69476b7c4e1168eefe12154d72aff67f8", "size": 6842 "git_blob": "f8e79a6499887599a540813346dc2637fa66b899", "sha256": "78454674f04d677ab6aaebdcda7eced86dea98a08db3426848b6588ff5cc23dd", "size": 7624 }, "research/docs/study.json": { "git_blob": "73960aedcab320dd73e89b65aaa8cc346878f726", "sha256": "808da90e2d2acafb75427861dec1ac1b94c0d52486ba6baeb156d062e7d49a12", "size": 334907 "git_blob": "450ebf1be137063c3252120d5e9a9d79fafeeb6f", "sha256": "d08a6182a373f8fd6c101873cd168ac82f4976711f81615d67999b501e7d993b", "size": 379457 }, "research/docs/third-derivative-penalty.md": { "git_blob": "a62df59c3abcf3f4335575717346e26663e2d649",40 unmodified lines "sha256": "7e103ed8d5a8104b6a1384c8c002f3585af6b34b3728be2a44a8cd5f4de30e79", "size": 231 }, "research/reports/experiments/abstracts-pilot-s00-hessian_norm-r03-fp64/experiment.md": { "git_blob": "82e15b4581471fe5b1ac3cfe3ee8bd7a8edb161b", "sha256": "9b7975b0f39382b4d920544ff469bf60f936d949fbf848639825c29059a9036e", "size": 778 }, "research/reports/experiments/abstracts-pilot-s00-hessian_norm-r03-fp64/learnings.md": { "git_blob": "9df9dd986c35964f238cbf7c96b5b3014e4826f9", "sha256": "38dabca49ef1ebbbb543a3db3a8d196b6743d2eeb3297b5b744502984e2cdb58", "size": 103 }, "research/reports/experiments/abstracts-pilot-s00-third-r01-fp64/experiment.md": { "git_blob": "edbf6b5da8d0b4c286103409c23af2058f441256", "sha256": "fc1d5a71063755b96e70949cda383f7ab532f92c3f7821312856f018f10c9e48",65 unmodified lines "size": 231 }, "research/reports/experiments/experiments.md": { "git_blob": "ce69f559a5ef77cd9630d0ed6e5d8b832bc9e6dc", "sha256": "cff996c1c6fee59d3ab0484f92607adba3676c7de3da84bccf3c69e9f22aeae3", "size": 4540 "git_blob": "5294bed93e1ab3a5a93d1c5ee0537b9386a96bfe", "sha256": "a86b205ead9e74667d0707317c3142a54eca27e31ac5b09d84863c8ecfb2d4bb", "size": 4750 }, "research/reports/experiments/learnings.md": { "git_blob": "72421c07cc0fe4546162a66b4262534f7835aebc", "sha256": "be1751549daafd6da261e87134e19b02b15d8b7f57ab10f1eef696cb561eb380", "size": 5831 "git_blob": "d7da9ed30545dcc35dc930771c75a786694aebd2", "sha256": "015d83f31211a3da6db219c957952adcdc2d0519b5a251e29d2e0f40bdd664a0", "size": 5979 }, "research/reports/experiments/stories-control-s00-initial-r00/experiment.md": { "git_blob": "992585a6ffda93756c0d396ce1a64652b5db5e11",120 unmodified lines "sha256": "ee367dea7be8b4dea20e364c45b5203f0613c172e015260fd3470ec1b96f5ea9", "size": 7658 }, "research/reports/hybrid/results.md": { "git_blob": "eb779c2efa542e30c7c29e73bc074265b92d4417", "sha256": "26c3d81d0c6604f7b582dbf0abaae2002607b08764dbefba109c120483a8a66e", "size": 974 }, "research/reports/literature-review.md": { "git_blob": "60cb61940a961b869b09e18931fb885668994e62", "sha256": "b428342869af2fd26f05c2b2d2cfc14749a6c9021c62e9f20689d522cdc1ce00", "size": 7290 }, "research/reports/paper.pdf": { "git_blob": "64511cdc4b11581bae23da01a9222e263bd9ebbf", "sha256": "ea9d88ae77e5c6e0fc1ca3a2471cc22c984da452a0c745e54da3c2413892b16e", "size": 367444 "git_blob": "a931e877485713c653d22a976080b6ee0a151582", "sha256": "299f21af7f38a63a6eed35bb1db8f5c395b372b0d52211c9169143ff9566d89f", "size": 368636 }, "research/reports/plan.md": { "git_blob": "bbbef734559f38fba5d30195539a46a1249d11eb",11 unmodified lines "size": 5234 }, "research/reports/progress.md": { "git_blob": "b7a16c76e52bf18d71dd23f228023eac45b126aa", "sha256": "e5ea561eae1395361c0c11bd07c7fd730905cdf0298bd5a90a4d756a5f82ecf2", "size": 852 "git_blob": "cf73313918abb33772b33e11798f543143e61cfe", "sha256": "ae39a115a948ca9a9463a5b22fe37282ed0805cc0560bd88f02b755207b2f422", "size": 1512 }, "research/reports/reviews/adapter-verification.md": { "git_blob": "1ad4e5807c9e22c39721e238af4c640f4537cf66",11 unmodified lines "size": 1740 }, "research/reports/summary.md": { "git_blob": "47f1ca9e89e729cdaf2341daa9d0426ff051278c", "sha256": "318e27fdc1df105a0d35694c03cd99e2dbac62ec29eb27fb9c96d7acdfadbfd8", "size": 3422 "git_blob": "d7bc98088f9f6b54d0ae56c9326e3e91c8ceaecc", "sha256": "fd7849db270207850d60e0ea005938c018ec008fb54c3acf6d9c721b5de2b29c", "size": 3620 }, "research/results/abstracts-control-s00-initial-r00/config.json": { "git_blob": "0371479e1ad5f1c59b484eb112d315a86c82852d",60 unmodified lines "sha256": "151317f2000a774805912d4132cd2380f7367f9a7a17d4dd780a976fd0bc32a4", "size": 1337 }, "research/results/abstracts-pilot-s00-hessian_norm-r03-fp64/state.json": { "git_blob": "8086e40cd510ed553a36c470ff372e3eb8dffa9e", "sha256": "042ab8a28b5bb54efa9b636ebbec6d96b3e51502856b206b91609e282d64b93e", "size": 471 }, "research/results/abstracts-pilot-s00-third-r01-fp64/config.json": { "git_blob": "d394e2482f47ef5cdfbb831b4657c7e08297f727", "sha256": "fa7041dddeec4cb77c7ba0edd75284d10caca1d28d7509b171186ca479d87950",209 unmodified lines "sha256": "f61dcd6d63f102755b2705140b274b65fc870c3cded3961845ca5ed51e1a6d00", "size": 3010 }, "research/results/feasibility/abstracts.json": { "git_blob": "d9a1b3a8fddcb365ff62b5ad988ef880cf1ad85a", "sha256": "90742fa59a059061a6821c025826213178faaeedf6ef52030ddd897cafa199a8", "size": 892 }, "research/results/feasibility/one-week.json": { "git_blob": "34f8b18370817611959655e1f4a377985a6827f8", "sha256": "fa38370a2c7fcbe411cdb7ef4be2d8b144f9af2f103ba9dfeda4650176d95abf", "size": 3005 }, "research/results/feasibility/stories.json": { "git_blob": "ce046159f638f1cee4085da49a487524f53dafed", "sha256": "ca96ea2ec017c3d2ed24e390d910cb39010c82e387e63293aec1619dbbed33a5", "size": 875 }, "research/results/selection/abstracts.json": { "git_blob": "7b81072e24367e3e4d6ea187083bcaec649eab50", "sha256": "2fdcd45eb84f7e72fd555ad79f03705afcff12c36f35c1de6939049c41b04b7e", "size": 901 }, "research/results/selection/stories.json": { "git_blob": "a9a120bc0f8705fa86cbf57e032cc4229aab4517", "sha256": "e42c2bb8c67a89999fe7ac1e93371b36f9d7674abf05a3fc59ee4ac24c5795ad",295 unmodified lines "size": 86 }, "research/src/thirdloss/analysis.py": { "git_blob": "91447a2f032e2f8355768c95c7432865aac30760", "sha256": "5053445b9bdad9a54a911ea5c6446b3b83ac7007b44c17fa5de02012cfbf98fa", "size": 9425 "git_blob": "2a1f44b9ac9a3b28544aaaeb739195cfe02901ee", "sha256": "a3c6fed1e4c506513f521823a59ff21174010552948dc09094649412176b14d9", "size": 9767 }, "research/src/thirdloss/cli.py": { "git_blob": "19c3ea6719e20927b79907fe7133b7f20a735a89", "sha256": "6d503abc043b625e18586393c188149f2f5eeeb10f324fd1b777a5f78083f279", "size": 6500 "git_blob": "b7a8263e895229910a332a6799c8466361553dd3", "sha256": "465b770dc7f7b338dda93ba769b40379a0bfecfc3a4c71b396b8b6501284235b", "size": 6911 }, "research/src/thirdloss/data.py": { "git_blob": "9b06438a0bce64f8d491cd65156ebe8aa04e8916",10 unmodified lines "sha256": "928d4a2bf9fb55094604ab1b1b070dd8c9ed62e8dc7336dd303e6b4d24ce13c9", "size": 13687 }, "research/src/thirdloss/hybrid.py": { "git_blob": "bdc15e5b347dd33fb30b448e3c56851ecd9292b4", "sha256": "f234cc1fab1717f5367b6be66120b70ebceb6af974cc0909b4e6b22e86720b9e", "size": 11015 }, "research/src/thirdloss/hybrid_results.py": { "git_blob": "751742c1cb1ead31b4940e9c3b0c98a9c9fc17d4", "sha256": "34fb6108d9923fa1e4a71cc62768e51d2a70125661b5585beec576fd9211ab5c", "size": 3005 }, "research/src/thirdloss/live_hub.py": { "git_blob": "11be73956f4e0b255b14b88c6dbd7dbb08439ab6", "sha256": "27921980e4fe34b7de486028f531aff00c07ca7bc9037ffda3535984c15ffe40",5 unmodified lines "size": 8088 }, "research/src/thirdloss/objectives.py": { "git_blob": "0a21a218fd184f52c8a78600d401000c440769b9", "sha256": "dd7093a869ef790388a8e3a7a93def84f6525e63d8dc7a3de2d28fc8b26e64c7", "size": 10263 "git_blob": "3ac9a79d95a323ca426d2ac61b19fdaaae42e55a", "sha256": "fb95a9b1bf7afacfb91448672c5c898ea01828c113f3c1cfe1959d2fa3fc9cf3", "size": 10378 }, "research/src/thirdloss/overlap.py": { "git_blob": "869bfc3223ac8688e908d7e7f649db27397ded99",1 unmodified line "size": 5553 }, "research/src/thirdloss/penalties.py": { "git_blob": "4c39e88b2b7a27461936eb6f8b5baa49b09383c1", "sha256": "3ba3962d8459f5997e4652eb67f2f33b67eaf46e99e5486eafa643b3f6f1f7bb", "size": 2906 "git_blob": "c2edf32de7e74f25a8f0ba329d3ab68efa2f444d", "sha256": "bfbb5909d54d08bbe9ce000d4c15069d6f892f8faa68c4c85b890bd84774feaa", "size": 2955 }, "research/src/thirdloss/precision.py": { "git_blob": "476cc82ccc66376eeaff5c9461158b34ca39e7e2",6 unmodified lines "size": 6073 }, "research/src/thirdloss/progress.py": { "git_blob": "2a325d32b44c32b95b8a536ce995e2711bb46e04", "sha256": "dcdb06fbf348032e353aa8992f1f172eefe6700dad87ffe20fbf5599a645589c", "size": 6385 "git_blob": "7838665305394260f6a2b732aaf3b2ce1966604d", "sha256": "f81fdd562100bca5ba1b4e48f59e8c17eda4abc5b25c97f16371a10331a20253", "size": 6703 }, "research/src/thirdloss/records.py": { "git_blob": "a800de00d42944f13a89d8d2f91ce9b2103bbd45",1 unmodified line "size": 3710 }, "research/src/thirdloss/release.py": { "git_blob": "8fcf61fba92d559bc5287e854a2026b4a7994e2a", "sha256": "39fed695ed3456ff26e09daecb824992d4b0ce794fd979a04e4d77263c0c8d19", "size": 5413 "git_blob": "32e2066b92b46668ea83131885304384a57972e1", "sha256": "52e44d5475d3a90122ddc4ac510ab3ed1005d2f37f6bdf3aa78a85f2d7f3e01b", "size": 5807 }, "research/src/thirdloss/report_figures.py": { "git_blob": "eee1bf3f6b1e5a4720384b56391233e7cb983233", "sha256": "adb5b18ab15b590423fb1df93cc65f7e154c35075c7539853d8ede8273704eef", "size": 8948 "git_blob": "040404ddcb284b590508954c005a7c64bc6521e8", "sha256": "842999a32c58843e43a4f3e6d17789d00dc7ecd821e9458cc980f684ac1d4d59", "size": 10129 }, "research/src/thirdloss/report_paper.py": { "git_blob": "7c51066f66cb69717a20b993db8ebebed45ed472", "sha256": "0107f07ad0e976d27e0ab488be453ff81ed303399daec790210c0c0a4d2123b2", "size": 32824 "git_blob": "a8578227717db49c4d0f7c145f955fd06558b357", "sha256": "6389c2248b3e1c91b8435dea86800d74a99437e5d280380910ee832b0a710a0e", "size": 33672 }, "research/src/thirdloss/report_records.py": { "git_blob": "fd290cc837ec69b400901638c43922ee12959290", "sha256": "72393291fa68eff469921b9e2e4c03faf69b7bb69931e885bf9ce96eb60a596f", "size": 11950 "git_blob": "79ba864c4ab454780c970a90d6b9e26f77b81147", "sha256": "13f7f5ab6370b43f4a2310d88aafbb0d00a30f8eb837b203d38dac846790450e", "size": 13208 }, "research/src/thirdloss/reporting.py": { "git_blob": "6be68aed44353bf502b7191475852548a7efdc30", "sha256": "d6e9dcf919b532be23b5a5d3ee3660f8a19fa608667ac68a046654de84be9dbe", "size": 14923 "git_blob": "2fdb26036e3d1a74e2dd93338b601668cec9399f", "sha256": "d112ee9f740b6439edf08ab6fc5089de0063181427dcf83f8ea049db25ca7b4c", "size": 19498 }, "research/src/thirdloss/study.py": { "git_blob": "3b0954e5b52408a1262fcbc5b64d05b7051a6575", "sha256": "8fd00a89ddd0da145361e3cfa9c4058d3470e2a6c95c507b2daae5cf45d22fa6", "size": 10378 "git_blob": "e1678f1e03b6f22034f6e25ae276e89bfa52bb33", "sha256": "68c2544c8bd6ee2945ae07533af9009b622c836b70d127f2c44f4af0a0899369", "size": 10541 }, "research/src/thirdloss/train.py": { "git_blob": "2d36b6dd27bea2f7a4f2156a114cdc7833c8c82f", "sha256": "bdb23ca872251c63dec563106b104f3c60508398c60064ebe1f55954f851cb01", "size": 14095 "git_blob": "3c16d7419d10d1709d4a168ad7765909fbef77a6", "sha256": "09e60401938d182643ceb7cea3927ad6c0439d40d6f8cd3e1b2425c2e1206c3c", "size": 16614 }, "research/src/thirdloss/verification.py": { "git_blob": "4aa026d9ad8bcfd44856f2f8bd63e7d2a14c30ab", "sha256": "1b6a3e76f6aaa7785340fc73b67c0be0c986153b777f015359cfa4334636d95f", "size": 1305 }, "research/src/thirdloss/width.py": { "git_blob": "271ad17ba188a064e6ae5a98fa54281b72c55e8e", "sha256": "aabe0f894cb7d90650e6ede6e34bb684ca0a1442bec2b630d2ea13aeca821501", "size": 3357 }, "research/src/thirdloss/windows.py": { "git_blob": "2000a312e8326b97f88acead4b5c53e6d26eeab2", "sha256": "7dc423e2a4777184d60a209f5d3b884cc3f4a9d651aba769c5f940902cc73fee",19 unmodified lines "sha256": "6dadeaf5b08d9c2dbe1df2d24a247b23d005a0ededb280630c82f41845084bc5", "size": 3476 }, "research/tests/test_hybrid.py": { "git_blob": "5c3efb1bde12e02fc8fcfde30550ce56d831b9bf", "sha256": "ceef1eee885a8d47b0fd6df4bbb207f95f32e743cb2c2512c15ad99c982847e0", "size": 5225 }, "research/tests/test_reporting.py": { "git_blob": "8d35cec22ff32950b18690c8af5142d0b44bc644", "sha256": "6a144d3dbae968da797bb4765c8c37b1543abc9e54d32e88f6de8ef8d9218bf5",59 unmodified lines "type": "dataset" } }, "verified_at": "2026-11-25T10:28:23+00:00" "verified_at": "2026-11-25T10:33:39+00:00"}46 unmodified lines4748495050515253545556575859586061626346 unmodified lines<!-- RESULTS:START -->[Explore the results](https://burnycoder.github.io/llm-training-with-penalizing-rapid-changes-of-curvature-of-its-loss-with-derivative-of-hessian/) · [Hugging Face explorer](https://huggingface.co/spaces/BurnyCoder/thirdloss-explorer) · [Hugging Face collection](https://huggingface.co/collections/BurnyCoder/third-derivatives-in-language-model-training-6b067fb7d5ae3eca49ebb378) · [Paper](reports/paper.pdf) · [Run ledger](reports/experiments/experiments.md)
Recorded 22 runs, including 22 with a completed summary.Recorded 23 runs, including 22 with a completed summary.
**TinyStories.** Awaiting paired test results (0 of 8 full-horizon training triplets).
**Research abstracts.** Awaiting paired test results (0 of 8 full-horizon training triplets).
TinyStories hybrid follow-up: 0 of 48 full runs and 0 of 8 shared checkpoints complete. Geometric decision: awaiting eight paired width measurements. [Width measurements, scores and controls](reports/hybrid/results.md)
**TinyStories development pilot.** At 2,097,152 training targets, the third-order run recorded 0.00004 nats per target token lower against Ordinary AdamW, 0.00024 nats per target token lower against Trace + third derivative, 0.00175 nats per target token lower against Squared Hessian norm, 0.00032 nats per target token lower against Randomized gradient signs, 0.00034 nats per target token lower against Hessian trace. These are single-seed descriptions using strengths selected on development.
**Research abstracts development pilot.** At 65,536 training targets, the third-order run recorded 0.00091 nats per target token higher against Ordinary AdamW, 0.00074 nats per target token higher against Hessian trace. These are single-seed descriptions using initial pilot strengths.**Research abstracts development pilot.** At 65,536 training targets, the third-order run recorded 0.00030 nats per target token higher against Ordinary AdamW, 0.00027 nats per target token higher against Hessian trace. These are single-seed descriptions using strengths selected on development.
### Measured scores
14 unmodified lines1516171819202122232446 unmodified lines71727370747576777881 unmodified lines16016116215816316416516643 unmodified lines21021121220821321421521614 unmodified lines raw_third: ["Third-derivative norm estimate", "squared Frobenius estimate"], raw_trace: ["Hessian trace estimate", "signed trace estimate"], raw_hessian_norm: ["Squared Hessian norm estimate", "squared Frobenius estimate"], width: ["Directional width", "Euclidean weight distance"], width_probe_nll: ["Width-probe loss", "nats / target token"], curvature_rms: ["Rolling RMS curvature", "RMS Hessian eigenvalue estimate"], third_lambda: ["Third-derivative coefficient", "coefficient"], trace_lambda: ["Trace coefficient", "coefficient"], gradient_norm: ["Unclipped gradient norm", "Euclidean gradient norm"],};const axes = {tokens: "training target tokens", train_seconds: "training seconds", step: "optimizer steps"};const numeric = value => typeof value === "number" && Number.isFinite(value);46 unmodified linesfunction showTotals() { element("runs-count").textContent = number(study.runs.filter(isComplete).length, 0); for (const [field, target] of [["tokens", "tokens-count"], ["train_seconds", "hours-count"]]) { const values = study.runs.map(run => run[field]).filter(numeric); const values = study.runs.filter(run => numeric(run[field])).map(run => Math.max(0,run[field] - (run["inherited_" + field] || 0))); const total = values.reduce((a, b) => a + b, 0); element(target).textContent = values.length ? (field === "tokens" ? compact(total) : number(total / 3600, 2) + " h") : "—"; if (values.length) element(target).title = number(total, 0) + (field === "tokens" ? " training tokens" : " seconds");81 unmodified lines if (metric.endsWith("accuracy")) { low = 0; high = 100; } else { const pad = (high - low || Math.max(Math.abs(high) * .1, .01)) * .09; const pad = (high - low || Math.abs(high) * .1 || .01) * .09; low -= pad; high += pad; if (["dev_nll", "loss", "raw_third", "raw_hessian_norm"].includes(metric)) low = Math.max(0, low); }43 unmodified lines ctx.fillStyle = "white"; ctx.strokeStyle = methodColor(p.run.method); ctx.lineWidth = 2.3; ctx.beginPath(); ctx.arc(p.px, p.py, 4.7, 0, Math.PI * 2); ctx.fill(); ctx.stroke(); element("point").textContent = p.run.id + " · " + number(p.x, axis === "train_seconds" ? 1 : 0) + " " + axes[axis] + " · " + number(p.y, 4) + " " + metrics[metric][1]; " " + axes[axis] + " · " + (p.y !== 0 && Math.abs(p.y)<.0001 ? p.y.toExponential(4) : number(p.y, 4)) + " " + metrics[metric][1]; }}
48 unmodified lines49505152535455565740 unmodified lines98991009810110210310448 unmodified lines <option value="dev_accuracy">Development accuracy</option><option value="accuracy">Training accuracy</option> <option value="penalty">Weighted active penalty</option><option value="raw_third">Third-derivative norm estimate</option> <option value="raw_trace">Hessian trace estimate</option><option value="raw_hessian_norm">Squared Hessian norm estimate</option> <option value="width">Directional width</option><option value="width_probe_nll">Width-probe training NLL</option> <option value="curvature_rms">Rolling RMS curvature</option><option value="third_lambda">Third-derivative coefficient</option> <option value="trace_lambda">Trace coefficient</option><option value="gradient_norm">Unclipped gradient norm</option> </select></label> <label>Horizontal axis<select id="axis"><option value="tokens">Training tokens</option><option value="train_seconds">Training time</option><option value="step">Optimizer steps</option></select></label> </div>40 unmodified lines <p class="prose">Hochreiter and Schmidhuber proposed that among equally good training fits, flatter minima may generalize better. If weights can be rounded more coarsely and still fit, a good predictor can take fewer bits to describe. Here the test of generalization is how well the model predicts unseen tokens. <a href="https://people.idsia.ch/~juergen/fm/node1.html">Flat Minima (1997) ↗</a></p> <p class="prose">The Hessian describes local loss curvature. On active updates, two independent random sign vectors estimate how quickly that curvature changes for the next-token loss of two text windows. The derivatives cover all TinyStories decoder weights or only Pythia’s trainable attention adapters, including interactions between trainable weights.</p> <p class="prose">When moving away from a flat bottom makes curvature change faster, the third-derivative penalty can pull the weights back. A steep bowl with constant curvature receives zero penalty from this term. Whether the optimizer finds wider minima is a separate question from the measured next-token loss.</p> <p class="prose">A proposed TinyStories follow-up would keep the trace active and increase the weight on the third-derivative penalty once loss and recent curvature are low. Keeping that weight high could discourage later steps toward an edge where curvature changes rapidly. The experiment would compare the width retained with a fixed late start. <a href="https://github.com/BurnyCoder/llm-training-with-penalizing-rapid-changes-of-curvature-of-its-loss-with-derivative-of-hessian/blob/main/reports/plan.md#curvature-dependent-penalty-weight">Schedule and planned controls ↗</a></p> <p class="prose">The TinyStories hybrid follow-up keeps the trace active. Its adaptive arm raises the third-derivative coefficient when recent curvature and training loss fall. Use the hybrid phase and directional width or coefficient measurements above to compare the adaptive arm, fixed ramp and replay controls. <a href="https://github.com/BurnyCoder/llm-training-with-penalizing-rapid-changes-of-curvature-of-its-loss-with-derivative-of-hessian/blob/main/reports/hybrid/results.md">Widths, development scores and raw rays ↗</a></p> <img class="architecture" src="figures/penalty-directions.png" alt="Analytic loss curves. Trace and third-derivative penalties push in opposite directions at an asymmetric minimum. They pull displaced weights back in a flat quartic and give zero update in a steep quadratic." loading="lazy"> <p class="curve-note">Circles mark the ordinary loss minima. Arrows show downhill directions for each penalty. The vertical scales vary by panel. <a href="https://github.com/BurnyCoder/llm-training-with-penalizing-rapid-changes-of-curvature-of-its-loss-with-derivative-of-hessian/blob/main/docs/third-derivative-penalty.md#when-can-the-penalty-favor-a-wider-minimum">Worked examples and the basin-width bound ↗</a></p> <img class="architecture" src="figures/architecture.png" alt="TinyStories full-weight training and Pythia QKV adaptation feed next-token cross-entropy, a Hessian contraction, a third derivative and the regularized objective." loading="lazy">10 unmodified lines111213141516171810 unmodified lines
In another terminal, open the printed dashboard URL. The public explorer reads the last published results. The local dashboard reads running records. Accuracy is top-one token accuracy and NLL is in nats per target token. The training-time column excludes data preparation, checks, validation, checkpoint serialization and publication.
Use `uv run --locked thirdloss study --with-hybrid` for the two original stages plus the registered six-arm TinyStories follow-up. Once the TinyStories selection and calibration exist, `uv run --locked thirdloss hybrid` runs the follow-up alone. Add `--publish` to mirror each completed arm, optimizer state, unabridged logs, directional-width brackets and report to the project’s GitHub and Hugging Face repositories. Restart with the identical command. Branches inherit the same full-horizon AdamW moments, data position and lagged monitor. Select **hybrid** in the explorer and choose **Directional width** or **Third-derivative coefficient** to inspect a run. [Hybrid preregistration](../reports/hybrid/preregistration.md) · [Per-seed results](../reports/hybrid/results.md)
Run `uv run thirdloss study` to execute both stages, select strengths on development data, freeze all confirmatory checkpoints, and evaluate them. The owner's publishing workflow uses `uv run thirdloss study --publish`. This uploads fitted coordinates after each run and the study record after each training/evaluation. A local clone can omit the publishing flag. Repeating the same command resumes the last saved optimization step and skips completed runs. Checkpoints include optimizer state, random state and data cursor. The corpus manifests and run configuration must match. [Data and leakage checks](data.md) · [Preregistered run matrix](../reports/planned-runs.md)
Use `uv run thirdloss report` to regenerate the README results, PDF, figures, experiment notes, progress and explorer from `results/`. Use `uv run thirdloss progress` for current status. `uv run thirdloss evaluate RUN_ID` verifies the registered weight digest and test split before scoring a frozen run. Both tokenizers are stored alongside their stage data. Full untruncated generated token IDs, prompts, reference continuations and outputs are in each run's `samples.jsonl`. Timestamped session logs are stored locally under `logs/`.1234567891011# Research abstracts · Squared Hessian norm
Run `abstracts-pilot-s00-hessian_norm-r03-fp64` · [raw records](../../../results/abstracts-pilot-s00-hessian_norm-r03-fp64/) · [registered design](../../preregistration.md)
| Stage | Method | Phase | Seed | Ratio | Train tokens | Dev NLL | Test NLL | Tokens/s | Status || --- | --- | --- | --- | --- | --- | --- | --- | --- | --- || Research abstracts | Squared Hessian norm | pilot | 0 | 0.030 | — | — | — | — | initializing |
Training time is — seconds. Peak allocated GPU memory is — MiB. Development token accuracy is —. Test token accuracy is —.
[Design and hyperparameter rationale](../../planned-runs.md) · [Saved configuration](../../../results/abstracts-pilot-s00-hessian_norm-r03-fp64/config.json)12345# Run learnings
A development observation is pending.
[Experiment and source records](experiment.md)8 unmodified lines91011121314158 unmodified lines| [abstracts-control-s00-initial-r00](./abstracts-control-s00-initial-r00/experiment.md) | Research abstracts | Initial checkpoint | control | 0 | 0.000 | 0 | 3.2517 | — | 0 | complete || [abstracts-control-s00-unigram-r00](./abstracts-control-s00-unigram-r00/experiment.md) | Research abstracts | Unigram | control | 0 | 0.000 | 0 | 7.3306 | — | 0 | complete || [abstracts-pilot-s00-ce-r00](./abstracts-pilot-s00-ce-r00/experiment.md) | Research abstracts | Ordinary AdamW | pilot | 0 | 0.000 | 65,536 | 3.1139 | — | 1,659 | complete || [abstracts-pilot-s00-hessian_norm-r03-fp64](./abstracts-pilot-s00-hessian_norm-r03-fp64/experiment.md) | Research abstracts | Squared Hessian norm | pilot | 0 | 0.030 | — | — | — | — | initializing || [abstracts-pilot-s00-third-r01-fp64](./abstracts-pilot-s00-third-r01-fp64/experiment.md) | Research abstracts | Third derivative | pilot | 0 | 0.010 | 65,536 | 3.1142 | — | 189 | complete || [abstracts-pilot-s00-third-r03](./abstracts-pilot-s00-third-r03/experiment.md) | Research abstracts | Third derivative | diagnostic | 0 | 0.030 | 65,536 | 3.1168 | — | 907 | complete || [abstracts-pilot-s00-third-r03-fp64](./abstracts-pilot-s00-third-r03-fp64/experiment.md) | Research abstracts | Third derivative | pilot | 0 | 0.030 | 65,536 | 3.1149 | — | 188 | complete |11 unmodified lines121314151617181911 unmodified lines
- [abstracts-pilot-s00-ce-r00](./abstracts-pilot-s00-ce-r00/experiment.md) — Development NLL changed by -0.1172 nats per target token from 4,096 to 65,536 training targets. Attribution to the regularizer uses matched comparisons across seeds.
- [abstracts-pilot-s00-hessian_norm-r03-fp64](./abstracts-pilot-s00-hessian_norm-r03-fp64/experiment.md) — A development observation is pending.
- [abstracts-pilot-s00-third-r01-fp64](./abstracts-pilot-s00-third-r01-fp64/experiment.md) — Development NLL changed by -0.1168 nats per target token from 4,096 to 65,536 training targets. Attribution to the regularizer uses matched comparisons across seeds.
- [abstracts-pilot-s00-third-r03](./abstracts-pilot-s00-third-r03/experiment.md) — This original FP32 adapter run is preserved as a numerical diagnostic. The same-probe full-checkpoint audit found substantial rounding error in both the penalty and its training gradient. Strength selection and confirmatory inference use separately named FP64 derivative runs. The run ledger records 1 interrupted attempt(s).123456789# Hybrid schedules on TinyStories
TinyStories hybrid follow-up: 0 of 48 full runs and 0 of 8 shared checkpoints complete. Geometric decision: awaiting eight paired width measurements.
[Frozen protocol and decision rule](preregistration.md) · [Interactive measurement and run selector](../../docs/index.html#curves)
Two-sided directional width is measured in the original Euclidean weight coordinates at a fixed increase of 0.1 nats per target. Each linked JSON contains all 32 rays and their brackets. A missing upper bound means that the search reached its maximum radius before crossing.
The completed branches reused 0 targets of optimization compared with independently training each branch from initialization. The replay permutation couples different seeds through their coefficient histories. The sign-test reference for this comparison assumes exchangeable independent pair signs; that assumption is approximate here. All raw pairs are reported for inspection.12334565 unmodified lines121314151516171819202122232425262728293031# Study progress
Updated 2026-11-25T10:27:58+00:00.Updated 2026-11-25T10:33:28+00:00.
21 training/control records and 0 final evaluations are complete. This is 17.5% of 120 planned model milestones.
5 unmodified lines
Statistical status: pending. Awaiting confirmatory runs.
**abstracts** has 9 completed runs. The next milestone is determined by the run matrix.**abstracts** has 9 completed runs. Current records: abstracts-pilot-s00-hessian_norm-r03-fp64 (initializing, 0 targets).
Pilot rates project 9.54 remaining confirmation GPU-hours, excluding validation, exports and uploads.
Statistical status: pending. Awaiting confirmatory runs.
## One-week feasibility
At the pre-test check on 2026-11-25T10:33:28+00:00, pilot timings projected 22.50 hours for all confirmatory training and scoring, with 141.73 hours of the week available for secondary pilots, setup, publication and interruptions. [Timing and GPU memory by method](../results/feasibility/one-week.json)
## TinyStories hybrid follow-up
0 of 48 full runs and 0 of 8 shared checkpoints complete. awaiting eight paired width measurements. [Per-seed widths and development scores](hybrid/results.md)
## Monitoring
Inspect runs lasting over 10, 30 and 60 minutes at 5, 15 and 30 minute intervals respectively. The live dashboard refreshes between those checks. [Study design](plan.md) · [Run matrix](planned-runs.md) · [Experiment ledger](experiments/experiments.md)1233456789101112131415161517181920# Study summary
Recorded 22 runs, including 22 with a completed summary.Recorded 23 runs, including 22 with a completed summary.
**TinyStories.** Awaiting paired test results (0 of 8 full-horizon training triplets).
**Research abstracts.** Awaiting paired test results (0 of 8 full-horizon training triplets).
TinyStories hybrid follow-up: 0 of 48 full runs and 0 of 8 shared checkpoints complete. Geometric decision: awaiting eight paired width measurements. [Hybrid outcomes](hybrid/results.md)
[Interactive explorer](https://burnycoder.github.io/llm-training-with-penalizing-rapid-changes-of-curvature-of-its-loss-with-derivative-of-hessian/) · [Per-run ledger](experiments/experiments.md) · [Preregistration](preregistration.md) · [Paper](paper.pdf)
## Development observations
**TinyStories development pilot.** At 2,097,152 training targets, the third-order run recorded 0.00004 nats per target token lower against Ordinary AdamW, 0.00024 nats per target token lower against Trace + third derivative, 0.00175 nats per target token lower against Squared Hessian norm, 0.00032 nats per target token lower against Randomized gradient signs, 0.00034 nats per target token lower against Hessian trace. These are single-seed descriptions using strengths selected on development.
**Research abstracts development pilot.** At 65,536 training targets, the third-order run recorded 0.00091 nats per target token higher against Ordinary AdamW, 0.00074 nats per target token higher against Hessian trace. These are single-seed descriptions using initial pilot strengths.**Research abstracts development pilot.** At 65,536 training targets, the third-order run recorded 0.00030 nats per target token higher against Ordinary AdamW, 0.00027 nats per target token higher against Hessian trace. These are single-seed descriptions using strengths selected on development.
## Measured scores
1234567891011121314151617{ "id": "abstracts-pilot-s00-hessian_norm-r03-fp64", "stage": "abstracts", "method": "hessian_norm", "phase": "pilot", "seed": 0, "ratio": 0.03, "token_budget": 65536, "batch_windows": 8, "context": 128, "data_manifest_sha256": "0638bd23a7d1dc3ecb9138074ecd922211df2637f60736ddfab7e9aec0b3ccb9", "microbatch": 2, "derivative_dtype": "float64", "derivative_device": "cpu", "status": "initializing", "timestamp": "2026-11-25T10:28:28+00:00"}12345678910111213141516171819202122232425262728{ "stage": "abstracts", "arms": [ { "method": "third", "pilot_run": "abstracts-pilot-s00-third-r01-fp64", "tokens_per_sec": 189.1219465392862, "peak_vram_mb": 2346.30029296875, "projected_confirm_hours": 6.160493088000351 }, { "method": "ce", "pilot_run": "abstracts-pilot-s00-ce-r00", "tokens_per_sec": 1658.777719349496, "peak_vram_mb": 2346.30029296875, "projected_confirm_hours": 0.7023752675562476 }, { "method": "trace", "pilot_run": "abstracts-pilot-s00-trace-r01-fp64", "tokens_per_sec": 434.53219157783866, "peak_vram_mb": 2346.30029296875, "projected_confirm_hours": 2.6812385066659448 } ], "projected_confirm_training_hours": 9.544106862222543, "basis": "Pilot training time. Data, calibration, evaluation, checkpoint and upload overhead are additional."}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677{ "computed_at": "2026-11-25T10:33:28+00:00", "first_training_update_at": "2026-11-25T06:47:20+00:00", "arms": [ { "stage": "stories", "method": "third", "pilot_run": "stories-pilot-s00-third-r01", "pilot_tokens_per_second": 42480.876701096255, "peak_allocated_mib": 608.21533203125, "pilot_loop_seconds": 61.195636899999954, "pilot_finalizing_seconds": 5.0, "projected_test_seconds_per_run": 27.299253957629713, "projected_hours_all_seeds": 1.1596985536836208 }, { "stage": "stories", "method": "ce", "pilot_run": "stories-pilot-s00-ce-r00", "pilot_tokens_per_second": 123871.07334510093, "peak_allocated_mib": 608.21533203125, "pilot_loop_seconds": 25.10114049999902, "pilot_finalizing_seconds": 4.0, "projected_test_seconds_per_run": 20.474440468222284, "projected_hours_all_seeds": 0.5006301432626987 }, { "stage": "stories", "method": "trace", "pilot_run": "stories-pilot-s00-trace-r01", "pilot_tokens_per_second": 73185.43191029143, "peak_allocated_mib": 608.21533203125, "pilot_loop_seconds": 36.05276049999884, "pilot_finalizing_seconds": 5.0, "projected_test_seconds_per_run": 27.299253957629713, "projected_hours_all_seeds": 0.7127140843502676 }, { "stage": "abstracts", "method": "third", "pilot_run": "abstracts-pilot-s00-third-r01-fp64", "pilot_tokens_per_second": 189.1219465392862, "peak_allocated_mib": 2346.30029296875, "pilot_loop_seconds": 367.77427570000145, "pilot_finalizing_seconds": 705.0, "projected_test_seconds_per_run": 670.2049821323709, "projected_hours_all_seeds": 9.594220417183072 }, { "stage": "abstracts", "method": "ce", "pilot_run": "abstracts-pilot-s00-ce-r00", "pilot_tokens_per_second": 1658.777719349496, "peak_allocated_mib": 2346.30029296875, "pilot_loop_seconds": 60.80243370000244, "pilot_finalizing_seconds": 715.0, "projected_test_seconds_per_run": 679.7930362401302, "projected_hours_all_seeds": 4.180472235200333 }, { "stage": "abstracts", "method": "trace", "pilot_run": "abstracts-pilot-s00-trace-r01-fp64", "pilot_tokens_per_second": 434.53219157783866, "peak_allocated_mib": 2346.30029296875, "pilot_loop_seconds": 172.96475099999952, "pilot_finalizing_seconds": 755.0, "projected_test_seconds_per_run": 718.1452526711671, "projected_hours_all_seeds": 6.348585023713697 } ], "hours_left_in_week": 164.23111111111112, "projected_confirmation_and_scoring_hours": 22.49632045739369, "hours_available_for_other_work": 141.73479065371743, "fits_measured_budget": true, "scope": "All 48 confirmations and test evaluations. Remaining secondary pilots, process startup, publishing, downtime and retries use the reported headroom. Times are observational projections."}12345678910111213141516171819202122232425262728293031323334353637383940414243{ "stage": "abstracts", "candidates": { "trace": [ { "ratio": 0.01, "nll": 3.113974483425786, "run": "abstracts-pilot-s00-trace-r01-fp64" }, { "ratio": 0.03, "nll": 3.11411782781259, "run": "abstracts-pilot-s00-trace-r03-fp64" }, { "ratio": 0.1, "nll": 3.11428017700472, "run": "abstracts-pilot-s00-trace-r10-fp64" } ], "third": [ { "ratio": 0.01, "nll": 3.1142473177545655, "run": "abstracts-pilot-s00-third-r01-fp64" }, { "ratio": 0.03, "nll": 3.1148602603458824, "run": "abstracts-pilot-s00-third-r03-fp64" }, { "ratio": 0.1, "nll": 3.116312030307629, "run": "abstracts-pilot-s00-third-r10-fp64" } ] }, "ratios": { "trace": 0.01, "third": 0.01 }}26 unmodified lines2728293031323334353132363738394021 unmodified lines6263646566676869707172737475109 unmodified lines18518618717517617717818818919019119226 unmodified lines other = records[seed, baseline]["test_nll"] pairs.append({"seed": seed, "third_nll": third, "baseline_nll": other, "delta": third - other})
return paired_sign(pairs)
def paired_sign(pairs, *, larger=False): """Exact conditional paired sign test and symmetric order-statistic median interval.""" ordered = sorted(pair["delta"] for pair in pairs) wins = sum(d < 0 for d in ordered) losses = sum(d > 0 for d in ordered) wins = sum(d > 0 if larger else d < 0 for d in ordered) losses = sum(d < 0 if larger else d > 0 for d in ordered) discordant = wins + losses # Exact upper binomial tail under fair signs conditional on discordant pairs. # https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.binomtest.html21 unmodified lines }
def holm(comparisons): """Adjust a prespecified family using Holm's monotone step-down procedure.""" maximum = 0. for index,row in enumerate(sorted(comparisons.values(),key=lambda item:item["p_raw"])): maximum = max(maximum,row["p_raw"]*(len(comparisons)-index)) row["p_holm"] = min(1.,maximum)
def _time_match(seed, records, clock="train_seconds"): """Look backward from the shortest complete training run to actual validation evaluations.""" runs = {method: records[seed, method] for method in _METHODS}109 unmodified lines comparisons = {baseline: _comparison(records, baseline) for baseline in ("ce", "trace")} # Holm step-down: adjusted p-values are monotone in raw-p rank; ties receive equal values. # https://stat.ethz.ch/R-manual/R-devel/library/stats/html/p.adjust.html running_max = 0.0 for index, stats in enumerate(sorted(comparisons.values(), key=lambda item: item["p_raw"])): running_max = max(running_max, stats["p_raw"] * (len(comparisons) - index)) stats["p_holm"] = min(1.0, running_max) holm(comparisons) for stats in comparisons.values(): if stats["p_holm"] <= 0.05: stats["interpretation"] = "improved" elif stats["median_ci"][0] > 0:35 unmodified lines3637383939404142434445454647484950515 unmodified lines575859586061626358 unmodified lines12212312412312512612712812913013113212713313413513635 unmodified lines p = argparse.ArgumentParser(description=__doc__) p.add_argument("--project",type=Path,default=Path.cwd()) parsers = p.add_subparsers(dest="action",required=True) for action in ("prepare","train","study","freeze","evaluate","report","dashboard","publish","audit-hub","progress","verify"): for action in ("prepare","train","study","hybrid","freeze","evaluate","report","dashboard","publish","audit-hub","progress","verify"): sub = parsers.add_parser(action) if action in {"prepare","study"}: sub.add_argument("--stage",choices=(*HORIZONS,"both"),default="both") if action in {"train","freeze"}: sub.add_argument("--stage",choices=HORIZONS,required=True) if action in {"train","study","evaluate"}: if action in {"train","study","hybrid","evaluate"}: sub.add_argument("--device",default="cuda") if action=="study": sub.add_argument("--with-hybrid",action="store_true",help="Include the registered TinyStories hybrid follow-up on the same GPU") if action=="verify": sub.add_argument("--pretrained",action="store_true",help="Also compare a full joint derivative on the prepared adapter training corpus") sub.add_argument("--reference",action="store_true",help="Compute the FP64 pretrained reference using the original CUDA signs")5 unmodified lines sub.add_argument("--seed",type=int,default=0) sub.add_argument("--ratio",type=float,default=0.03) sub.add_argument("--microbatch",type=int) if action in {"train","study","evaluate"}: if action in {"train","study","hybrid","evaluate"}: sub.add_argument("--publish",action="store_true",help="Publish results to the configured project accounts") if action=="evaluate": sub.add_argument("run_id")58 unmodified lines return from .records import setup_device device = setup_device(args.device) if args.action=="study": if args.action in {"study","hybrid"}: from contextlib import nullcontext from .live_hub import publish_live with publish_live(project,storage) if args.publish else nullcontext(): if args.action=="hybrid": from .hybrid import run_hybrids run_hybrids(project,storage,device,args.publish) else: run_study(project,storage,stages,device,args.publish) run_study(project,storage,stages,device,args.publish,with_hybrid=args.with_hybrid) return if args.action=="evaluate": summary = evaluate_one(project,storage,args.run_id,device)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215"""Registered TinyStories trace/T3 schedules, common optimizer trunks and train-only probes."""
import bisectimport mathimport statisticsimport time
from .models import build_model, logits_of, token_loss, trainable_digestfrom .objectives import probe_gradient, vector_normfrom .penalties import hessian_vector, inner, random_signsfrom .records import BATCHES, CONTEXT, HORIZONS, read_json, run_name, sha256, write_jsonfrom .width import measure_widthfrom .windows import TrainingWindows, generator, probe_rows
SEEDS = range(21,29)SWITCH, RAMP_END, END = 2048, 3072, 4096STREAMS = {"trace":827,"third":919}
def donor_seed(seed): """Permute adaptive schedules cyclically across all eight independent receivers.""" return 21 + (seed - 22) % len(SEEDS)
class HybridSchedule: """Determine each detached coefficient from the already completed observations."""
def __init__(self, arm, alpha, cap, delta=0., replay=()): self.arm, self.alpha, self.cap, self.delta = arm,alpha,cap,delta self.replay = list(replay) self.replay_steps = [row[0] for row in self.replay] self.q, self.nll, self.changes = [],[],[] self.reference, self.eligible, self.weight, self.at_zero = None,False,0.,0
def state(self): """Store Python scalars/lists so the ordinary weights-only checkpoint can contain them.""" return {key:getattr(self,key) for key in ("q","nll","changes","reference","eligible","weight","at_zero")}
def load(self, state): for key in self.state(): setattr(self,key,state[key])
def observe(self, q, loss): if not (math.isfinite(q) and q>=0 and math.isfinite(loss)): raise FloatingPointError("Nonfinite hybrid curvature or training loss") self.q = (self.q+[q])[-8:] self.nll = (self.nll+[loss])[-8:]
def rms(self): return math.sqrt(statistics.mean(self.q)) if self.q else None
def fix_reference(self): if len(self.q)!=8 or not self.rms(): raise ValueError("The branch reference requires eight measurements and positive RMS curvature") self.reference = self.rms()
def coefficients(self, step): """Step is the number of completed updates. No current/future loss enters its rule.""" ramp = min(1.,max(0.,(step-SWITCH)/(RAMP_END-SWITCH))) trace = self.alpha weight = 0. if self.arm=="always": weight = self.cap elif self.arm=="late": weight = self.cap*ramp elif self.arm=="strong": trace += self.delta*ramp elif self.arm=="adaptive" and step>=SWITCH: if self.reference is None: raise ValueError("Adaptive suffix is missing its pre-branch curvature reference") self.eligible |= len(self.q)==8 and statistics.mean(self.nll)<=4. if self.eligible: weight = max(self.weight,self.cap*max(0.,1.-self.rms()/self.reference)) elif self.arm=="replay": ix = bisect.bisect_right(self.replay_steps,step)-1 weight = self.replay[ix][1] if ix>=0 else 0. if weight!=self.weight or not self.changes: self.changes.append([step,weight]) self.weight = weight self.at_zero += int(weight==0.) return {"trace":trace,"third":weight}
class HybridProtocol: """Couple a schedule to its checkpoints, independently addressed curvature and width probes."""
def __init__(self, project, storage, config, replay): self.output = project/"results"/config["id"] self.train_file = storage/"data"/"stories"/"train.bin" self.schedule = HybridSchedule(config["method"],config["alpha"],config["cap"],config.get("delta",0.),replay) self.parent = storage/"checkpoints"/config["parent"]/"latest.pt" if "parent" in config else None self.parent_output = project/"results"/config["parent"] if self.parent else None self.seed = config["seed"]
def monitor(self, model, parameters, inputs, targets, step, training_loss): """Estimate ||H||²_F/d on the same pair of windows with a separate random direction.""" if (step+1)%16: return {} rows = probe_rows(self.seed,step,len(inputs)) loss = token_loss(logits_of(model,inputs[rows]),targets[rows]) signs = random_signs(parameters,generator(inputs.device,self.seed,step,937)) hz = hessian_vector(loss,parameters,signs,create_graph=False) q = float(inner(hz,hz))/sum(p.numel() for p in parameters) self.schedule.observe(q,float(training_loss)) if step+1==SWITCH: self.schedule.fix_reference() return {"curvature_q":q,"curvature_rms":self.schedule.rms(), "monitor_mean_nll":statistics.mean(self.schedule.nll),"reference_rms":self.schedule.reference}
def checkpoint_width(self, model, step): """Write every ray and detect stale results when resuming around a width checkpoint.""" if step not in (SWITCH,RAMP_END,END): return path = self.output/f"width-{step}.json" origin = self.parent_output/f"width-{step}.json" if self.parent and step==SWITCH else path if origin.exists(): record = read_json(origin) if record["weights_sha256"]!=trainable_digest(model): raise ValueError("Stored width was taken on different weights") if origin!=path: write_json(path,record) return if origin!=path: raise FileNotFoundError("The parent trunk must complete its width measurement") device = next(model.parameters()).device inputs,targets = TrainingWindows(self.train_file,88731,8).get(0,device) stats = measure_width(model,lambda: token_loss(logits_of(model,inputs),targets)) write_json(path,{"step":step,"tokens":step*CONTEXT*BATCHES["stories"],**stats}) print(f"Width after {step} updates: {stats['width']}, {stats['censored_rays']} censored rays",flush=True)
def finish(self, steps): schedule = self.schedule write_json(self.output/"schedule.json",{"changes":schedule.changes,"zero_steps":schedule.at_zero, "steps":steps,"reference_rms":schedule.reference,"eligible":schedule.eligible, "final_third_lambda":schedule.weight,"steps_at_cap": sum((following[0]-current[0]) for current,following in zip(schedule.changes,schedule.changes[1:]+[[steps,None]]) if current[1]==schedule.cap)})
def match_stronger_trace(project,storage,trunk,cap,device): """Match the median per-draw unscaled gradient magnitude at the common checkpoint.""" from safetensors.torch import load_file from .study import weights_file seed = trunk["seed"] path = project/"results"/"hybrid"/"calibration"/f"seed-{seed}.json" if path.exists(): existing = read_json(path) if existing["parent_weights_sha256"]!=trunk["weights_sha256"] or existing["cap"]!=cap: raise ValueError("Stronger-trace calibration used different weights or cap") return existing["delta"] started = time.perf_counter() model = build_model("stories",seed,device,storage) model.load_state_dict(load_file(str(weights_file(storage,trunk))),strict=True) params = tuple(model.parameters()) windows = TrainingWindows(storage/"data"/"stories"/"train.bin",188701+seed,BATCHES["stories"]) draws = [] for step in range(16): x,y = windows.get(step,device) norms = {} for kind in ("trace","third"): _,gradient = probe_gradient(model,params,x,y,kind,188701+seed,step,stream=STREAMS[kind]) norms[kind] = float(vector_norm(gradient)) del gradient if any(not (0<n<float("inf")) for n in norms.values()): raise FloatingPointError("Nonpositive or nonfinite branch calibration norm") draws.append({"draw":step,**norms,"ratio":norms["third"]/norms["trace"]}) delta = cap*statistics.median(r["ratio"] for r in draws) write_json(path,{"parent_weights_sha256":trunk["weights_sha256"],"seed":seed,"cap":cap, "draws":draws,"delta":delta,"calibration_seconds":time.perf_counter()-started}) return delta
def run_hybrids(project,storage,device,publish): """Run each trunk once; delay seed 21 replay until seed 28 has published its schedule.""" from .study import milestone from .train import run_config selected = read_json(project/"results"/"selection"/"stories.json")["ratios"] if any(selected[k]!=.01 for k in STREAMS): raise ValueError("Hybrid protocol requires the registered TinyStories 1% selection") weights = {k:selected[k]*read_json(project/"results"/"calibration"/f"stories-{k}.json")["unit_lambda"] for k in STREAMS} def run(seed,arm): phase = "branch" if arm=="trunk" else "hybrid" name = lambda s,m,p: run_name("stories",m,p,s,.01) config = {"stage":"stories","phase":phase,"id":name(seed,arm,phase),"method":arm,"seed":seed, "ratio":.01,"token_budget":HORIZONS["stories"]//2 if arm=="trunk" else HORIZONS["stories"], "batch_windows":BATCHES["stories"],"context":CONTEXT,"schedule_steps":END, "protocol":"hybrid-v1","alpha":weights["trace"],"cap":weights["third"]} replay = [] if arm not in {"trunk","always"}: parent = name(seed,"trunk","branch") trunk = read_json(project/"results"/parent/"summary.json") if trunk["steps"]!=SWITCH or trunk["seed"]!=seed: raise ValueError("Incomplete or unmatched branching checkpoint") config.update(parent=parent,parent_weights_sha256=trunk["weights_sha256"], inherited_tokens=trunk["tokens"],inherited_train_seconds=trunk["train_seconds"], parent_restart_sha256=sha256(storage/"checkpoints"/parent/"latest.pt")) if arm=="strong": config["delta"] = match_stronger_trace(project,storage,trunk,config["cap"],device) if arm=="replay": donor = name(donor_seed(seed),"adaptive","hybrid") path = project/"results"/donor/"schedule.json" if read_json(project/"results"/donor/"summary.json")["steps"]!=END: raise ValueError("The entire donor schedule must be available before replay") config.update(donor=donor,donor_schedule_sha256=sha256(path)) replay = read_json(path)["changes"] row = run_config(project,storage,config,device,protocol=HybridProtocol(project,storage,config,replay)) milestone(project,storage,row,publish) for seed in SEEDS: for arm in ("trunk","adaptive","late","trace","strong","always"): run(seed,arm) if seed!=SEEDS.start: run(seed,"replay") run(SEEDS.start,"replay")1234567891011121314151617181920212223242526272829303132333435363738394041424344454647"""Summarize measured follow-up geometry independently of the two frozen test comparisons."""
import math
from .analysis import holm, paired_sign
def hybrid_results(runs): """Keep every arm, all horizon-matched pairs and right-censored outcomes in the record.""" named = {(r["seed"],r["method"]):r for r in runs if r.get("phase")=="hybrid" and r.get("finished_at")} trunks = {r["seed"]:r for r in runs if r.get("phase")=="branch" and r.get("finished_at")} comparisons,pairs = {},[] for baseline in ("late","replay","trace","strong","always"): finite_pairs = [] for seed in range(21,29): adaptive,other = named.get((seed,"adaptive")),named.get((seed,baseline)) if not (adaptive and other): continue if adaptive["tokens"]!=other["tokens"] or adaptive["tokens"]!=2**24: raise ValueError("Hybrid comparisons require full, equal token budgets") if (adaptive["initial_trainable_sha256"]!=other["initial_trainable_sha256"] or adaptive["data_manifest_sha256"]!=other["data_manifest_sha256"]): raise ValueError("Hybrid comparisons require paired initialization and the same corpus") values = [r["widths"][str(step)] for r in (adaptive,other) for step in (2048,4096)] a0,a1,b0,b1 = values if baseline!="always" and (adaptive["parent_restart_sha256"]!=other["parent_restart_sha256"] or a0["weights_sha256"]!=b0["weights_sha256"]): raise ValueError("Hybrid branches do not share the same AdamW checkpoint and width baseline") delta = None if any(v["width"] is None for v in values) else (a1["width"]-a0["width"])-(b1["width"]-b0["width"]) row = {"seed":seed,"comparator":baseline,"delta":delta, "train_probe_nll_delta":a1["baseline_nll"]-b1["baseline_nll"], "comparable_fit":abs(a1["baseline_nll"]-b1["baseline_nll"])<=.02, "dev_nll_delta":adaptive["dev_nll"]-other["dev_nll"]} pairs.append(row) if delta is not None and math.isfinite(delta): finite_pairs.append(row) if baseline in {"late","replay"} and len(finite_pairs)==8: comparisons[baseline] = paired_sign(finite_pairs,larger=True) if len(comparisons)==2: holm(comparisons) status = "both width comparisons passed" if all(c["p_holm"]<=.05 for c in comparisons.values()) else "width advantage inconclusive" else: status = "width endpoint censored" if len(named)==48 else "awaiting eight paired width measurements" return {"completed_arms":len(named),"completed_trunks":len(trunks),"status":status,"pairs":pairs, "comparisons":comparisons,"shared_training_tokens_saved":sum( max(0,sum((s,m) in named for m in ("adaptive","late","trace","strong","replay"))-1)*r["tokens"] for s,r in trunks.items())}70 unmodified lines717273747475767677787978 unmodified lines15815916016116116216316416516616716816816917017117270 unmodified lines return widen_pythia(build_model(stage,seed,adapter_derivative_device(),storage))
def probe_gradient(model, parameters, inputs, targets, kind, seed, step, replica=None):def probe_gradient(model, parameters, inputs, targets, kind, seed, step, replica=None, *, stream=827): """Differentiate the sampled penalty, including the fourth-order contraction.""" rng = generator(inputs.device, seed, step, 827) rng = generator(inputs.device, seed, step, stream) rows = probe_rows(seed, step, len(inputs)) if replica is not None: # All arms draw the original CUDA signs. Only the arithmetic and storage of78 unmodified lines return result
def add_penalty(model, parameters, inputs, targets, coefficients, method, seed, step, replica=None):def add_penalty(model, parameters, inputs, targets, coefficients, method, seed, step, replica=None, *, streams=None): """Add the gated derivative contribution to already-accumulated CE gradients.""" telemetry = {} for kind, weight in coefficients.items(): if not weight: continue started = time.perf_counter() value, grads = probe_gradient(model, parameters, inputs, targets, kind, seed, step,replica) value, grads = probe_gradient(model, parameters, inputs, targets, kind, seed, step,replica, stream=streams[kind] if streams else 827) raw_norm = vector_norm(grads).item() if method == "sham": signs = random_signs(parameters, generator(inputs.device, seed, step, 839))26 unmodified lines272829303031323233343526 unmodified lines return torch.stack([(a * b).sum() for a, b in zip(left, right, strict=True)]).sum()
def hessian_vector(loss, parameters, direction):def hessian_vector(loss, parameters, direction, *, create_graph=True): """Apply the parameter Hessian through the gradient's directional contraction.""" return partials(inner(partials(loss, parameters), direction), parameters) return partials(inner(partials(loss, parameters), direction), parameters, create_graph=create_graph)
def third_contraction(loss, parameters, u, v, *, create_graph=True):57 unmodified lines585960616162636426 unmodified lines91929394959697989910057 unmodified lines
def progress(project): study = study_snapshot(project) runs = [r for r in study["runs"] if r.get("phase") not in {"smoke","diagnostic"}] runs = [r for r in study["runs"] if r.get("phase") in {"control","pilot","confirm"}] done = [r for r in runs if r["status"] in {"complete","evaluated"}] tests = [r for r in done if "test_nll" in r] # Each stage has seven development candidates, two free controls, three ablations,26 unmodified lines f"scoring, with {schedule['hours_available_for_other_work']:.2f} hours of the week available for " "secondary pilots, setup, publication and interruptions. [Timing and GPU memory by method]" "(../results/feasibility/one-week.json)"] followup = study["hybrid"] lines += ["## TinyStories hybrid follow-up",f"{followup['completed_arms']} of 48 full runs and " f"{followup['completed_trunks']} of 8 shared checkpoints complete. " f"{followup['status']}. [Per-seed widths and development scores](hybrid/results.md)"] lines += ["## Monitoring","Inspect runs lasting over 10, 30 and 60 minutes at 5, 15 and 30 minute intervals " "respectively. The live dashboard refreshes between those checks. " "[Study design](plan.md) · [Run matrix](planned-runs.md) · [Experiment ledger](experiments/experiments.md)"]72 unmodified lines7374757677787980818272 unmodified lines f"Use the pinned base and loading instructions in [the guide]({GITHUB}/blob/main/docs/runbook.md).\n") if diagnostic: card += f"\n{diagnostic['reason']} [Numerical audit]({GITHUB}/blob/main/reports/amendments/adapter-precision.md)\n" if summary["phase"] in {"branch","hybrid"}: card += (f"\nThis checkpoint belongs to the [TinyStories hybrid follow-up]({GITHUB}/blob/main/reports/hybrid/preregistration.md). " f"The [per-seed geometry and development outcomes]({GITHUB}/blob/main/reports/hybrid/results.md) " "link to full schedules, crossing brackets and the matched controls.\n") card = "---\nlanguage: [en]\npipeline_tag: text-generation\n---\n" + card (folder/"README.md").write_text(card,encoding="utf-8") write_json(folder/"training_summary.json",summary)170 unmodified lines171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205180206207208209170 unmodified lines return True
def _hybrid_width(study,path): """Plot observed, identifiable widths for each seed in its own panel on a shared scale.""" groups = {} for r in study["runs"]: points = [(p["tokens"]/1e6,p["width"]) for p in r.get("widths",{}).values() if finite(p["width"])] if points: groups.setdefault(r["seed"],[]).append((r["method"],sorted(points))) if not groups: return False columns = min(2,len(groups)) rows = (len(groups)+columns-1)//columns fig = Figure(figsize=(8,2.7*rows+0.6),layout="constrained") axes = fig.subplots(rows,columns,sharey=True,squeeze=False).ravel() for ax,(seed,records) in zip(axes,sorted(groups.items())): for arm,points in records: x,y = zip(*points) ax.plot(x,y,marker="o",ms=3,color=COLORS[arm],label=METHODS[arm],alpha=.85) ax.set_title(f"TinyStories · seed {seed}",loc="left",fontsize=10) _axes_style(ax,"Training targets (millions)","Directional width") ax.legend(frameon=False,fontsize=6,ncol=2) for ax in axes[len(groups):]: ax.set_visible(False) _save(fig,path) return True
def build_figures(study: dict, directory: Path) -> dict: """Always emit the method illustrations and add measured plots when observations exist.""" directory.mkdir(parents=True, exist_ok=True) architecture(directory / "architecture.png") penalty_directions(directory / "penalty-directions.png") products = {"architecture": "architecture.png", "penalty_directions": "penalty-directions.png"} for key, draw in (("curves", _curves), ("paired", _paired)): for key, draw in (("curves", _curves), ("paired", _paired), ("hybrid_width",_hybrid_width)): file = directory / f"{key}.png" if draw(study, file): products[key] = file.name319 unmodified lines32032132232332432332432532632732832933032933033133233333433533633733833934034134234334479 unmodified lines424425426416427428418419429430431432319 unmodified lines "two tokenization schemes bound the interpretation. More tokens per GPU hour can change " "the practical ranking. " f"{_cite('coordinates')} · {_link(REPOSITORY + '/blob/main/reports/preregistration.md', 'Scope of inference')}") p("Proposed curvature-dependent schedule", "subheading") p("A TinyStories follow-up would keep the trace active and increase the weight on squared third " p("Registered curvature-dependent schedule", "subheading") p("The TinyStories follow-up keeps the trace active and increases the weight on squared third " "derivatives once training loss and measured curvature are low. Retaining the highest weight reached " "could oppose later drift if curvature changes faster at the edge. Direct division can reverse " "the incentive. For the quartic loss above, the squared ratio of third to second derivative " "is 4/w<super>2</super> away from zero and grows toward the flat bottom. The final appendix " "specifies both schedules and the proposed width test. " f"{_link(REPOSITORY + '/blob/main/reports/plan.md#curvature-dependent-penalty-weight', 'Follow-up design')}") "specifies both schedules and the width test. " f"{_link(REPOSITORY + '/blob/main/reports/hybrid/preregistration.md', 'Frozen follow-up design')}") hybrid = study["hybrid"] if "hybrid_width" in figures: flow.append(_figure(figure_dir/figures["hybrid_width"],max_height=285)) p(f"{hybrid['completed_arms']} of 48 full hybrid arms and {hybrid['completed_trunks']} of 8 shared " f"checkpoints have completed. Geometric endpoint: {hybrid['status']}. " f"{_link(REPOSITORY + '/blob/main/reports/hybrid/results.md', 'All observed widths, development scores and fit differences')}") for comparator,s in hybrid["comparisons"].items(): lo,hi = s["median_ci"] p(f"Adaptive minus {METHODS[comparator]} median width gain {fmt(s['median_delta'],5)} " f"[{fmt(lo,5)}, {fmt(hi,5)}]; one-sided sign p = {fmt(s['p_raw'],5)}, Holm p = {fmt(s.get('p_holm'),5)}. " "Cross-seed replay shares schedule information across pairs, limiting the independent-sign approximation.","caption") p("Conclusion", "heading") if all(outcome.get("complete") for outcome in study["stages"].values()): confirmed = [STAGES[s] for s, outcome in study["stages"].items() if outcome.get("success")]79 unmodified lines p(f"Rebuild tables, figures, the explorer and this paper with <b>uv run thirdloss report</b>. " f"{_link(REPOSITORY, 'Code and versioned protocol')}", "caption") flow.append(PageBreak()) p("Appendix · Proposed TinyStories schedules", "heading") p("Appendix · Registered TinyStories schedules", "heading") p("The follow-up asks whether changing the third-derivative coefficient in response to low curvature " "helps retain a wider low-loss neighborhood. The equations below specify candidate arms for a " "separate preregistration.") "helps retain a wider low-loss neighborhood. Eight paired seeds compare six arms at equal training tokens.") p("Shared training objective", "subheading") p("J<sub>t</sub> = L<sub>t</sub> + (I<sub>t</sub>/p) [α<sub>t</sub> h<sub>t</sub> + λ<sub>t</sub> P<sub>3,t</sub>]", "equation") p("h<sub>t</sub> = a<super>T</super>H<sub>t</sub>a, "8 unmodified lines91011121314157 unmodified lines23242526272829303132333435366 unmodified lines4344454647484950515253545556102 unmodified lines1591601611621631641651661671681691701711721733 unmodified lines17717817916418018118218339 unmodified lines2232242252262272282295 unmodified lines2352362372212382392402418 unmodified linesfrom tempfile import NamedTemporaryFile
from .analysis import analyze_stagefrom .hybrid_results import hybrid_resultsfrom .records import GITHUB as REPOSITORY, PAGES
7 unmodified lines "combined": "Trace + third derivative", "initial": "Initial checkpoint", "unigram": "Unigram", "trunk":"Shared trace checkpoint","adaptive":"Curvature-dependent hybrid","late":"Fixed late hybrid", "replay":"Cross-seed replay","strong":"Stronger trace","always":"Always-on hybrid",}COLORS = { "ce": "#374d67", "trace": "#ac582a", "third": "#007166", "hessian_norm": "#64569c", "sham": "#ac3c66", "combined": "#3974a2", "initial": "#674e35", "unigram": "#73736c", "trunk":"#705d43","adaptive":"#007361","late":"#405fa6","replay":"#9b486c","strong":"#a66f0c","always":"#594489",}FIELDS = ( "id", "stage", "method", "phase", "seed", "ratio", "tokens", "steps",6 unmodified lines "git_revision", "gpu", "torch", "matched_dev_nll", "finished_at", "initial_trainable_sha256", "derivative_dtype", "derivative_device", "host_probe_seconds", "training_seconds_excluding_host_probes", "cpu_threads", "process_peak_rss_mib", "evaluation_batch_windows", "test_seconds", "evaluated_at", "parent","parent_restart_sha256","donor","alpha","cap","delta","reference_rms","zero_steps","final_third_lambda", "inherited_tokens","inherited_train_seconds",)EVENT_FIELDS = ( "step", "tokens", "train_seconds", "loss", "accuracy", "penalty", "dev_nll", "dev_accuracy", "timestamp", "status", "peak_vram_mb", "training_seconds_excluding_host_probes", "host_probe_seconds", "curvature_q","curvature_rms","trace_lambda","third_lambda","reference_rms","monitor_mean_nll","gradient_norm",)
102 unmodified lines if isinstance(details, dict) and finite(details.get("estimate")): row["raw_" + kind] = details["estimate"] record["events"].append(row) if record.get("phase") in {"hybrid","branch"}: record["widths"] = {} for path in sorted(folder.glob("width-*.json")): width = read_json(path) point = {k:v for k,v in width.items() if k!="directions"} record["widths"][str(width["step"])] = point record["events"].append({"step":width["step"],"tokens":width["tokens"], "width":width["width"],"width_probe_nll":width["baseline_nll"]}) record["events"].sort(key=lambda row:row.get("step",0)) record["samples"] = read_lines(folder / "samples.jsonl") return record
3 unmodified lines if len(events) <= maximum: return events keep = {round(i * (len(events) - 1) / (maximum - 1)) for i in range(maximum)} keep.update(i for i, event in enumerate(events) if finite(event.get("dev_nll"))) keep.update(i for i, event in enumerate(events) if finite(event.get("dev_nll")) or "width" in event) return [events[i] for i in sorted(keep)]
39 unmodified lines "generated_at": datetime.now(timezone.utc).isoformat(timespec="seconds"), "runs": runs, "stages": stages, "method_names": METHODS, "stage_names": STAGES, "colors": COLORS, "context": context, "pilot_comparisons": pilots,"numerics":numerics, "hybrid":hybrid_results(runs), }
5 unmodified lines """Choose one completed registered checkpoint per method independently of sample text or scores.""" examples = {} for run in sorted(runs,key=lambda r:r["id"]): if completed(run) and run["phase"] in {"confirm","pilot","control"} and run["samples"]: if completed(run) and run["phase"] in {"confirm","pilot","control","hybrid"} and run["samples"]: examples.setdefault((run["stage"],run["method"]),run) return list(examples.values())
218 unmodified lines2192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842856 unmodified lines2922932942382952962972989 unmodified lines308309310254311312313314315316218 unmodified lines atomic_text(path, re.sub(pattern, lambda _: replacement, before, flags=re.DOTALL))
def _hybrid_report(root,study): """Report each observed width, censoring, matched fit and preregistered sign comparison.""" data = study["hybrid"] headline = (f"TinyStories hybrid follow-up: {data['completed_arms']} of 48 full runs and " f"{data['completed_trunks']} of 8 shared checkpoints complete. " f"Geometric decision: {data['status']}.") material = ["# Hybrid schedules on TinyStories",headline, "[Frozen protocol and decision rule](preregistration.md) · " "[Interactive measurement and run selector](../../docs/index.html#curves)", "Two-sided directional width is measured in the original Euclidean weight coordinates at a " "fixed increase of 0.1 nats per target. Each linked JSON contains all 32 rays and their brackets. " "A missing upper bound means that the search reached its maximum radius before crossing."] widths = [] for r in study["runs"]: for w in r.get("widths",{}).values(): path = f"../../results/{r['id']}/width-{w['step']}.json" widths.append([r["seed"],_method(r),f"[{w['step']}]({path})",fmt(w["width"],5), fmt(w["width_lower"],5),fmt(w["width_upper"],5),w["censored_rays"], fmt(w["baseline_nll"],5),fmt(w["seconds"],2)]) if widths: material += ["## Width observations",_table(widths,["Seed","Arm","Step","Width","Lower","Upper", "Censored rays","Training probe NLL","Probe seconds"])] if any(finite(w["width"]) for r in study["runs"] for w in r.get("widths",{}).values()): material.append("") arms = [] for r in study["runs"]: if r.get("phase") not in {"hybrid","branch"} or not completed(r): continue url = f"../../results/{r['id']}/schedule.json" arms.append([r["seed"],_method(r),fmt(r["dev_nll"],6),fmt(r["dev_accuracy"],5),fmt(r["reference_rms"],5), f"[{r['zero_steps']}]({url})",f"{r['final_third_lambda']:.6g}",fmt(r["tokens_per_sec"],0), fmt(r["peak_vram_mb"],1),fmt(r["process_peak_rss_mib"],1)]) if arms: material += ["## Full development and resource measurements",_table(arms,["Seed","Arm","Dev NLL","Accuracy", "Reference RMS","Steps at zero λ₃","Final λ₃","Targets/s","Allocated GPU MiB","Process peak MiB"])] if data["pairs"]: material += ["## Adaptive minus comparator per seed","Positive Δwidth favors the adaptive schedule. " "Negative ΔNLL favors its prediction. Comparable fit uses the frozen 0.02-nat training threshold.", _table([[p["seed"],METHODS[p["comparator"]],fmt(p["delta"],6),fmt(p["dev_nll_delta"],6), fmt(p["train_probe_nll_delta"],6),"yes" if p["comparable_fit"] else "no"] for p in data["pairs"]],["Seed","Comparator","Δwidth gain","Δdev NLL","Δtrain NLL","Comparable fit"])] for comparator,s in data["comparisons"].items(): lo,hi = s["median_ci"] material.append(f"Against {METHODS[comparator]}, the median paired width difference is {fmt(s['median_delta'],6)}, " f"interval [{fmt(lo,6)}, {fmt(hi,6)}], coverage {fmt(s['ci_coverage'],4)}. " f"Wins/ties/losses: {s['wins']}/{s['ties']}/{s['losses']}. " f"One-sided sign p = {fmt(s['p_raw'],5)}, Holm p = {fmt(s.get('p_holm'),5)}.") material += [f"The completed branches reused {data['shared_training_tokens_saved']:,} targets of optimization " "compared with independently training each branch from initialization. The replay permutation " "couples different seeds through their coefficient histories. The sign-test reference for this " "comparison assumes exchangeable independent pair signs; that assumption is approximate here. " "All raw pairs are reported for inspection."] atomic_text(root/"reports"/"hybrid"/"results.md","\n\n".join(material)+"\n") return headline
def build_report(root: Path = Path(".")) -> dict: """Regenerate README results, PDF, experiment ledger, figures and the static dashboard.""" root = Path(root).resolve() study = study_snapshot(root) hybrid = _hybrid_report(root,study) figures = build_figures(study, root / "docs" / "figures") study["figures"] = figures static = json.dumps(study, ensure_ascii=False, allow_nan=False, separators=(",", ":"))6 unmodified lines overview = f"Recorded {counts} runs, including {done} with a completed summary." documents = [f"[Interactive explorer]({PAGES})", "[Per-run ledger](experiments/experiments.md)", "[Preregistration](preregistration.md)", "[Paper](paper.pdf)"] summary = ["# Study summary", overview, _stage_summary(study), " · ".join(documents)] summary = ["# Study summary", overview, _stage_summary(study), hybrid+" [Hybrid outcomes](hybrid/results.md)", " · ".join(documents)] pilots = _pilot_summary(study) if pilots: summary.extend(["## Development observations", pilots])9 unmodified lines badge = (f"[Explore the results]({PAGES}) · [Hugging Face explorer](https://huggingface.co/spaces/BurnyCoder/thirdloss-explorer) · " "[Hugging Face collection](https://huggingface.co/collections/BurnyCoder/third-derivatives-in-language-model-training-6b067fb7d5ae3eca49ebb378) · " "[Paper](reports/paper.pdf) · [Run ledger](reports/experiments/experiments.md)") readme = [badge, overview, _stage_summary(study)] readme = [badge, overview, _stage_summary(study),hybrid+" [Width measurements, scores and controls](reports/hybrid/results.md)"] if "hybrid_width" in figures: readme.append("") if pilots: readme.append(pilots) if compact:164 unmodified lines16516616716816816917017115 unmodified lines187188189190191192193194195164 unmodified lines return result
def run_study(project,storage,stages,device,publish):def run_study(project,storage,stages,device,publish,with_hybrid=False): """Retry-safe complete study. Cached milestones allow continuation after reboot or network loss.""" def run(stage,method,phase,seed,ratio): row = run_one(project,storage,stage,method,phase,seed,ratio,device)15 unmodified lines feasibility(project,stage) for method,ratio in (("hessian_norm",0.03),("sham",selected["third"]),("combined",selected["third"])): run(stage,method,"pilot",0,ratio) if with_hybrid and stage=="stories": from .hybrid import run_hybrids run_hybrids(project,storage,device,publish) for stage in stages: selected = select(project,stage) for seed in range(1,9):67 unmodified lines68697071717273747576777879808182838284858687888990919293949587969798991001011021031041051061077 unmodified lines11511611711811912012112210712312412512612 unmodified lines1391401411261421431441451 unmodified line1471481491341501511521536 unmodified lines16016116214716316416516616728 unmodified lines1961971981992002012021821832032042052062072082098 unmodified lines2182192201981992212222232242252262272282292302312322332042342352362376 unmodified lines2442452462472482492502511 unmodified line25325425522425625725825926026126226326426526626726867 unmodified lines return {kind: scale*calibrate(project,storage,stage,kind,device,microbatch) for kind,scale in kinds.items()}
def save_state(path, model, optimizer, step, elapsed, config):def save_state(path, model, optimizer, step, elapsed, config, protocol=None): """Atomically persist optimizer, trainable weights, all stochastic state and next data step.""" state = {"weights":{n:p.detach() for n,p in model.named_parameters() if p.requires_grad}, "optimizer":optimizer.state_dict(), "next_step":step, "train_seconds":elapsed, "config":config, "cpu_rng":torch.get_rng_state(), "cuda_rng":torch.cuda.get_rng_state() if next(model.parameters()).is_cuda else None} if protocol is not None: state["hybrid_schedule"] = protocol.schedule.state() temp = path.with_suffix(".partial") torch.save(state, temp) os.replace(temp,path)
def restore_state(path, model, optimizer, config, recorder, device):def restore_state(path, model, optimizer, config, recorder, device, protocol=None): """Recover the last committed checkpoint and ignore telemetry from interrupted later steps.""" if not path.exists(): return 0, 0.0 state = torch.load(path, map_location="cpu", weights_only=True) parent = protocol is not None and path == protocol.parent if parent: original = state["config"] keys = ("seed","stage","data_manifest_sha256","context","batch_windows","microbatch","alpha","cap","schedule_steps","protocol") if (original["id"]!=config["parent"] or state["next_step"]!=config["schedule_steps"]//2 or any(original[key]!=config[key] for key in keys) or sha256(path)!=config["parent_restart_sha256"]): raise ValueError("Shared optimizer checkpoint does not match the registered branch") if state["config"] != config: elif state["config"] != config: raise ValueError("Resume configuration differs from saved scientific settings") model.load_state_dict(state["weights"], strict=False) optimizer.load_state_dict(state["optimizer"]) torch.set_rng_state(state["cpu_rng"]) if state["cuda_rng"] is not None: torch.cuda.set_rng_state(state["cuda_rng"], device) if protocol is not None: protocol.schedule.load(state["hybrid_schedule"]) step = state["next_step"] path = recorder.directory/"events.jsonl" if path.exists():7 unmodified lines
def run_one(project, storage, stage, method, phase, seed, ratio, device, microbatch=None): config = scientific_config(stage,method,phase,seed,ratio) return run_config(project,storage,config,device,microbatch)
def run_config(project, storage, config, device, microbatch=None, protocol=None): """Run one identified checkpoint with mutual exclusion and durable failed-attempt records.""" microbatch = microbatch or (32 if stage == "stories" else 2) microbatch = microbatch or (32 if config["stage"] == "stories" else 2) if microbatch < 1: raise ValueError("A physical batch must contain at least one window") recorder = Recorder(project, config["id"])12 unmodified lines remember(read_json(marker)) marker.unlink() try: return _run(project, storage, config, recorder, device, microbatch) return _run(project, storage, config, recorder, device, microbatch,protocol) except Exception as exc: failure = {"timestamp":time_now(), "error":repr(exc)} write_json(marker,failure)1 unmodified line raise
def _run(project, storage, config, recorder, device, microbatch):def _run(project, storage, config, recorder, device, microbatch, protocol=None): stage, method, seed, budget = (config[k] for k in ("stage","method","seed","token_budget")) data = storage/"data"/stage manifest = read_json(data/"manifest.json")6 unmodified lines state_path = output/"state.json" if not (output/"summary.json").exists(): write_json(state_path,{**config,"status":"initializing","timestamp":time_now()}) config["coefficients"] = chosen_coefficients(project,storage,config,device,microbatch) config["coefficients"] = ({"trace":config["alpha"],"third":config["cap"]} if protocol is not None else chosen_coefficients(project,storage,config,device,microbatch)) if (output/"config.json").exists() and read_json(output/"config.json") != config: raise ValueError(f"Existing run configuration conflicts with {config['id']}") write_json(output/"config.json",config)28 unmodified lines # A restart during the first checkpoint interval must discard measurements from # updates whose weights and optimizer moments were never committed. if not (ckpt/"latest.pt").exists(): initial_step,initial_elapsed = 0,0. if protocol is not None and protocol.parent is not None: initial_step,initial_elapsed = restore_state(protocol.parent,model,optimizer,config,recorder,device,protocol) protocol.checkpoint_width(model,initial_step) save_state(ckpt/"latest.pt",model,optimizer,0,0.0,config) start,elapsed = restore_state(ckpt/"latest.pt",model,optimizer,config,recorder,device) save_state(ckpt/"latest.pt",model,optimizer,initial_step,initial_elapsed,config,protocol) start,elapsed = restore_state(ckpt/"latest.pt",model,optimizer,config,recorder,device,protocol) if protocol is not None: protocol.checkpoint_width(model,start) history = json_lines(output/"events.jsonl") host_probes = sum(e.get("host_probe_seconds",0.0) for e in history) # Match elapsed-time comparisons with periodic fixed development windows in every arm.8 unmodified lines inputs,targets = windows.get(step,device) optimizer.zero_grad(set_to_none=True) base,accuracy = ce_backward(model,inputs,targets,microbatch) active = bool(config["coefficients"]) and gate(seed,step) terms = add_penalty(model,parameters,inputs,targets,config["coefficients"],method,seed,step,replica) if active else {} coefficients = protocol.schedule.coefficients(step) if protocol is not None else config["coefficients"] active = bool(coefficients) and gate(seed,step) streams = None diagnostics = {} if protocol is not None: from .hybrid import STREAMS streams = STREAMS diagnostics = protocol.monitor(model,parameters,inputs,targets,step,base) terms = add_penalty(model,parameters,inputs,targets,coefficients,method,seed,step,replica,streams=streams) if active else {} host_seconds = (sum(t["probe_seconds"] for t in terms.values()) if precise and config["derivative_device"]=="cpu" and device.type=="cuda" else 0.0) host_probes += host_seconds norm = torch.nn.utils.clip_grad_norm_(parameters,1.0,error_if_nonfinite=True) lr = learning_rate(stage,step,steps) lr = learning_rate(stage,step,config.get("schedule_steps",steps)) for group in optimizer.param_groups: group["lr"] = lr optimizer.step()6 unmodified lines row = {"step":done, "tokens":done*batch*CONTEXT, "train_seconds":elapsed, "loss":base.item(), "accuracy":accuracy.item(), "lr":lr, "gradient_norm":norm.item(),"derivatives":terms, "host_probe_seconds":host_seconds,"training_seconds_excluding_host_probes":max(0.0,elapsed-host_probes)} if protocol is not None: row.update(trace_lambda=coefficients["trace"],third_lambda=coefficients["third"],**diagnostics) if terms: row["penalty"] = sum(8*t["lambda"]*t["estimate"] for t in terms.values()) if validate:1 unmodified line row.update(dev_nll=metrics["nll"],dev_accuracy=metrics["accuracy"]) recorder.emit(row) if done%interval == 0 or done==steps: save_state(ckpt/"latest.pt",model,optimizer,done,elapsed,config) save_state(ckpt/"latest.pt",model,optimizer,done,elapsed,config,protocol) if protocol is not None: protocol.checkpoint_width(model,done) del optimizer summary.update(host_probe_seconds=host_probes,training_seconds_excluding_host_probes=max(0.0,elapsed-host_probes)) if protocol is not None: protocol.finish(steps) summary["reference_rms"] = protocol.schedule.reference summary["zero_steps"] = protocol.schedule.at_zero summary["final_third_lambda"] = protocol.schedule.weight del replica dist = unigram_distribution(data/"train.bin",4096 if stage=="stories" else 50304) if method=="unigram" else None write_json(state_path,{"status":"scoring development","timestamp":time_now()})1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677"""Directional width of an unregularized loss level set in the original weight coordinates."""
import mathimport statisticsimport time
import torch
from .models import trainable_digestfrom .penalties import random_signsfrom .windows import generator
def crossing(loss_at, threshold): """Bracket the first observed crossing on the registered outward grid and refine it.""" lower = 0. for exponent in range(-3, 8): upper = 2.**exponent value = float(loss_at(upper)) if not math.isfinite(value): raise FloatingPointError("Nonfinite width-probe loss") if value >= threshold: for _ in range(12): middle = (lower + upper) / 2 value = float(loss_at(middle)) if not math.isfinite(value): raise FloatingPointError("Nonfinite width-probe loss") if value >= threshold: upper = middle else: lower = middle return {"lower":lower, "upper":upper} lower = upper return {"lower":lower, "upper":None}
@torch.no_grad()def measure_width(model, loss, directions=16): """Probe two rays per unit direction; preserve exact weights, gradients, mode and RNG.""" started = time.perf_counter() parameters = [p for p in model.parameters() if p.requires_grad] original = [p.detach().clone() for p in parameters] scale = math.sqrt(sum(p.numel() for p in parameters)) digest = trainable_digest(model) modes = [(module,module.training) for module in model.modules()] model.eval() rays = [] try: base = float(loss()) if not math.isfinite(base): raise FloatingPointError("Nonfinite unperturbed width-probe loss") for index in range(directions): signs = random_signs(parameters,generator(parameters[0].device,88731,index,947)) def at(radius): # Reconstruct each perturbation from the saved coordinates to avoid drift. torch._foreach_copy_(parameters,original) torch._foreach_add_(parameters,signs,alpha=radius/scale) return float(loss()) rays.append({"direction":index,"positive":crossing(at,base+.1), "negative":crossing(lambda radius: at(-radius),base+.1)}) finally: torch._foreach_copy_(parameters,original) for module,mode in modes: module.training = mode if trainable_digest(model)!=digest: raise RuntimeError("Width measurement changed the training weights") lows,highs = [],[] for row in rays: bounds = [row["positive"],row["negative"]] lows.append(sum(x["lower"] for x in bounds)) highs.append(sum(x["upper"] if x["upper"] is not None else math.inf for x in bounds)) lower,upper = statistics.median(lows),statistics.median(highs) return {"baseline_nll":base,"delta_nll":.1,"directions":rays,"width_lower":lower, "width_upper":upper if math.isfinite(upper) else None, "width":(lower+upper)/2 if math.isfinite(upper) else None, "censored_rays":sum(ray[s]["upper"] is None for ray in rays for s in ("positive","negative")), "weights_sha256":digest,"weights_restored":True,"seconds":time.perf_counter()-started}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107"""Verify the registered schedules, branch pairing and geometric measurement on exact losses."""
import mathimport pytestimport torch
from thirdloss.hybrid import HybridSchedule, donor_seedfrom thirdloss.width import crossing, measure_width
def test_lagged_rms_latch_and_replay_survive_checkpoint(): adaptive = HybridSchedule("adaptive", alpha=0.1, cap=0.3) for _ in range(8): adaptive.observe(4.0, 3.8) adaptive.fix_reference() assert adaptive.coefficients(2048) == {"trace": 0.1, "third": 0.0} for _ in range(8): adaptive.observe(1.0, 3.8) assert adaptive.coefficients(2064)["third"] == pytest.approx(0.15) restored = HybridSchedule("adaptive", alpha=0.1, cap=0.3) restored.load(adaptive.state()) for _ in range(8): restored.observe(16., 5.) assert restored.coefficients(2080)["third"] == pytest.approx(0.15) replay = HybridSchedule("replay", alpha=0.1, cap=0.3, replay=restored.changes) assert replay.coefficients(2063)["third"] == 0 assert replay.coefficients(2064)["third"] == pytest.approx(0.15) assert donor_seed(21) == 28 and donor_seed(22) == 21
def test_fixed_and_stronger_trace_apply_only_after_switch(): fixed = HybridSchedule("late", alpha=2., cap=6.) strong = HybridSchedule("strong", alpha=2., cap=6., delta=4.) assert [fixed.coefficients(t)["third"] for t in (0,2048,2560,3072,4095)] == [0,0,3,6,6] assert strong.coefficients(2560) == {"trace":4., "third":0.} adaptive = HybridSchedule("adaptive",alpha=2.,cap=6.) for _ in range(8): adaptive.observe(4.,4.5) adaptive.fix_reference() for _ in range(8): adaptive.observe(1.,4.5) assert adaptive.coefficients(3072)["third"] == 0.
def test_width_exact_crossing_censor_and_bitwise_restoration(): model = torch.nn.Linear(2,1,bias=False,dtype=torch.float64) original = model.weight.detach().clone() model.weight.grad = torch.ones_like(original) rng = torch.get_rng_state().clone() stats = measure_width(model, lambda: (model.weight-original).square().sum(), directions=3) assert stats["width"] == pytest.approx(2*math.sqrt(.1),abs=1e-4) assert stats["weights_restored"] and model.training and torch.equal(model.weight,original) assert torch.equal(model.weight.grad, torch.ones_like(original)) assert torch.equal(torch.get_rng_state(),rng) assert crossing(lambda radius: 0.,.1) == {"lower":128.,"upper":None} unbounded = measure_width(model,lambda: model.weight.sum()*0.,directions=2) assert unbounded["width"] is None and unbounded["width_lower"] == 256.
def test_branch_restores_adam_moments_rng_cursor_and_monitor(tmp_path): from types import SimpleNamespace from thirdloss.records import sha256 from thirdloss.train import restore_state, save_state model = torch.nn.Linear(2,1) optim = torch.optim.AdamW(model.parameters(),lr=.01) x = torch.tensor([[2.,-3.]]) model(x).square().sum().backward() optim.step() parent = tmp_path/"parent.pt" cfg = dict(id="trunk",seed=21,stage="stories",data_manifest_sha256="data",context=128,batch_windows=32, microbatch=32,alpha=1.,cap=2.,schedule_steps=4096,protocol="hybrid-v1") schedule = HybridSchedule("trunk",1.,2.) for _ in range(8): schedule.observe(1.,3.2) schedule.fix_reference() save_state(parent,model,optim,2048,123.,cfg,SimpleNamespace(schedule=schedule)) control = torch.rand(3) child = torch.nn.Linear(2,1) child_opt = torch.optim.AdamW(child.parameters(),lr=.001) child_protocol = SimpleNamespace(parent=parent,schedule=HybridSchedule("adaptive",1.,2.)) child_cfg = {**cfg,"id":"adaptive","parent":"trunk","parent_restart_sha256":sha256(parent)} assert restore_state(parent,child,child_opt,child_cfg,SimpleNamespace(directory=tmp_path), torch.device("cpu"),child_protocol)==(2048,123.) assert torch.equal(torch.rand(3),control) and child_protocol.schedule.reference==1. for net,optimizer in ((model,optim),(child,child_opt)): optimizer.zero_grad() net(x).square().sum().backward() optimizer.step() assert all(torch.equal(a,b) for a,b in zip(model.parameters(),child.parameters()))
def test_width_inference_requires_eight_pairs_and_keeps_censoring(): from thirdloss.hybrid_results import hybrid_results records=[] for seed in range(21,29): for arm,w in (("adaptive",3.),("late",2.),("replay",1.)): base={"baseline_nll":2.,"weights_sha256":"same"} records.append(dict(seed=seed,method=arm,phase="hybrid",finished_at="today",tokens=2**24,dev_nll=3., initial_trainable_sha256=str(seed),parent_restart_sha256=str(seed), data_manifest_sha256="data",widths={"2048":{**base,"width":1.},"4096":{**base,"width":w}})) evidence = hybrid_results(records) assert evidence["status"]=="both width comparisons passed" assert evidence["comparisons"]["late"]["p_holm"]==2/256 records[-1]["widths"]["4096"]["width"]=None evidence = hybrid_results(records) assert "replay" not in evidence["comparisons"] assert len(evidence["pairs"])==16logs/hybrid-implementation-release.logAdded+1
logs/study-20261125T105025-confirmation.log+15
publication.json+141-81
research/README.md+4-2
research/docs/explorer.js+8-3
research/docs/index.html+4-1
research/docs/runbook.md+2
research/docs/study.json
research/reports/experiments/abstracts-pilot-s00-hessian_norm-r03-fp64/experiment.mdAdded+11
research/reports/experiments/abstracts-pilot-s00-hessian_norm-r03-fp64/learnings.mdAdded+5
research/reports/experiments/experiments.md+1
research/reports/experiments/learnings.md+2
research/reports/hybrid/results.mdAdded+9
research/reports/paper.pdf
research/reports/progress.md+12-2
research/reports/summary.md+4-2
research/results/abstracts-pilot-s00-hessian_norm-r03-fp64/state.jsonAdded+17
research/results/feasibility/abstracts.jsonAdded+28
research/results/feasibility/one-week.jsonAdded+77
research/results/selection/abstracts.jsonAdded+43
research/src/thirdloss/analysis.py+17-6
research/src/thirdloss/cli.py+11-5
research/src/thirdloss/hybrid.pyAdded+215
research/src/thirdloss/hybrid_results.pyAdded+47
research/src/thirdloss/objectives.py+5-4
research/src/thirdloss/penalties.py+2-2
research/src/thirdloss/progress.py+5-1
research/src/thirdloss/release.py+4
research/src/thirdloss/report_figures.py+27-1
research/src/thirdloss/report_paper.py+17-7
research/src/thirdloss/report_records.py+19-2
research/src/thirdloss/reporting.py+61-2
research/src/thirdloss/study.py+4-1
research/src/thirdloss/train.py+52-13
research/src/thirdloss/width.pyAdded+77
research/tests/test_hybrid.pyAdded+107