Publish amended FP64 study, numerical references and verified implementation
Browse filesFiles changed (36)
- research/.env.example+3
- research/README.md+3-1
- research/docs/figures/curves.png
- research/docs/runbook.md+2
- research/docs/study.json
- research/pyproject.toml+1-1
- research/reports/amendments/adapter-precision.mdAdded+13
- research/reports/experiments/abstracts-pilot-s00-third-r03/experiment.md+7-1
- research/reports/experiments/abstracts-pilot-s00-third-r03/learnings.md+1-1
- research/reports/experiments/experiments.md+1-1
- research/reports/experiments/learnings.md+1-1
- research/reports/paper.pdf
- research/reports/progress.md+3-3
- research/reports/summary.md+1-1
- research/results/verification/numerical-exclusions.jsonAdded+6
- research/results/verification/pythia-batch-activations.jsonAdded+1467
- research/results/verification/pythia-fp64-agreement.jsonAdded+6
- research/results/verification/pythia-fp64-cpu.jsonAdded+13
- research/results/verification/pythia-fp64-cuda.jsonAdded+13
- research/results/verification/stories-full-gradient.jsonAdded+12
- research/results/verification/tests.json+24-24
- research/src/thirdloss/cli.py+5
- research/src/thirdloss/models.py+24
- research/src/thirdloss/objectives.py+57-12
- research/src/thirdloss/precision.py+53-68
- research/src/thirdloss/probe_check.py+29
- research/src/thirdloss/progress.py+1-1
- research/src/thirdloss/records.py+15-1
- research/src/thirdloss/release.py+5
- research/src/thirdloss/report_paper.py+11
- research/src/thirdloss/report_records.py+11-2
- research/src/thirdloss/reporting.py+8
- research/src/thirdloss/study.py+4-1
- research/src/thirdloss/train.py+21-6
- research/tests/test_derivatives.py+25
- research/uv.lock+2
123456# Copy to .env to override the default ./storage directory for large data and weights.
THIRDLOSS_STORAGE=./storage
THIRDLOSS_ADAPTER_DERIVATIVE_DEVICE=cpu
OMP_NUM_THREADS=6
MKL_NUM_THREADS=6
# HF_TOKEN can be supplied by the existing interactive Hugging Face login.18 unmodified lines19202122232425269 unmodified lines363738373940414218 unmodified lines
The protocol and run matrix were published before model execution. The scores, comparisons and continuations below are regenerated from each run’s raw records. [Preregistration](reports/preregistration.md) · [Run matrix](reports/planned-runs.md) · [Literature](reports/literature-review.md) · [State of the art](reports/state-of-the-art-review.md) · [Progress](reports/progress.md)
A same-probe check on pretrained Pythia found that single-precision arithmetic materially changed the third-order training gradient. The first adapter pilot is archived as a numerical diagnostic. The corrected adapter arms evaluate derivatives in double precision while ordinary training and prediction use the GPU. [Pre-test precision amendment](reports/amendments/adapter-precision.md) · [Full-model numerical checks](results/verification)
<!-- RESULTS:START -->[Explore the results](https://burnycoder.github.io/llm-training-with-penalizing-rapid-changes-of-curvature-of-its-loss/) · [Paper](reports/paper.pdf) · [Run ledger](reports/experiments/experiments.md)
9 unmodified lines
| Stage | Phase | Method | Ratio | Tokens/run | Runs | Median dev NLL | Median test NLL || --- | --- | --- | --- | --- | --- | --- | --- || Research abstracts | pilot | Third derivative | 0.030 | 65,536 | 1 | 3.1168 | — || Research abstracts | diagnostic | Third derivative | 0.030 | 65,536 | 1 | 3.1168 | — || TinyStories | control | Initial checkpoint | 0.000 | 0 | 1 | 8.3437 | — || TinyStories | control | Unigram | 0.000 | 0 | 1 | 6.0036 | — || TinyStories | pilot | Ordinary AdamW | 0.000 | 2,097,152 | 1 | 3.8770 | — |16 unmodified lines171819202122232416 unmodified lines
After preparing abstracts, `uv run thirdloss verify --pretrained --device cuda` also compares both implementations of the penalty and its entire training gradient on the same pair of training windows, adapter initialization and sign probes. The diagnostic materializes the original joint graph for comparison. Its GPU allocation exceeded 10 GiB during the original replay. The ordinary adapter training path processes the two windows sequentially. `--device cpu` runs the optional comparison in host memory. [Adapter verification](../reports/reviews/adapter-verification.md)
`uv run thirdloss verify --reference --device cpu` repeats the full-size FP64 calculation using the archived pilot’s CUDA probe stream. The production study uses `THIRDLOSS_ADAPTER_DERIVATIVE_DEVICE=cpu` on the laptop, six host math threads (`OMP_NUM_THREADS=6`, `MKL_NUM_THREADS=6`), and the GPU for cross-entropy, optimizer updates, generation and scoring. The derivative device, arithmetic, calibration and per-update host time are recorded. The `-fp64` suffix identifies amended adapter runs. [Protocol amendment](../reports/amendments/adapter-precision.md)
## Load a published checkpoint
All models are indexed in the [Hugging Face collection](https://huggingface.co/collections/BurnyCoder/third-derivatives-in-language-model-training-6b067fb7d5ae3eca49ebb378). The run name identifies its objective, phase, seed and penalty strength. Replace the example run name with the desired published checkpoint. Run from a clone with the locked environment.6 unmodified lines78910101112136 unmodified lines "torch==2.15.0", "numpy>=2", "transformers>=5.24,<6", "peft>=0.22,<1",
"huggingface-hub>=1", "tokenizers>=0.22", "safetensors>=0.5",
"pyarrow>=20", "filelock>=3", "httpx>=0.27", "python-dotenv>=1",
"matplotlib>=3.10", "reportlab>=4", "scipy>=1.14",
"matplotlib>=3.10", "reportlab>=4", "scipy>=1.14", "psutil>=6",
]
[project.scripts]12345678910111213# Pre-test amendment to adapter derivative arithmetic
25 November 2026. Registered after the initial FP32 adapter pilot and before any confirmatory adapter training or test-set scoring. The original preregistration is preserved. [Original protocol](../preregistration.md) · [Raw diagnostic pilot](../../results/abstracts-pilot-s00-third-r03)
The original calibration overflowed while computing the norm of finite gradient entries. Further checks on the full pretrained checkpoint found large differences between single-precision implementations of the same penalty. Independent CPU and GPU double-precision runs on identical adapter weights, target tokens and probes agreed on the direction and scale of the fourth-order gradient. The host implementation was faster than the laptop GPU for this calculation. A separate full-weight TinyStories probe compared its original GPU calculation against double precision. [Single-precision GPU experiment](../../results/verification/pythia-joint-cuda.json) · [CPU reference](../../results/verification/pythia-fp64-cpu.json) · [GPU reference](../../results/verification/pythia-fp64-cuda.json) · [Cross-device gradient agreement](../../results/verification/pythia-fp64-agreement.json) · [TinyStories check](../../results/verification/stories-full-gradient.json)
All subsequent adapter derivative arms use a double-precision copy of the same frozen checkpoint and current QKV factors, with double-precision eager attention and the original causal mask. The two-window contraction carries its full fourth-order contribution. CUDA draws the paired random signs. The CPU computes the derivative penalty in FP64 on this machine, scales its gradient, and returns it to the ordinary GPU optimizer. Token cross-entropy, model weights, AdamW and scoring use the registered FP32 GPU path. Hessian trace and squared Hessian norm receive the same precision treatment. The combined and sign-randomized controls use these calibrated gradients. [Implementation](../../src/thirdloss/objectives.py) · [Attention backend registration](https://huggingface.co/docs/transformers/attention_interface)
The first FP32 adapter pilot remains public with its original checkpoint, scores and examples. A diagnostic phase label excludes it from development selection and inference. Recalibrate on the same training windows, rerun the entire registered grid, and identify corrected derivative runs by the `-fp64` suffix. The TinyStories protocol, seed assignments, data, update gates, strengths, token horizons and statistical decision rule retain their registered definitions. [Exclusion record](../../results/verification/numerical-exclusions.json) · [Planned runs](../planned-runs.md)
The primary computational comparison uses elapsed training time while one GPU is reserved. The raw training records separately measure the time spent in host probe calls. Subtracting these calls gives a supplementary time-accounting estimate that also excludes their transfers. It does not measure individual CUDA kernel durations. Host and dedicated-GPU memory have separate units and accounting. [Time accounting](../../src/thirdloss/train.py)
Before rerunning the adapter pilot, benchmark inference batches of 2, 8, 16 and 32 windows on 256 fixed training windows. Retain the original batch of two unless a candidate is at least 10% faster, agrees within 0.000002 nats per target and one top-one prediction with the reference, and uses at most 7 GiB of allocated CUDA memory. Select the fastest eligible batch and use it for all amended-stage development and test scoring. Training batch sizes, evaluation targets and contexts are fixed. [Scoring benchmark](../../src/thirdloss/probe_check.py)3 unmodified lines4567789105 unmodified lines1617181920212223242526273 unmodified lines
| Stage | Method | Phase | Seed | Ratio | Train tokens | Dev NLL | Test NLL | Tokens/s | Status || --- | --- | --- | --- | --- | --- | --- | --- | --- | --- || Research abstracts | Third derivative | pilot | 0 | 0.030 | 65,536 | 3.1168 | — | 907 | complete || Research abstracts | Third derivative | diagnostic | 0 | 0.030 | 65,536 | 3.1168 | — | 907 | complete |
Training time is 72.3 seconds. Peak allocated GPU memory is 6,369.6 MiB. Development token accuracy is 0.4128. Test token accuracy is —.
5 unmodified lines| --- | --- || 2026-11-25T07:00:21+00:00 | FloatingPointError('Nonfinite or zero third calibration norm at draw 0: inf') |
## Numerical diagnostic
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.
[Precision amendment](../../amendments/adapter-precision.md)
## Fixed-prompt generations
**Prompt**123345# Run learnings
Development NLL changed by -0.1143 nats per target token from 4,096 to 65,536 training targets. Attribution to the regularizer uses matched comparisons across seeds. The run ledger records 1 interrupted attempt(s).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).
[Experiment and source records](experiment.md)6 unmodified lines78910101112136 unmodified lines| Run | Stage | Method | Phase | Seed | Ratio | Train tokens | Dev NLL | Test NLL | Tokens/s | Status || --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- || [abstracts-control-s00-initial-r00](./abstracts-control-s00-initial-r00/experiment.md) | Research abstracts | Initial checkpoint | control | 0 | 0.000 | — | — | — | — | configured || [abstracts-pilot-s00-third-r03](./abstracts-pilot-s00-third-r03/experiment.md) | Research abstracts | Third derivative | pilot | 0 | 0.030 | 65,536 | 3.1168 | — | 907 | 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 || [stories-control-s00-initial-r00](./stories-control-s00-initial-r00/experiment.md) | TinyStories | Initial checkpoint | control | 0 | 0.000 | 0 | 8.3437 | — | 0 | complete || [stories-control-s00-unigram-r00](./stories-control-s00-unigram-r00/experiment.md) | TinyStories | Unigram | control | 0 | 0.000 | 0 | 6.0036 | — | 0 | complete || [stories-pilot-s00-ce-r00](./stories-pilot-s00-ce-r00/experiment.md) | TinyStories | Ordinary AdamW | pilot | 0 | 0.000 | 2,097,152 | 3.8770 | — | 123,871 | complete |7 unmodified lines891011111213147 unmodified lines
- [abstracts-control-s00-initial-r00](./abstracts-control-s00-initial-r00/experiment.md) — A development observation is pending.
- [abstracts-pilot-s00-third-r03](./abstracts-pilot-s00-third-r03/experiment.md) — Development NLL changed by -0.1143 nats per target token from 4,096 to 65,536 training targets. Attribution to the regularizer uses matched comparisons across seeds. The run ledger records 1 interrupted attempt(s).- [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).
- [stories-control-s00-initial-r00](./stories-control-s00-initial-r00/experiment.md) — The observed development NLL is 8.3437 nats per target token.
12334556783 unmodified lines1213141515161718# Study progress
Updated 2026-11-25T07:39:12+00:00.Updated 2026-11-25T07:56:00+00:00.
13 training/control records and 0 final evaluations are complete. This is 10.8% of 120 planned model milestones.12 training/control records and 0 final evaluations are complete. This is 10.0% of 120 planned model milestones.
## Current record
3 unmodified lines
Statistical status: pending. Awaiting confirmatory runs.
**abstracts** has 1 completed runs. Current records: abstracts-control-s00-initial-r00 (configured, 0 targets).**abstracts** has 0 completed runs. Current records: abstracts-control-s00-initial-r00 (configured, 0 targets).
Statistical status: pending. Awaiting confirmatory runs.
15 unmodified lines161718191920212215 unmodified lines
| Stage | Phase | Method | Ratio | Tokens/run | Runs | Median dev NLL | Median test NLL || --- | --- | --- | --- | --- | --- | --- | --- || Research abstracts | pilot | Third derivative | 0.030 | 65,536 | 1 | 3.1168 | — || Research abstracts | diagnostic | Third derivative | 0.030 | 65,536 | 1 | 3.1168 | — || TinyStories | control | Initial checkpoint | 0.000 | 0 | 1 | 8.3437 | — || TinyStories | control | Unigram | 0.000 | 0 | 1 | 6.0036 | — || TinyStories | pilot | Ordinary AdamW | 0.000 | 2,097,152 | 1 | 3.8770 | — |123456{
"abstracts-pilot-s00-third-r03": {
"reason": "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.",
"replacement": "abstracts-pilot-s00-third-r03-fp64"
}
}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467{
"timestamp": "2026-11-25T07:40:17+00:00",
"device": "cuda",
"weights_dtype": "float32",
"layers": [
{
"name": "base_model.model.gpt_neox.embed_in",
"max_abs_gap": 0.0,
"max_abs_value": 0.406005859375,
"relative_rms": 0.0,
"tokens_at_max": [
0,
0
]
},
{
"name": "base_model.model.gpt_neox.layers.0.input_layernorm",
"max_abs_gap": 0.0,
"max_abs_value": 12.498207092285156,
"relative_rms": 0.0,
"tokens_at_max": [
0,
0
]
},
{
"name": "base_model.model.gpt_neox.layers.0.attention.query_key_value",
"max_abs_gap": 1.1920928955078125e-05,
"max_abs_value": 15.708852767944336,
"relative_rms": 4.2196657125056464e-07,
"tokens_at_max": [
1,
76
]
},
{
"name": "base_model.model.gpt_neox.layers.0.attention.dense",
"max_abs_gap": 2.9802322387695312e-06,
"max_abs_value": 3.6252167224884033,
"relative_rms": 9.023665959738863e-07,
"tokens_at_max": [
1,
1
]
},
{
"name": "base_model.model.gpt_neox.layers.0.mlp.dense_h_to_4h",
"max_abs_gap": 7.3909759521484375e-06,
"max_abs_value": 5.050264358520508,
"relative_rms": 4.617810435899275e-07,
"tokens_at_max": [
0,
109
]
},
{
"name": "base_model.model.gpt_neox.layers.0.mlp.dense_4h_to_h",
"max_abs_gap": 1.9073486328125e-06,
"max_abs_value": 8.868011474609375,
"relative_rms": 3.838648201041958e-07,
"tokens_at_max": [
0,
25
]
},
{
"name": "base_model.model.gpt_neox.layers.0",
"max_abs_gap": 2.9802322387695312e-06,
"max_abs_value": 11.694438934326172,
"relative_rms": 4.470770493427262e-07,
"tokens_at_max": [
1,
1
]
},
{
"name": "base_model.model.gpt_neox.layers.1.input_layernorm",
"max_abs_gap": 5.245208740234375e-06,
"max_abs_value": 13.576578140258789,
"relative_rms": 4.894830809388377e-07,
"tokens_at_max": [
1,
1
]
},
{
"name": "base_model.model.gpt_neox.layers.1.attention.query_key_value",
"max_abs_gap": 2.384185791015625e-05,
"max_abs_value": 18.406139373779297,
"relative_rms": 5.762543635691443e-07,
"tokens_at_max": [
1,
68
]
},
{
"name": "base_model.model.gpt_neox.layers.1.attention.dense",
"max_abs_gap": 3.6954879760742188e-06,
"max_abs_value": 1.9696043729782104,
"relative_rms": 1.482749931332914e-06,
"tokens_at_max": [
0,
17
]
},
{
"name": "base_model.model.gpt_neox.layers.1.mlp.dense_h_to_4h",
"max_abs_gap": 8.106231689453125e-06,
"max_abs_value": 6.580479621887207,
"relative_rms": 5.740955080644208e-07,
"tokens_at_max": [
0,
27
]
},
{
"name": "base_model.model.gpt_neox.layers.1.mlp.dense_4h_to_h",
"max_abs_gap": 5.364418029785156e-06,
"max_abs_value": 8.428179740905762,
"relative_rms": 1.019411984781126e-06,
"tokens_at_max": [
1,
1
]
},
{
"name": "base_model.model.gpt_neox.layers.1",
"max_abs_gap": 5.7220458984375e-06,
"max_abs_value": 17.699954986572266,
"relative_rms": 6.66230605869857e-07,
"tokens_at_max": [
1,
1
]
},
{
"name": "base_model.model.gpt_neox.layers.2.input_layernorm",
"max_abs_gap": 1.049041748046875e-05,
"max_abs_value": 15.39335823059082,
"relative_rms": 7.808952792610611e-07,
"tokens_at_max": [
1,
74
]
},
{
"name": "base_model.model.gpt_neox.layers.2.attention.query_key_value",
"max_abs_gap": 2.09808349609375e-05,
"max_abs_value": 14.661574363708496,
"relative_rms": 7.394456929012431e-07,
"tokens_at_max": [
1,
51
]
},
{
"name": "base_model.model.gpt_neox.layers.2.attention.dense",
"max_abs_gap": 4.410743713378906e-06,
"max_abs_value": 3.247537612915039,
"relative_rms": 1.7706817978899737e-06,
"tokens_at_max": [
1,
1
]
},
{
"name": "base_model.model.gpt_neox.layers.2.mlp.dense_h_to_4h",
"max_abs_gap": 1.1086463928222656e-05,
"max_abs_value": 7.841897964477539,
"relative_rms": 7.109477537991856e-07,
"tokens_at_max": [
1,
117
]
},
{
"name": "base_model.model.gpt_neox.layers.2.mlp.dense_4h_to_h",
"max_abs_gap": 5.602836608886719e-06,
"max_abs_value": 6.569574356079102,
"relative_rms": 1.3217350735472206e-06,
"tokens_at_max": [
0,
27
]
},
{
"name": "base_model.model.gpt_neox.layers.2",
"max_abs_gap": 1.1920928955078125e-05,
"max_abs_value": 22.54996109008789,
"relative_rms": 7.426089445588375e-07,
"tokens_at_max": [
0,
27
]
},
{
"name": "base_model.model.gpt_neox.layers.3.input_layernorm",
"max_abs_gap": 1.52587890625e-05,
"max_abs_value": 17.398685455322266,
"relative_rms": 9.163061856238686e-07,
"tokens_at_max": [
0,
27
]
},
{
"name": "base_model.model.gpt_neox.layers.3.attention.query_key_value",
"max_abs_gap": 2.288818359375e-05,
"max_abs_value": 19.307382583618164,
"relative_rms": 7.53020900376356e-07,
"tokens_at_max": [
1,
111
]
},
{
"name": "base_model.model.gpt_neox.layers.3.attention.dense",
"max_abs_gap": 2.384185791015625e-06,
"max_abs_value": 2.8529860973358154,
"relative_rms": 1.4469268813501707e-06,
"tokens_at_max": [
0,
103
]
},
{
"name": "base_model.model.gpt_neox.layers.3.mlp.dense_h_to_4h",
"max_abs_gap": 2.47955322265625e-05,
"max_abs_value": 23.164220809936523,
"relative_rms": 7.831457774732257e-07,
"tokens_at_max": [
1,
124
]
},
{
"name": "base_model.model.gpt_neox.layers.3.mlp.dense_4h_to_h",
"max_abs_gap": 1.33514404296875e-05,
"max_abs_value": 26.68160629272461,
"relative_rms": 1.4355940691191746e-06,
"tokens_at_max": [
1,
1
]
},
{
"name": "base_model.model.gpt_neox.layers.3",
"max_abs_gap": 2.288818359375e-05,
"max_abs_value": 32.88378143310547,
"relative_rms": 8.574684292968851e-07,
"tokens_at_max": [
1,
1
]
},
{
"name": "base_model.model.gpt_neox.layers.4.input_layernorm",
"max_abs_gap": 1.1444091796875e-05,
"max_abs_value": 20.122846603393555,
"relative_rms": 9.983410561545355e-07,
"tokens_at_max": [
0,
27
]
},
{
"name": "base_model.model.gpt_neox.layers.4.attention.query_key_value",
"max_abs_gap": 2.47955322265625e-05,
"max_abs_value": 16.28276252746582,
"relative_rms": 8.257723195386494e-07,
"tokens_at_max": [
1,
63
]
},
{
"name": "base_model.model.gpt_neox.layers.4.attention.dense",
"max_abs_gap": 2.5033950805664062e-06,
"max_abs_value": 3.3685057163238525,
"relative_rms": 1.6093770525191568e-06,
"tokens_at_max": [
1,
17
]
},
{
"name": "base_model.model.gpt_neox.layers.4.mlp.dense_h_to_4h",
"max_abs_gap": 5.340576171875e-05,
"max_abs_value": 94.3346939086914,
"relative_rms": 8.396532438176487e-07,
"tokens_at_max": [
0,
98
]
},
{
"name": "base_model.model.gpt_neox.layers.4.mlp.dense_4h_to_h",
"max_abs_gap": 4.57763671875e-05,
"max_abs_value": 59.07522964477539,
"relative_rms": 1.1602669527283394e-06,
"tokens_at_max": [
0,
12
]
},
{
"name": "base_model.model.gpt_neox.layers.4",
"max_abs_gap": 4.57763671875e-05,
"max_abs_value": 92.84129333496094,
"relative_rms": 8.320233661650981e-07,
"tokens_at_max": [
0,
12
]
},
{
"name": "base_model.model.gpt_neox.layers.5.input_layernorm",
"max_abs_gap": 1.239776611328125e-05,
"max_abs_value": 25.20378303527832,
"relative_rms": 9.090260472019243e-07,
"tokens_at_max": [
0,
27
]
},
{
"name": "base_model.model.gpt_neox.layers.5.attention.query_key_value",
"max_abs_gap": 2.288818359375e-05,
"max_abs_value": 20.782238006591797,
"relative_rms": 6.987397371089845e-07,
"tokens_at_max": [
0,
1
]
},
{
"name": "base_model.model.gpt_neox.layers.5.attention.dense",
"max_abs_gap": 2.6226043701171875e-06,
"max_abs_value": 2.8001251220703125,
"relative_rms": 1.49765445058608e-06,
"tokens_at_max": [
0,
120
]
},
{
"name": "base_model.model.gpt_neox.layers.5.mlp.dense_h_to_4h",
"max_abs_gap": 0.0001068115234375,
"max_abs_value": 106.2582778930664,
"relative_rms": 8.56117667176942e-07,
"tokens_at_max": [
0,
0
]
},
{
"name": "base_model.model.gpt_neox.layers.5.mlp.dense_4h_to_h",
"max_abs_gap": 0.000152587890625,
"max_abs_value": 298.2729797363281,
"relative_rms": 5.164617797866939e-07,
"tokens_at_max": [
0,
0
]
},
{
"name": "base_model.model.gpt_neox.layers.5",
"max_abs_gap": 0.000152587890625,
"max_abs_value": 315.3481750488281,
"relative_rms": 5.0503581509296e-07,
"tokens_at_max": [
0,
0
]
},
{
"name": "base_model.model.gpt_neox.layers.6.input_layernorm",
"max_abs_gap": 1.049041748046875e-05,
"max_abs_value": 22.750995635986328,
"relative_rms": 1.1296391785036883e-06,
"tokens_at_max": [
1,
12
]
},
{
"name": "base_model.model.gpt_neox.layers.6.attention.query_key_value",
"max_abs_gap": 2.47955322265625e-05,
"max_abs_value": 15.281472206115723,
"relative_rms": 8.577515921553595e-07,
"tokens_at_max": [
1,
110
]
},
{
"name": "base_model.model.gpt_neox.layers.6.attention.dense",
"max_abs_gap": 5.7220458984375e-06,
"max_abs_value": 2.2023231983184814,
"relative_rms": 2.1419006113143347e-06,
"tokens_at_max": [
1,
73
]
},
{
"name": "base_model.model.gpt_neox.layers.6.mlp.dense_h_to_4h",
"max_abs_gap": 4.9591064453125e-05,
"max_abs_value": 69.7048110961914,
"relative_rms": 8.476361121962933e-07,
"tokens_at_max": [
1,
113
]
},
{
"name": "base_model.model.gpt_neox.layers.6.mlp.dense_4h_to_h",
"max_abs_gap": 0.0001220703125,
"max_abs_value": 221.91893005371094,
"relative_rms": 4.2181205825063826e-07,
"tokens_at_max": [
0,
12
]
},
{
"name": "base_model.model.gpt_neox.layers.6",
"max_abs_gap": 0.00018310546875,
"max_abs_value": 527.6139526367188,
"relative_rms": 3.37366703633109e-07,
"tokens_at_max": [
1,
0
]
},
{
"name": "base_model.model.gpt_neox.layers.7.input_layernorm",
"max_abs_gap": 1.1444091796875e-05,
"max_abs_value": 22.020517349243164,
"relative_rms": 1.2266026004540486e-06,
"tokens_at_max": [
0,
97
]
},
{
"name": "base_model.model.gpt_neox.layers.7.attention.query_key_value",
"max_abs_gap": 2.6702880859375e-05,
"max_abs_value": 17.947790145874023,
"relative_rms": 7.958362189931992e-07,
"tokens_at_max": [
0,
69
]
},
{
"name": "base_model.model.gpt_neox.layers.7.attention.dense",
"max_abs_gap": 3.933906555175781e-06,
"max_abs_value": 1.61724853515625,
"relative_rms": 2.3181166649748076e-06,
"tokens_at_max": [
0,
91
]
},
{
"name": "base_model.model.gpt_neox.layers.7.mlp.dense_h_to_4h",
"max_abs_gap": 4.1961669921875e-05,
"max_abs_value": 28.31519317626953,
"relative_rms": 9.223035594704969e-07,
"tokens_at_max": [
1,
102
]
},
{
"name": "base_model.model.gpt_neox.layers.7.mlp.dense_4h_to_h",
"max_abs_gap": 2.288818359375e-05,
"max_abs_value": 93.0755386352539,
"relative_rms": 7.229935742750859e-07,
"tokens_at_max": [
1,
1
]
},
{
"name": "base_model.model.gpt_neox.layers.7",
"max_abs_gap": 0.00018310546875,
"max_abs_value": 610.08349609375,
"relative_rms": 3.062196776129802e-07,
"tokens_at_max": [
0,
12
]
},
{
"name": "base_model.model.gpt_neox.layers.8.input_layernorm",
"max_abs_gap": 1.239776611328125e-05,
"max_abs_value": 22.42336082458496,
"relative_rms": 1.3171847499877458e-06,
"tokens_at_max": [
1,
42
]
},
{
"name": "base_model.model.gpt_neox.layers.8.attention.query_key_value",
"max_abs_gap": 2.193450927734375e-05,
"max_abs_value": 16.079593658447266,
"relative_rms": 8.310492928761393e-07,
"tokens_at_max": [
1,
31
]
},
{
"name": "base_model.model.gpt_neox.layers.8.attention.dense",
"max_abs_gap": 5.245208740234375e-06,
"max_abs_value": 1.9146559238433838,
"relative_rms": 2.549789326018744e-06,
"tokens_at_max": [
0,
88
]
},
{
"name": "base_model.model.gpt_neox.layers.8.mlp.dense_h_to_4h",
"max_abs_gap": 1.430511474609375e-05,
"max_abs_value": 13.453221321105957,
"relative_rms": 1.043341547294941e-06,
"tokens_at_max": [
0,
92
]
},
{
"name": "base_model.model.gpt_neox.layers.8.mlp.dense_4h_to_h",
"max_abs_gap": 2.6702880859375e-05,
"max_abs_value": 43.01885223388672,
"relative_rms": 1.3928632553951028e-06,
"tokens_at_max": [
0,
0
]
},
{
"name": "base_model.model.gpt_neox.layers.8",
"max_abs_gap": 0.00018310546875,
"max_abs_value": 651.2010498046875,
"relative_rms": 2.9286490313019525e-07,
"tokens_at_max": [
0,
12
]
},
{
"name": "base_model.model.gpt_neox.layers.9.input_layernorm",
"max_abs_gap": 1.33514404296875e-05,
"max_abs_value": 21.649686813354492,
"relative_rms": 1.3812471431987146e-06,
"tokens_at_max": [
1,
95
]
},
{
"name": "base_model.model.gpt_neox.layers.9.attention.query_key_value",
"max_abs_gap": 2.384185791015625e-05,
"max_abs_value": 16.20388412475586,
"relative_rms": 9.209652383598928e-07,
"tokens_at_max": [
1,
113
]
},
{
"name": "base_model.model.gpt_neox.layers.9.attention.dense",
"max_abs_gap": 1.1682510375976562e-05,
"max_abs_value": 2.6224303245544434,
"relative_rms": 2.365374186658478e-06,
"tokens_at_max": [
1,
115
]
},
{
"name": "base_model.model.gpt_neox.layers.9.mlp.dense_h_to_4h",
"max_abs_gap": 4.00543212890625e-05,
"max_abs_value": 6.431606769561768,
"relative_rms": 1.115543755737856e-06,
"tokens_at_max": [
0,
125
]
},
{
"name": "base_model.model.gpt_neox.layers.9.mlp.dense_4h_to_h",
"max_abs_gap": 3.814697265625e-06,
"max_abs_value": 3.5763766765594482,
"relative_rms": 2.154436825844218e-06,
"tokens_at_max": [
0,
88
]
},
{
"name": "base_model.model.gpt_neox.layers.9",
"max_abs_gap": 0.00018310546875,
"max_abs_value": 652.6787719726562,
"relative_rms": 2.9549747462756005e-07,
"tokens_at_max": [
0,
12
]
},
{
"name": "base_model.model.gpt_neox.layers.10.input_layernorm",
"max_abs_gap": 2.09808349609375e-05,
"max_abs_value": 17.91899299621582,
"relative_rms": 1.4132435302280473e-06,
"tokens_at_max": [
1,
115
]
},
{
"name": "base_model.model.gpt_neox.layers.10.attention.query_key_value",
"max_abs_gap": 2.384185791015625e-05,
"max_abs_value": 21.261045455932617,
"relative_rms": 5.665982918529083e-07,
"tokens_at_max": [
1,
44
]
},
{
"name": "base_model.model.gpt_neox.layers.10.attention.dense",
"max_abs_gap": 9.63360071182251e-06,
"max_abs_value": 1.569810152053833,
"relative_rms": 3.128549887723777e-06,
"tokens_at_max": [
0,
52
]
},
{
"name": "base_model.model.gpt_neox.layers.10.mlp.dense_h_to_4h",
"max_abs_gap": 1.3768672943115234e-05,
"max_abs_value": 4.6699066162109375,
"relative_rms": 1.1452545644526493e-06,
"tokens_at_max": [
0,
86
]
},
{
"name": "base_model.model.gpt_neox.layers.10.mlp.dense_4h_to_h",
"max_abs_gap": 4.887580871582031e-06,
"max_abs_value": 3.4280600547790527,
"relative_rms": 2.118282753326595e-06,
"tokens_at_max": [
1,
40
]
},
{
"name": "base_model.model.gpt_neox.layers.10",
"max_abs_gap": 0.00018310546875,
"max_abs_value": 653.1604614257812,
"relative_rms": 3.0901057637297615e-07,
"tokens_at_max": [
0,
12
]
},
{
"name": "base_model.model.gpt_neox.layers.11.input_layernorm",
"max_abs_gap": 2.6702880859375e-05,
"max_abs_value": 19.567428588867188,
"relative_rms": 1.5301506957535954e-06,
"tokens_at_max": [
1,
115
]
},
{
"name": "base_model.model.gpt_neox.layers.11.attention.query_key_value",
"max_abs_gap": 2.47955322265625e-05,
"max_abs_value": 20.89473533630371,
"relative_rms": 5.913141469587269e-07,
"tokens_at_max": [
0,
52
]
},
{
"name": "base_model.model.gpt_neox.layers.11.attention.dense",
"max_abs_gap": 1.5020370483398438e-05,
"max_abs_value": 1.4854028224945068,
"relative_rms": 5.720062988592867e-06,
"tokens_at_max": [
0,
20
]
},
{
"name": "base_model.model.gpt_neox.layers.11.mlp.dense_h_to_4h",
"max_abs_gap": 1.9252300262451172e-05,
"max_abs_value": 4.626473426818848,
"relative_rms": 1.2416494670691093e-06,
"tokens_at_max": [
0,
52
]
},
{
"name": "base_model.model.gpt_neox.layers.11.mlp.dense_4h_to_h",
"max_abs_gap": 7.838010787963867e-06,
"max_abs_value": 3.216123342514038,
"relative_rms": 2.1928226222461695e-06,
"tokens_at_max": [
0,
119
]
},
{
"name": "base_model.model.gpt_neox.layers.11",
"max_abs_gap": 0.00018310546875,
"max_abs_value": 653.8958129882812,
"relative_rms": 3.4962499400472865e-07,
"tokens_at_max": [
0,
12
]
},
{
"name": "base_model.model.gpt_neox.layers.12.input_layernorm",
"max_abs_gap": 2.6702880859375e-05,
"max_abs_value": 19.953630447387695,
"relative_rms": 1.85824866394271e-06,
"tokens_at_max": [
0,
95
]
},
{
"name": "base_model.model.gpt_neox.layers.12.attention.query_key_value",
"max_abs_gap": 7.534027099609375e-05,
"max_abs_value": 25.511869430541992,
"relative_rms": 6.441257631770359e-07,
"tokens_at_max": [
0,
53
]
},
{
"name": "base_model.model.gpt_neox.layers.12.attention.dense",
"max_abs_gap": 8.687376976013184e-06,
"max_abs_value": 1.8501089811325073,
"relative_rms": 3.882458140525723e-06,
"tokens_at_max": [
0,
52
]
},
{
"name": "base_model.model.gpt_neox.layers.12.mlp.dense_h_to_4h",
"max_abs_gap": 2.9243528842926025e-05,
"max_abs_value": 5.292316436767578,
"relative_rms": 1.3004607673091918e-06,
"tokens_at_max": [
0,
55
]
},
{
"name": "base_model.model.gpt_neox.layers.12.mlp.dense_4h_to_h",
"max_abs_gap": 5.513429641723633e-06,
"max_abs_value": 3.292102575302124,
"relative_rms": 2.271756963434333e-06,
"tokens_at_max": [
0,
52
]
},
{
"name": "base_model.model.gpt_neox.layers.12",
"max_abs_gap": 0.00018310546875,
"max_abs_value": 654.2213745117188,
"relative_rms": 3.57006430552649e-07,
"tokens_at_max": [
0,
12
]
},
{
"name": "base_model.model.gpt_neox.layers.13.input_layernorm",
"max_abs_gap": 3.230571746826172e-05,
"max_abs_value": 19.393434524536133,
"relative_rms": 1.909263612933336e-06,
"tokens_at_max": [
0,
95
]
},
{
"name": "base_model.model.gpt_neox.layers.13.attention.query_key_value",
"max_abs_gap": 7.82012939453125e-05,
"max_abs_value": 45.34965896606445,
"relative_rms": 6.742088395400184e-07,
"tokens_at_max": [
0,
52
]
},
{
"name": "base_model.model.gpt_neox.layers.13.attention.dense",
"max_abs_gap": 4.00543212890625e-05,
"max_abs_value": 1.3778043985366821,
"relative_rms": 1.4170323430909e-05,
"tokens_at_max": [
0,
87
]
},
{
"name": "base_model.model.gpt_neox.layers.13.mlp.dense_h_to_4h",
"max_abs_gap": 5.245208740234375e-05,
"max_abs_value": 6.871615409851074,
"relative_rms": 1.319060742411597e-06,
"tokens_at_max": [
0,
55
]
},
{
"name": "base_model.model.gpt_neox.layers.13.mlp.dense_4h_to_h",
"max_abs_gap": 1.7523765563964844e-05,
"max_abs_value": 4.4081597328186035,
"relative_rms": 2.2920401502975783e-06,
"tokens_at_max": [
0,
103
]
},
{
"name": "base_model.model.gpt_neox.layers.13",
"max_abs_gap": 0.00018310546875,
"max_abs_value": 654.6845092773438,
"relative_rms": 6.383006978575023e-07,
"tokens_at_max": [
0,
12
]
},
{
"name": "base_model.model.gpt_neox.layers.14.input_layernorm",
"max_abs_gap": 5.0731003284454346e-05,
"max_abs_value": 15.851959228515625,
"relative_rms": 3.4389769535013327e-06,
"tokens_at_max": [
0,
54
]
},
{
"name": "base_model.model.gpt_neox.layers.14.attention.query_key_value",
"max_abs_gap": 0.0023956298828125,
"max_abs_value": 524.9828491210938,
"relative_rms": 1.6980361941182705e-06,
"tokens_at_max": [
0,
103
]
},
{
"name": "base_model.model.gpt_neox.layers.14.attention.dense",
"max_abs_gap": 0.00016558170318603516,
"max_abs_value": 1.0486657619476318,
"relative_rms": 8.425267580942004e-05,
"tokens_at_max": [
0,
52
]
},
{
"name": "base_model.model.gpt_neox.layers.14.mlp.dense_h_to_4h",
"max_abs_gap": 6.0558319091796875e-05,
"max_abs_value": 12.988927841186523,
"relative_rms": 2.7181014899203696e-06,
"tokens_at_max": [
0,
103
]
},
{
"name": "base_model.model.gpt_neox.layers.14.mlp.dense_4h_to_h",
"max_abs_gap": 2.485513687133789e-05,
"max_abs_value": 3.8862740993499756,
"relative_rms": 4.962589881621655e-06,
"tokens_at_max": [
0,
89
]
},
{
"name": "base_model.model.gpt_neox.layers.14",
"max_abs_gap": 0.00018310546875,
"max_abs_value": 655.3150634765625,
"relative_rms": 2.3407142598839094e-06,
"tokens_at_max": [
0,
12
]
},
{
"name": "base_model.model.gpt_neox.layers.15.input_layernorm",
"max_abs_gap": 0.00027883052825927734,
"max_abs_value": 22.92913818359375,
"relative_rms": 1.3430483255166066e-05,
"tokens_at_max": [
0,
41
]
},
{
"name": "base_model.model.gpt_neox.layers.15.attention.query_key_value",
"max_abs_gap": 0.006488800048828125,
"max_abs_value": 139.92422485351562,
"relative_rms": 1.2036916294933557e-05,
"tokens_at_max": [
0,
97
]
},
{
"name": "base_model.model.gpt_neox.layers.15.attention.dense",
"max_abs_gap": 7.43865966796875e-05,
"max_abs_value": 1.3831342458724976,
"relative_rms": 3.625781715574378e-05,
"tokens_at_max": [
1,
56
]
},
{
"name": "base_model.model.gpt_neox.layers.15.mlp.dense_h_to_4h",
"max_abs_gap": 0.00019931793212890625,
"max_abs_value": 5.665473937988281,
"relative_rms": 7.50701560180638e-06,
"tokens_at_max": [
0,
52
]
},
{
"name": "base_model.model.gpt_neox.layers.15.mlp.dense_4h_to_h",
"max_abs_gap": 8.547306060791016e-05,
"max_abs_value": 4.346837043762207,
"relative_rms": 1.3999888403926353e-05,
"tokens_at_max": [
0,
97
]
},
{
"name": "base_model.model.gpt_neox.layers.15",
"max_abs_gap": 0.00018310546875,
"max_abs_value": 655.3131103515625,
"relative_rms": 2.482563719472909e-06,
"tokens_at_max": [
0,
12
]
},
{
"name": "base_model.model.gpt_neox.layers.16.input_layernorm",
"max_abs_gap": 0.0002689361572265625,
"max_abs_value": 21.729997634887695,
"relative_rms": 1.427318532949177e-05,
"tokens_at_max": [
0,
52
]
},
{
"name": "base_model.model.gpt_neox.layers.16.attention.query_key_value",
"max_abs_gap": 0.0004915595054626465,
"max_abs_value": 23.044898986816406,
"relative_rms": 4.997375187330916e-06,
"tokens_at_max": [
0,
52
]
},
{
"name": "base_model.model.gpt_neox.layers.16.attention.dense",
"max_abs_gap": 0.00015783309936523438,
"max_abs_value": 4.56437873840332,
"relative_rms": 1.1724904298667388e-05,
"tokens_at_max": [
0,
50
]
},
{
"name": "base_model.model.gpt_neox.layers.16.mlp.dense_h_to_4h",
"max_abs_gap": 0.00031185150146484375,
"max_abs_value": 6.300185680389404,
"relative_rms": 8.838814879083553e-06,
"tokens_at_max": [
0,
50
]
},
{
"name": "base_model.model.gpt_neox.layers.16.mlp.dense_4h_to_h",
"max_abs_gap": 0.00012946128845214844,
"max_abs_value": 6.584473609924316,
"relative_rms": 1.0129479528988861e-05,
"tokens_at_max": [
0,
52
]
},
{
"name": "base_model.model.gpt_neox.layers.16",
"max_abs_gap": 0.00031185150146484375,
"max_abs_value": 655.0548095703125,
"relative_rms": 2.479992946757285e-06,
"tokens_at_max": [
0,
97
]
},
{
"name": "base_model.model.gpt_neox.layers.17.input_layernorm",
"max_abs_gap": 0.0004596710205078125,
"max_abs_value": 23.75990867614746,
"relative_rms": 1.0536914198510197e-05,
"tokens_at_max": [
0,
97
]
},
{
"name": "base_model.model.gpt_neox.layers.17.attention.query_key_value",
"max_abs_gap": 0.0078125,
"max_abs_value": 529.2301025390625,
"relative_rms": 3.43890319689903e-06,
"tokens_at_max": [
1,
59
]
},
{
"name": "base_model.model.gpt_neox.layers.17.attention.dense",
"max_abs_gap": 0.00044989585876464844,
"max_abs_value": 2.889995813369751,
"relative_rms": 9.471994456296235e-05,
"tokens_at_max": [
1,
45
]
},
{
"name": "base_model.model.gpt_neox.layers.17.mlp.dense_h_to_4h",
"max_abs_gap": 0.00016158819198608398,
"max_abs_value": 8.377714157104492,
"relative_rms": 7.44798405799073e-06,
"tokens_at_max": [
0,
53
]
},
{
"name": "base_model.model.gpt_neox.layers.17.mlp.dense_4h_to_h",
"max_abs_gap": 0.0001653432846069336,
"max_abs_value": 9.393798828125,
"relative_rms": 1.005812357658865e-05,
"tokens_at_max": [
1,
90
]
},
{
"name": "base_model.model.gpt_neox.layers.17",
"max_abs_gap": 0.0004425048828125,
"max_abs_value": 654.2085571289062,
"relative_rms": 4.812363785763232e-06,
"tokens_at_max": [
1,
45
]
},
{
"name": "base_model.model.gpt_neox.layers.18.input_layernorm",
"max_abs_gap": 0.0003428459167480469,
"max_abs_value": 19.94373321533203,
"relative_rms": 1.755606939902383e-05,
"tokens_at_max": [
0,
64
]
},
{
"name": "base_model.model.gpt_neox.layers.18.attention.query_key_value",
"max_abs_gap": 0.015289306640625,
"max_abs_value": 642.1129760742188,
"relative_rms": 5.656620668088673e-06,
"tokens_at_max": [
1,
45
]
},
{
"name": "base_model.model.gpt_neox.layers.18.attention.dense",
"max_abs_gap": 0.00048357248306274414,
"max_abs_value": 1.7377463579177856,
"relative_rms": 0.00021125798172512162,
"tokens_at_max": [
0,
55
]
},
{
"name": "base_model.model.gpt_neox.layers.18.mlp.dense_h_to_4h",
"max_abs_gap": 0.0004303455352783203,
"max_abs_value": 17.204357147216797,
"relative_rms": 1.3865520576973268e-05,
"tokens_at_max": [
0,
64
]
},
{
"name": "base_model.model.gpt_neox.layers.18.mlp.dense_4h_to_h",
"max_abs_gap": 0.00020122528076171875,
"max_abs_value": 6.786255836486816,
"relative_rms": 1.7051635067257892e-05,
"tokens_at_max": [
0,
64
]
},
{
"name": "base_model.model.gpt_neox.layers.18",
"max_abs_gap": 0.0006084442138671875,
"max_abs_value": 651.4319458007812,
"relative_rms": 7.828664512375922e-06,
"tokens_at_max": [
0,
97
]
},
{
"name": "base_model.model.gpt_neox.layers.19.input_layernorm",
"max_abs_gap": 0.0005931854248046875,
"max_abs_value": 21.731918334960938,
"relative_rms": 2.3317123460363254e-05,
"tokens_at_max": [
1,
91
]
},
{
"name": "base_model.model.gpt_neox.layers.19.attention.query_key_value",
"max_abs_gap": 0.01470947265625,
"max_abs_value": 640.523681640625,
"relative_rms": 6.234064354285566e-06,
"tokens_at_max": [
1,
45
]
},
{
"name": "base_model.model.gpt_neox.layers.19.attention.dense",
"max_abs_gap": 0.0006557703018188477,
"max_abs_value": 3.9767050743103027,
"relative_rms": 0.0001741164203792999,
"tokens_at_max": [
0,
53
]
},
{
"name": "base_model.model.gpt_neox.layers.19.mlp.dense_h_to_4h",
"max_abs_gap": 0.0007228851318359375,
"max_abs_value": 25.261152267456055,
"relative_rms": 1.8904776281187993e-05,
"tokens_at_max": [
0,
53
]
},
{
"name": "base_model.model.gpt_neox.layers.19.mlp.dense_4h_to_h",
"max_abs_gap": 0.00042748451232910156,
"max_abs_value": 11.329166412353516,
"relative_rms": 2.4512984017610178e-05,
"tokens_at_max": [
1,
110
]
},
{
"name": "base_model.model.gpt_neox.layers.19",
"max_abs_gap": 0.0008945465087890625,
"max_abs_value": 645.1903076171875,
"relative_rms": 1.203310962096045e-05,
"tokens_at_max": [
1,
91
]
},
{
"name": "base_model.model.gpt_neox.layers.20.input_layernorm",
"max_abs_gap": 0.001544952392578125,
"max_abs_value": 36.4130744934082,
"relative_rms": 3.1718175646449605e-05,
"tokens_at_max": [
1,
91
]
},
{
"name": "base_model.model.gpt_neox.layers.20.attention.query_key_value",
"max_abs_gap": 0.0182037353515625,
"max_abs_value": 602.9384155273438,
"relative_rms": 1.5172176411536552e-05,
"tokens_at_max": [
1,
45
]
},
{
"name": "base_model.model.gpt_neox.layers.20.attention.dense",
"max_abs_gap": 0.0007804743945598602,
"max_abs_value": 5.991945743560791,
"relative_rms": 0.00013436755596297518,
"tokens_at_max": [
0,
121
]
},
{
"name": "base_model.model.gpt_neox.layers.20.mlp.dense_h_to_4h",
"max_abs_gap": 0.0014348030090332031,
"max_abs_value": 24.034454345703125,
"relative_rms": 2.4666129808496448e-05,
"tokens_at_max": [
0,
64
]
},
{
"name": "base_model.model.gpt_neox.layers.20.mlp.dense_4h_to_h",
"max_abs_gap": 0.00039196014404296875,
"max_abs_value": 14.84354019165039,
"relative_rms": 3.497911510194846e-05,
"tokens_at_max": [
1,
122
]
},
{
"name": "base_model.model.gpt_neox.layers.20",
"max_abs_gap": 0.001430511474609375,
"max_abs_value": 630.1370849609375,
"relative_rms": 1.4716079361052543e-05,
"tokens_at_max": [
1,
91
]
},
{
"name": "base_model.model.gpt_neox.layers.21.input_layernorm",
"max_abs_gap": 0.001735687255859375,
"max_abs_value": 24.415802001953125,
"relative_rms": 3.634903747302999e-05,
"tokens_at_max": [
1,
50
]
},
{
"name": "base_model.model.gpt_neox.layers.21.attention.query_key_value",
"max_abs_gap": 0.044678688049316406,
"max_abs_value": 775.98193359375,
"relative_rms": 2.328359783220885e-05,
"tokens_at_max": [
0,
53
]
},
{
"name": "base_model.model.gpt_neox.layers.21.attention.dense",
"max_abs_gap": 0.0029993057250976562,
"max_abs_value": 6.722148418426514,
"relative_rms": 0.00015889388385582882,
"tokens_at_max": [
0,
35
]
},
{
"name": "base_model.model.gpt_neox.layers.21.mlp.dense_h_to_4h",
"max_abs_gap": 0.0010929107666015625,
"max_abs_value": 27.890026092529297,
"relative_rms": 2.8264523906795763e-05,
"tokens_at_max": [
0,
109
]
},
{
"name": "base_model.model.gpt_neox.layers.21.mlp.dense_4h_to_h",
"max_abs_gap": 0.0006766319274902344,
"max_abs_value": 62.54146194458008,
"relative_rms": 2.9184409647138402e-05,
"tokens_at_max": [
1,
120
]
},
{
"name": "base_model.model.gpt_neox.layers.21",
"max_abs_gap": 0.002902984619140625,
"max_abs_value": 566.9014892578125,
"relative_rms": 2.029851506860881e-05,
"tokens_at_max": [
0,
35
]
},
{
"name": "base_model.model.gpt_neox.layers.22.input_layernorm",
"max_abs_gap": 0.0030372142791748047,
"max_abs_value": 27.241514205932617,
"relative_rms": 4.0577211814317626e-05,
"tokens_at_max": [
1,
106
]
},
{
"name": "base_model.model.gpt_neox.layers.22.attention.query_key_value",
"max_abs_gap": 0.06003570556640625,
"max_abs_value": 898.0181274414062,
"relative_rms": 2.33898064413216e-05,
"tokens_at_max": [
1,
106
]
},
{
"name": "base_model.model.gpt_neox.layers.22.attention.dense",
"max_abs_gap": 0.0027146339416503906,
"max_abs_value": 3.661842107772827,
"relative_rms": 0.0003161599747251391,
"tokens_at_max": [
1,
83
]
},
{
"name": "base_model.model.gpt_neox.layers.22.mlp.dense_h_to_4h",
"max_abs_gap": 0.0011353492736816406,
"max_abs_value": 16.722763061523438,
"relative_rms": 3.3983399807033945e-05,
"tokens_at_max": [
0,
64
]
},
{
"name": "base_model.model.gpt_neox.layers.22.mlp.dense_4h_to_h",
"max_abs_gap": 0.0008884668350219727,
"max_abs_value": 292.5569763183594,
"relative_rms": 1.4793545917842143e-05,
"tokens_at_max": [
0,
35
]
},
{
"name": "base_model.model.gpt_neox.layers.22",
"max_abs_gap": 0.0026607513427734375,
"max_abs_value": 276.8265686035156,
"relative_rms": 4.180718058479702e-05,
"tokens_at_max": [
1,
43
]
},
{
"name": "base_model.model.gpt_neox.layers.23.input_layernorm",
"max_abs_gap": 0.0040607452392578125,
"max_abs_value": 53.87395095825195,
"relative_rms": 5.154414657782089e-05,
"tokens_at_max": [
0,
96
]
},
{
"name": "base_model.model.gpt_neox.layers.23.attention.query_key_value",
"max_abs_gap": 0.07127568125724792,
"max_abs_value": 721.5701904296875,
"relative_rms": 3.228014644149212e-05,
"tokens_at_max": [
0,
55
]
},
{
"name": "base_model.model.gpt_neox.layers.23.attention.dense",
"max_abs_gap": 0.001585245132446289,
"max_abs_value": 5.612361431121826,
"relative_rms": 0.00023014131507444877,
"tokens_at_max": [
1,
18
]
},
{
"name": "base_model.model.gpt_neox.layers.23.mlp.dense_h_to_4h",
"max_abs_gap": 0.0037593841552734375,
"max_abs_value": 40.99713897705078,
"relative_rms": 4.110116035797986e-05,
"tokens_at_max": [
0,
55
]
},
{
"name": "base_model.model.gpt_neox.layers.23.mlp.dense_4h_to_h",
"max_abs_gap": 0.0027112960815429688,
"max_abs_value": 269.8653259277344,
"relative_rms": 2.0936656236058123e-05,
"tokens_at_max": [
1,
43
]
},
{
"name": "base_model.model.gpt_neox.layers.23",
"max_abs_gap": 0.00188446044921875,
"max_abs_value": 54.347686767578125,
"relative_rms": 6.879849658004294e-05,
"tokens_at_max": [
1,
50
]
},
{
"name": "base_model.model.gpt_neox.final_layer_norm",
"max_abs_gap": 0.002675771713256836,
"max_abs_value": 50.99740982055664,
"relative_rms": 7.207863419402131e-05,
"tokens_at_max": [
0,
92
]
}
]
}123456{
"timestamp": "2026-11-25T07:46:08+00:00",
"relative_gradient_difference": 1.4164963675817825e-05,
"cosine": 0.9999999999034994,
"max_abs_difference": 1537666745.1381836
}12345678910111213{
"timestamp": "2026-11-25T07:41:15+00:00",
"device": "cpu",
"dtype": "float64",
"initial_trainable_sha256": "1c45ca4d5b3a6cd1b53eadaa7df8af15e21a040a8a61aa7f0e91d1b6f019320b",
"probes_sha256": "7ab2a090e32d3e2d93af10cc9161953f4227dc6e1ff5950d9f59be0a4235da13",
"two_window_cross_entropy": 3.2335151510901134,
"max_logit_abs_difference": 6.341593916658894e-12,
"penalty": 834685395129.9045,
"gradient_norm": 910729436494438.9,
"finite": true,
"probe_seconds": 59.94162890000007
}12345678910111213{
"timestamp": "2026-11-25T07:46:08+00:00",
"device": "cuda",
"dtype": "float64",
"initial_trainable_sha256": "1c45ca4d5b3a6cd1b53eadaa7df8af15e21a040a8a61aa7f0e91d1b6f019320b",
"probes_sha256": "7ab2a090e32d3e2d93af10cc9161953f4227dc6e1ff5950d9f59be0a4235da13",
"two_window_cross_entropy": 3.2335151449211725,
"max_logit_abs_difference": 4.354738791789714e-12,
"penalty": 834685852890.465,
"gradient_norm": 910726918311241.1,
"finite": true,
"probe_seconds": 170.7373062000006
}123456789101112{
"timestamp": "2026-11-25T07:48:18+00:00",
"initial_trainable_sha256": "2bcde9c9e4606ee32e6deab703f5efefa0f5d7bd8fab71ebcf6ef28494900958",
"calibration_seed": 6247,
"draw": 0,
"cpu_fp64_penalty": 11725323512.359177,
"cuda_fp32_penalty": 11725321216.0,
"cpu_fp64_gradient_norm": 519103298466.8055,
"cuda_fp32_gradient_norm": 519103237713.8237,
"relative_gradient_difference": 5.276347670311856e-07,
"gradient_cosine": 0.9999999999998281
}123234567889101112131314151668 unmodified lines85868788888990913 unmodified lines95969798989910010110210310310410510610710810810911011111211311311411511611711811811912012112212312312412512612712812812913013113213313313413513613 unmodified lines1501511521531531541551561571581581591601611621631631641651661671681681691701711721731731741751762 unmodified lines179180181182182183184185186187187188189190191192192193194195196197197198199200201202202203204205206207207208209210{
"checked_at": "2026-11-25T07:33:18+00:00",
"git_revision": "2dec86cf57994a68a02f6026d553bf0eb4d7446a",
"checked_at": "2026-11-25T07:54:35+00:00",
"git_revision": "7412d483aa852eef3bba78ecf33912c8be8a3eb0",
"exit_code": 0,
"cases": [
{
"test": "tests.test_analysis.test_wins_require_both_registered_exact_sign_tests",
"seconds": 0.001,
"seconds": 0.002,
"outcome": "passed"
},
{
"test": "tests.test_analysis.test_second_comparator_failure_and_ties_count_separately",
"seconds": 0.001,
"seconds": 0.002,
"outcome": "passed"
},
{68 unmodified lines },
{
"test": "tests.test_analysis.test_time_matched_comparison_uses_one_validation_population_across_methods",
"seconds": 0.001,
"seconds": 0.002,
"outcome": "passed"
},
{3 unmodified lines },
{
"test": "tests.test_data.test_prefix_candidates_match_exhaustive_jaccard_including_boundary",
"seconds": 0.059,
"seconds": 0.058,
"outcome": "passed"
},
{
"test": "tests.test_data.test_abstract_submission_month_and_base_id_grouping",
"seconds": 0.039,
"seconds": 0.053,
"outcome": "passed"
},
{
"test": "tests.test_data.test_prepare_from_parquet_proves_train_only_fit_packing_and_repair",
"seconds": 0.208,
"seconds": 0.451,
"outcome": "passed"
},
{
"test": "tests.test_derivatives.test_gpu_production_decoder_third_order_update_matches_cpu",
"seconds": 2.558,
"seconds": 2.731,
"outcome": "passed"
},
{
"test": "tests.test_derivatives.test_quartic_penalty_retains_fourth_derivative",
"seconds": 0.002,
"seconds": 0.006,
"outcome": "passed"
},
{
"test": "tests.test_derivatives.test_mixed_cubic_exactly_averages_to_tensor_norm",
"seconds": 0.039,
"seconds": 0.044,
"outcome": "passed"
},
{
"test": "tests.test_derivatives.test_random_probe_generator_gives_independent_directions",
"seconds": 0.175,
"seconds": 0.172,
"outcome": "passed"
},
{
"test": "tests.test_derivatives.test_penalty_supports_linear_loss_and_unused_coordinates[third]",
"seconds": 0.002,
"seconds": 0.003,
"outcome": "passed"
},
{13 unmodified lines },
{
"test": "tests.test_derivatives.test_signed_hessian_trace_and_squared_norm_have_correct_gradients",
"seconds": 0.004,
"seconds": 0.005,
"outcome": "passed"
},
{
"test": "tests.test_derivatives.test_tiny_transformer_against_dense_tensor_and_finite_differences",
"seconds": 1.741,
"seconds": 2.44,
"outcome": "passed"
},
{
"test": "tests.test_derivatives.test_actual_adamw_update_responds_to_the_third_order_term",
"seconds": 0.007,
"seconds": 0.019,
"outcome": "passed"
},
{
"test": "tests.test_derivatives.test_production_story_model_exposes_full_weight_penalty_gradient",
"seconds": 0.054,
"seconds": 0.046,
"outcome": "passed"
},
{
"test": "tests.test_derivatives.test_pythia_adapter_fourth_derivative_and_portable_checkpoint",
"seconds": 4.662,
"seconds": 4.959,
"outcome": "passed",
"measurements": {
"adapter_directional_autograd": "9035.374247002468",2 unmodified lines },
{
"test": "tests.test_derivatives.test_large_finite_gradient_norm_survives_squaring",
"seconds": 0.001,
"seconds": 0.003,
"outcome": "passed"
},
{
"test": "tests.test_derivatives.test_sequential_windows_reproduce_joint_penalty_and_training_gradient",
"seconds": 0.14,
"seconds": 0.109,
"outcome": "passed"
},
{
"test": "tests.test_reporting.test_snapshot_keeps_full_score_and_trace_semantics",
"seconds": 0.017,
"seconds": 0.014,
"outcome": "passed"
},
{
"test": "tests.test_reporting.test_report_before_first_run_keeps_readme_and_emits_protocol_paper",
"seconds": 0.439,
"seconds": 0.586,
"outcome": "passed"
},
{
"test": "tests.test_training.test_randomized_control_preserves_coordinate_magnitudes_and_zero_is_noop",
"seconds": 0.153,
"seconds": 0.134,
"outcome": "passed"
},
{
"test": "tests.test_training.test_step_recovery_matches_uninterrupted_weights",
"seconds": 1.807,
"seconds": 2.016,
"outcome": "passed"
}
]44 unmodified lines4546474849505128 unmodified lines8081828384858687888944 unmodified lines 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")
sub.add_argument("--scoring-batches",action="store_true",help="Benchmark Pythia inference grouping on training windows")
sub.add_argument("--device",default="cuda",help="Device for the optional full pretrained cross-check")
if action=="train":
sub.add_argument("--method",choices=(*METHODS,"unigram","initial"),required=True)28 unmodified lines from .precision import reference_gradient
from .records import setup_device
reference_gradient(project,setup_device(args.device))
if args.scoring_batches:
from .probe_check import benchmark_scoring
from .records import setup_device
benchmark_scoring(project,setup_device(args.device))
return
if args.action=="dashboard":
return dashboard(project,args.port)133 unmodified lines134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163133 unmodified lines return out if isinstance(out, torch.Tensor) else out.logits
def dtype_attention(module,query,key,value,attention_mask,scaling,dropout=0.0,**kwargs):
"""The upstream GPT-NeoX eager attention formula, retaining FP64 at softmax.
https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/modeling_gpt_neox.py
"""
scores = (query @ key.transpose(-2,-1))*scaling
if attention_mask is not None:
scores = scores+attention_mask
weights = F.dropout(scores.softmax(-1),p=dropout,training=module.training)
return (weights @ value).transpose(1,2).contiguous(),weights
def widen_pythia(model):
"""Use the registered eager mask with dtype-preserving attention on this replica only."""
from transformers import AttentionInterface, AttentionMaskInterface
from transformers.masking_utils import eager_mask
# Register both hooks so attention stays causal. https://huggingface.co/docs/transformers/attention_interface
name = "thirdloss_eager_fp64"
AttentionInterface.register(name,dtype_attention)
AttentionMaskInterface.register(name,eager_mask)
model.get_base_model().set_attn_implementation(name)
return model.double().eval()
def trainable_digest(model):
"""Fingerprint each named trainable tensor at initialization to audit seed pairing."""
digest = hashlib.sha256()1 unmodified line234567789101145 unmodified lines5758596061626364656667686970717273597475767778798081828384858687888990919293949596974 unmodified lines1021031041057310610710810911011111211311411511611711811912012186871221231241251261279 unmodified lines1371381391031401411421437 unmodified lines1511521531171541551561571581591601221611621631641651661671281681691701711321721731741751761771781791801371381811821831841 unmodified line
import statistics
import time
import os
import torch
from .models import build_model, logits_of, token_loss, token_nll
from .models import build_model, logits_of, token_loss, token_nll, trainable_digest, widen_pythia
from .penalties import estimate, inner, partials, random_signs, third_contraction
from .records import BATCHES, read_json, sha256, time_now, write_json
from .windows import TrainingWindows, generator, probe_rows45 unmodified lines return inner(mean,mean), tuple(a+b for a,b in zip(grad_first,grad_second,strict=True))
def adapter_derivative_device():
"""The registered laptop uses host FP64 for adapter probes and CUDA for ordinary training."""
return torch.device(os.environ.get("THIRDLOSS_ADAPTER_DERIVATIVE_DEVICE","cpu"))
def derivative_replica(stage,seed,storage):
"""Keep a high-precision frozen backbone for adapter derivatives. Preserve caller RNGs."""
if stage!="abstracts":
return None
devices = [torch.cuda.current_device()] if torch.cuda.is_available() else []
with torch.random.fork_rng(devices=devices):
return widen_pythia(build_model(stage,seed,adapter_derivative_device(),storage))
def probe_gradient(model, parameters, inputs, targets, kind, seed, step):
def probe_gradient(model, parameters, inputs, targets, kind, seed, step, replica=None):
"""Differentiate the sampled penalty, including the fourth-order contraction."""
rng = generator(inputs.device, seed, step, 827)
rows = probe_rows(seed, step, len(inputs))
if replica is not None:
# All arms draw the original CUDA signs. Only the arithmetic and storage of
# the small derivative batch change. Sync every factor at the current optimizer step.
precise = tuple(p for p in replica.parameters() if p.requires_grad)
with torch.no_grad():
for dest,source in zip(precise,parameters,strict=True):
dest.copy_(source)
device = precise[0].device
x,y = inputs[rows].to(device),targets[rows].to(device)
def signs():
return tuple(s.to(device=device,dtype=torch.float64) for s in random_signs(parameters,rng))
u = signs()
if kind=="third":
return two_window_third_gradient(replica,precise,x,y,u,signs())
loss = token_loss(logits_of(replica,x),y)
value = estimate(loss,precise,kind,u=u)
return value.detach(),partials(value,precise,create_graph=False)
if kind == "third" and hasattr(model, "peft_config"):
u, v = random_signs(parameters,rng), random_signs(parameters,rng)
return two_window_third_gradient(model,parameters,inputs[rows],targets[rows],u,v)4 unmodified lines
def calibrate(project, storage, stage, kind, device, microbatch):
"""Fix unit-strength scales for all seeds using only training data at pilot initialization."""
suffix = "-fp64" if stage=="abstracts" else ""
path = project / "results" / "calibration" / f"{stage}-{kind}.json"
path = project / "results" / "calibration" / f"{stage}-{kind}{suffix}.json"
data = storage / "data" / stage
fingerprint = sha256(data/"manifest.json")
if path.exists():
existing = read_json(path)
if existing["data_manifest_sha256"] != fingerprint:
raise ValueError(f"Calibration data changed for {stage}")
if suffix and existing.get("derivative_device") != str(adapter_derivative_device()):
raise ValueError("Adapter calibration uses a different derivative device")
return existing["unit_lambda"]
model = build_model(stage, 0, device, storage)
replica = derivative_replica(stage,0,storage)
parameters = tuple(p for p in model.parameters() if p.requires_grad)
windows = TrainingWindows(data/"train.bin", 6247, BATCHES[stage])
# Each draw has its own data/probe address. A reboot can resume a long calibration
# without mixing corpora, physical batching or old estimator implementations.
work = storage/"calibration"/f"{stage}-{kind}-draws.json"
identity = {"data_manifest_sha256":fingerprint,"microbatch":microbatch,"version":2}
work = storage/"calibration"/f"{stage}-{kind}{suffix}-draws.json"
identity = {"data_manifest_sha256":fingerprint,"microbatch":microbatch,"version":3,
"derivative_device":str(adapter_derivative_device() if replica is not None else device)}
partial = read_json(work) if work.exists() else {**identity,"draws":[]}
if any(partial.get(k)!=v for k,v in identity.items()):
raise ValueError(f"Different settings in partial calibration for {stage} {kind}")9 unmodified lines if device.type == "cuda":
torch.cuda.reset_peak_memory_stats(device)
started = time.perf_counter()
value, grads = probe_gradient(model, parameters, inputs, targets, kind, 6247, step)
value, grads = probe_gradient(model, parameters, inputs, targets, kind, 6247, step,replica)
norm = vector_norm(grads).item()
probe_seconds = time.perf_counter()-started
if not (0 < norm < float("inf") and 0 < ce_norm < float("inf")):7 unmodified lines del grads
result = statistics.median(row["norm_ratio"] for row in rows)
write_json(path, {"stage":stage, "kind":kind, "data_manifest_sha256":fingerprint,
"unit_lambda":result, "draws":rows})
"unit_lambda":result, "draws":rows,"derivative_device":identity["derivative_device"],
"derivative_dtype":"float64" if replica is not None else "float32",
"initial_trainable_sha256":trainable_digest(model)})
work.unlink(missing_ok=True)
return result
def add_penalty(model, parameters, inputs, targets, coefficients, method, seed, step):
def add_penalty(model, parameters, inputs, targets, coefficients, method, seed, step, replica=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)
value, grads = probe_gradient(model, parameters, inputs, targets, kind, seed, step,replica)
raw_norm = vector_norm(grads).item()
if method == "sham":
signs = random_signs(parameters, generator(inputs.device, seed, step, 839))
grads = tuple(g * sign for g, sign in zip(grads, signs, strict=True))
grads = tuple(g * sign.to(g.device) for g, sign in zip(grads, signs, strict=True))
with torch.no_grad():
for param, grad in zip(parameters, grads, strict=True):
if param.grad is None:
param.grad = torch.zeros_like(param)
if replica is None:
param.grad.add_(grad, alpha=8*weight)
else:
# Scale in FP64 before returning the registered contribution to the FP32 optimizer.
param.grad.add_(grad, alpha=8*weight)
telemetry[kind] = {"estimate":value.item(), "raw_grad_norm":raw_norm, "lambda":weight}
param.grad.add_((grad*(8*weight)).to(param))
telemetry[kind] = {"estimate":value.item(), "raw_grad_norm":raw_norm, "lambda":weight,
"probe_seconds":time.perf_counter()-started}
return telemetry12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667681234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253"""Independent, high-precision reference for the first real adapter calibration probe."""
import hashlibimport timefrom unittest.mock import patch
import torch
from .models import build_model, logits_of, token_loss, trainable_digestfrom .objectives import two_window_third_gradientfrom .penalties import random_signsfrom .records import storage_root, time_now, write_jsonfrom .windows import TrainingWindows, generator, probe_rows
def dtype_attention(module,query,key,value,attention_mask,scaling,dropout=0.0,**kwargs): """The upstream eager formula with softmax retaining the study tensor's precision.
https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/modeling_gpt_neox.py """ scores = (query @ key.transpose(-2,-1))*scaling if attention_mask is not None: scores = scores+attention_mask weights = torch.nn.functional.dropout(scores.softmax(-1),p=dropout,training=module.training) return (weights @ value).transpose(1,2).contiguous(),weights
def reference_gradient(project,device): """Generate the production CUDA signs and promote the same pretrained weights to FP64.""" from safetensors.torch import save_file from transformers.models.gpt_neox import modeling_gpt_neox as neox storage=storage_root(project) model=build_model("abstracts",0,device,storage).eval() initial=trainable_digest(model) parameters=tuple(p for p in model.parameters() if p.requires_grad) # Generate signs with the *same* device generator as the observed pilot, also for CPU AD. rng=generator(torch.device("cuda"),6247,0,827) shapes=tuple(torch.empty_like(p,device="cuda") for p in parameters) signs=[tuple(g.to(device=device,dtype=torch.float64) for g in random_signs(shapes,rng)) for _ in range(2)] del shapes,parameters model.double() parameters=tuple(p for p in model.parameters() if p.requires_grad) x,y=TrainingWindows(storage/"data"/"abstracts"/"train.bin",6247,8).get(0,device) rows=probe_rows(6247,0,8) x,y=x[rows],y[rows] # RoPE values are frozen position constants and follow the checkpoint's upstream formula. with patch.object(neox,"eager_attention_forward",dtype_attention): with torch.no_grad(): logits=logits_of(model,x) nll=token_loss(logits,y).item() logit_gap=(logits-torch.cat([logits_of(model,t[None,:]) for t in x])).abs().max().item() del logits started=time.perf_counter() value,gradient=two_window_third_gradient(model,parameters,x,y,*signs) flat=torch.cat([p.detach().flatten().cpu() for p in gradient]) elapsed=time.perf_counter()-started directory=storage/"diagnostics" directory.mkdir(parents=True,exist_ok=True) save_file({"gradient":flat},str(directory/f"pythia-reference-{device.type}.safetensors")) h=hashlib.sha256() for sign in (*signs[0],*signs[1]): h.update(sign.float().cpu().contiguous().numpy().tobytes()) result={"timestamp":time_now(),"device":str(device),"dtype":"float64", "initial_trainable_sha256":initial, "probes_sha256":h.hexdigest(),"two_window_cross_entropy":nll, "max_logit_abs_difference":logit_gap,"penalty":value.item(),"gradient_norm":flat.norm().item(), "finite":bool(flat.isfinite().all()),"probe_seconds":elapsed} write_json(project/"results"/"verification"/f"pythia-fp64-{device.type}.json",result) print(result,flush=True) return result"""Independent, high-precision reference for the first real adapter calibration probe."""
import hashlib
import time
import torch
from .models import build_model, logits_of, token_loss, trainable_digest, widen_pythia
from .objectives import two_window_third_gradient
from .penalties import random_signs
from .records import storage_root, time_now, write_json
from .windows import TrainingWindows, generator, probe_rows
def reference_gradient(project,device):
"""Generate the production CUDA signs and promote the same pretrained weights to FP64."""
from safetensors.torch import save_file
storage=storage_root(project)
model=build_model("abstracts",0,device,storage).eval()
initial=trainable_digest(model)
parameters=tuple(p for p in model.parameters() if p.requires_grad)
# Generate signs with the *same* device generator as the observed pilot, also for CPU AD.
rng=generator(torch.device("cuda"),6247,0,827)
shapes=tuple(torch.empty_like(p,device="cuda") for p in parameters)
signs=[tuple(g.to(device=device,dtype=torch.float64) for g in random_signs(shapes,rng)) for _ in range(2)]
del shapes,parameters
widen_pythia(model)
parameters=tuple(p for p in model.parameters() if p.requires_grad)
x,y=TrainingWindows(storage/"data"/"abstracts"/"train.bin",6247,8).get(0,device)
rows=probe_rows(6247,0,8)
x,y=x[rows],y[rows]
# RoPE values are frozen position constants and follow the checkpoint's upstream formula.
with torch.no_grad():
logits=logits_of(model,x)
nll=token_loss(logits,y).item()
logit_gap=(logits-torch.cat([logits_of(model,t[None,:]) for t in x])).abs().max().item()
del logits
started=time.perf_counter()
value,gradient=two_window_third_gradient(model,parameters,x,y,*signs)
flat=torch.cat([p.detach().flatten().cpu() for p in gradient])
elapsed=time.perf_counter()-started
directory=storage/"diagnostics"
directory.mkdir(parents=True,exist_ok=True)
save_file({"gradient":flat},str(directory/f"pythia-reference-{device.type}.safetensors"))
h=hashlib.sha256()
for sign in (*signs[0],*signs[1]): h.update(sign.float().cpu().contiguous().numpy().tobytes())
result={"timestamp":time_now(),"device":str(device),"dtype":"float64", "initial_trainable_sha256":initial,
"probes_sha256":h.hexdigest(),"two_window_cross_entropy":nll,
"max_logit_abs_difference":logit_gap,"penalty":value.item(),"gradient_norm":flat.norm().item(),
"finite":bool(flat.isfinite().all()),"probe_seconds":elapsed}
write_json(project/"results"/"verification"/f"pythia-fp64-{device.type}.json",result)
print(result,flush=True)
return result77 unmodified lines7879808182838485868788899091929394959697989910010110210310410510610710810977 unmodified lines write_json(project/"results"/"verification"/f"pythia-joint-{device.type}.json",result)
print(result,flush=True)
return result
def benchmark_scoring(project,device):
"""Measure physical inference batch sizes on the same spaced *training* windows."""
from .evaluation import score
storage=storage_root(project)
model=build_model("abstracts",0,device,storage).eval()
path=storage/"data"/"abstracts"/"train.bin"
records=[]
for batch in (2,8,16,32):
score(model,path,device,batch,limit_windows=16)
if device.type=="cuda":
torch.cuda.reset_peak_memory_stats(device)
start=time.perf_counter()
metrics=score(model,path,device,batch,limit_windows=256)
seconds=time.perf_counter()-start
records.append(dict(batch=batch,seconds=seconds,targets_per_second=metrics["tokens"]/seconds,
peak_allocated_mib=torch.cuda.max_memory_allocated(device)/2**20 if device.type=="cuda" else None,**metrics))
reference=records[0]
qualified=[r for r in records[1:] if abs(r["nll"]-reference["nll"])<=2e-6
and abs(r["accuracy"]-reference["accuracy"])*r["tokens"]<=1
and r["targets_per_second"]>=1.1*reference["targets_per_second"]
and (r["peak_allocated_mib"] is None or r["peak_allocated_mib"]<=7*1024)]
chosen=max(qualified,key=lambda r:r["targets_per_second"]) if qualified else reference
result={"timestamp":time_now(),"split":"train","device":str(device),"initial_trainable_sha256":trainable_digest(model),
"records":records,"selected_batch":chosen["batch"]}
write_json(project/"results"/"verification"/"pythia-scoring-batches.json",result)
print(result,flush=True)
return result57 unmodified lines585960616162636457 unmodified lines
def progress(project):
study = study_snapshot(project)
runs = [r for r in study["runs"] if r.get("phase")!="smoke"]
runs = [r for r in study["runs"] if r.get("phase") not in {"smoke","diagnostic"}]
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,18 unmodified lines192021222324252627282930313233343545 unmodified lines818283848586738788899018 unmodified lines return datetime.now(timezone.utc).isoformat(timespec="seconds")
def peak_process_mib():
"""OS process working-set high-water mark, including earlier activity in this interpreter."""
if os.name=="nt":
import psutil
return psutil.Process().memory_info().peak_wset/2**20
import resource
import sys
usage = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
return usage/(2**20 if sys.platform=="darwin" else 1024)
def storage_root(project):
load_dotenv(project / ".env")
root = Path(os.environ.get("THIRDLOSS_STORAGE", "storage")).expanduser()45 unmodified lines
def run_name(stage, method, phase, seed, ratio):
# Preserve the original FP32 adapter pilot under its published ID. Amended derivative
# runs have distinct records, weights, RNG checkpoints and calibrated coefficients.
suffix = "-fp64" if stage=="abstracts" and method in METHODS and method!="ce" else ""
return f"{stage}-{phase}-s{seed:02d}-{method}-r{round(ratio * 100):02d}"
return f"{stage}-{phase}-s{seed:02d}-{method}-r{round(ratio * 100):02d}{suffix}"
def setup_device(requested):80 unmodified lines81828384858687883 unmodified lines929394959697989910080 unmodified lines api.upload_file(repo_id=repo,path_or_fileobj=restart,path_in_repo=f"runs/{run_id}/training_state.pt",
commit_message=f"Archive optimizer, data cursor and random state for {run_id}")
prior = "EleutherAI/pythia-410m" if stage=="abstracts" else "Random initialization"
exclusions = project/"results"/"verification"/"numerical-exclusions.json"
diagnostic = read_json(exclusions).get(run_id) if exclusions.exists() else None
card = (f"# {run_id}\n\n"
f"Research checkpoint for {stage} using the {summary['method']} objective. Base: {prior}. "
f"The run processed {summary['tokens']:,} training targets. Full development NLL was "3 unmodified lines f"[machine-readable results]({GITHUB}/tree/main/results/{run_id}). "
f"The [restart manifest](restart.json) identifies the saved optimizer, data cursor and RNG state. "
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"
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)
api.upload_folder(repo_id=repo,folder_path=folder,path_in_repo="runs/"+run_id,245 unmodified lines246247248249250251252253254255256257258259260261262245 unmodified lines "development checkpoint within the shortest final training time of that seed triple. "
f"{_cite('seeds')} · {_link(REPOSITORY + '/blob/main/reports/preregistration.md', 'Decision rule')}")
p("Results", "heading")
numerical = study.get("numerics",{})
single = numerical.get("pythia-joint-cuda",{})
double = numerical.get("pythia-fp64-agreement",{})
if single and double:
p("Numerical accuracy on the pretrained checkpoint", "subheading")
p(f"For identical Pythia weights and probe signs, changing the FP32 CUDA batching gave a "
f"{100*single['relative_gradient_difference']:.1f}% relative discrepancy in the training gradient. "
f"In FP64 the CPU and GPU gradients agreed to relative error {double['relative_gradient_difference']:.2g}. "
"The initial FP32 pilot is retained as a diagnostic. The amended adapter arms compute their "
"penalties in FP64 on the CPU and use CUDA for the ordinary loss and optimizer updates. "
f"{_link(REPOSITORY + '/blob/main/reports/amendments/adapter-precision.md','Pre-test amendment and raw checks')}")
run_count = len(study["runs"])
done_count = sum(completed(run) for run in study["runs"])
p(f"The ledger contains {run_count} runs and {done_count} completed summaries. "37 unmodified lines3839404142434445464748495063 unmodified lines11411511611411711811912067 unmodified lines1881891901911921931941951961971 unmodified line19920020120220320420520619820720820921037 unmodified lines "freeze_id", "test_manifest_sha256", "test_tokens", "data_manifest_sha256",
"token_budget", "batch_windows", "microbatch", "context", "weights_sha256", "dev_tokens",
"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",
)
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",
)
63 unmodified lines events = read_lines(folder / "events.jsonl")
record = {key: config[key] for key in FIELDS if key in config}
# Calibration can fail before the trainer writes the final configuration.
identity = re.fullmatch(r"(stories|abstracts)-(\w+)-s(\d+)-(\w+)-r(\d+)", folder.name)
identity = re.fullmatch(r"(stories|abstracts)-(\w+)-s(\d+)-(\w+)-r(\d+)(?:-fp64)?", folder.name)
if identity and not config:
stage, phase, seed, method, ratio = identity.groups()
record.update(stage=stage, phase=phase, seed=int(seed), method=method, ratio=int(ratio) / 100)67 unmodified lines for folder in sorted(directory.glob("*")):
if folder.is_dir() and any((folder / f).is_file() for f in ("config.json", "summary.json", "failure.json", "state.json")):
runs.append(run_record(folder))
exclusions = read_json(directory/"verification"/"numerical-exclusions.json")
for run in runs:
if run["id"] in exclusions:
run.update(registered_phase=run["phase"], phase="diagnostic", precision_audit=exclusions[run["id"]])
stages = {stage: analyze_stage(runs, stage) for stage in STAGES}
for run in runs:
run["events_total"] = len(run["events"])1 unmodified line context = {stage: {key: read_json(directory / key / f"{stage}.json")
for key in ("datasets", "selection", "feasibility")} for stage in STAGES}
pilots = {s: pilot_differences(runs, s, context[s]["selection"]) for s in STAGES}
numerics = {key:read_json(directory/"verification"/(key+".json")) for key in
("pythia-joint-cuda","pythia-fp64-agreement","pythia-fp64-cpu","pythia-fp64-cuda","stories-full-gradient")}
return {
"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,
"colors": COLORS, "context": context, "pilot_comparisons": pilots,"numerics":numerics,
}
154 unmodified lines155156157158159160161162163164165166167168169170171172173154 unmodified lines material += ["## Recorded interruptions", _table(
[[failure["timestamp"],failure["error"]] for failure in run["failures"]],
["Time (UTC)","Recorded exception"])]
if run.get("precision_audit"):
material += ["## Numerical diagnostic",run["precision_audit"]["reason"],
"[Precision amendment](../../amendments/adapter-precision.md)"]
if finite(run.get("process_peak_rss_mib")):
material.append(f"The process working-set high-water mark was {fmt(run['process_peak_rss_mib'],1)} MiB. "
"This OS measure includes earlier work in the same interpreter.")
if run["samples"]:
material += ["## Fixed-prompt generations",
*[_sample(sample) for sample in run["samples"]]]
atomic_text(base / key / "experiment.md", "\n\n".join(material) + "\n")
observation = _run_learning(run)
if run.get("precision_audit"):
observation = run["precision_audit"]["reason"]
if run.get("failures"):
observation += f" The run ledger records {len(run['failures'])} interrupted attempt(s)."
atomic_text(base / key / "learnings.md", f"# Run learnings\n\n{observation}\n\n"107 unmodified lines10810911011111111211311442 unmodified lines157158159160161162163164165107 unmodified lines if set(state)!=set(get_peft_model_state_dict(model)):
raise ValueError("Adapter payload does not match the pinned backbone and target modules")
set_peft_model_state_dict(model,state)
stats = score(model,data/"test.bin",device,summary["microbatch"])
stats = score(model,data/"test.bin",device,summary.get("evaluation_batch_windows",summary["microbatch"]))
summary.update(test_nll=stats["nll"],test_accuracy=stats["accuracy"],test_tokens=stats["tokens"],
test_manifest_sha256=sealed["test_sha256"],freeze_id=sealed["freeze_id"],
evaluated_at=time_now())42 unmodified lines return row
for stage in stages:
prepare_stage(project,storage,stage)
if stage=="abstracts" and not (project/"results"/"verification"/"pythia-scoring-batches.json").exists():
from .probe_check import benchmark_scoring
benchmark_scoring(project,device)
run(stage,"third","pilot",0,0.03)
for method in ("initial","unigram"):
run(stage,method,"control",0,0)12 unmodified lines1314151616171818192021109 unmodified lines13113213313413513613713813911 unmodified lines1511521531541551561571581591601611621631646 unmodified lines1711721731741751761773 unmodified lines1811821831761841851861871881891905 unmodified lines1961971981881992002012022031922042052062072082092102112122132142152162032172182192206 unmodified lines22722822923023123223312 unmodified lines
from .evaluation import sample_outputs, score, unigram_distribution
from .models import build_model, export_weights, trainable_digest
from .objectives import add_penalty, calibrate, ce_backward
from .objectives import add_penalty, adapter_derivative_device, calibrate, ce_backward, derivative_replica
from .records import (BATCHES, CONTEXT, HORIZONS, RATIOS, Recorder, json_lines, read_json,
run_name, sha256, time_now, write_json)
peak_process_mib, run_name, sha256, time_now, write_json)
from .windows import TrainingWindows, gate
109 unmodified lines manifest = read_json(data/"manifest.json")
config["data_manifest_sha256"] = sha256(data/"manifest.json")
config["microbatch"] = microbatch
precise = stage=="abstracts" and method not in {"ce","initial","unigram"}
if precise:
config.update(derivative_dtype="float64",derivative_device=str(adapter_derivative_device()))
output = recorder.directory
state_path = output/"state.json"
if not (output/"summary.json").exists():11 unmodified lines torch.cuda.empty_cache()
torch.cuda.reset_peak_memory_stats(device)
model = None if method == "unigram" else build_model(stage,seed,device,storage)
replica = derivative_replica(stage,seed,storage) if precise else None
bench=project/"results"/"verification"/"pythia-scoring-batches.json"
score_batch=read_json(bench)["selected_batch"] if stage=="abstracts" and bench.exists() else microbatch
parameters = tuple(p for p in model.parameters() if p.requires_grad) if model is not None else ()
summary = {**config, "device":str(device), "torch":str(torch.__version__), "platform":platform.platform(),
"gpu":torch.cuda.get_device_name(device) if device.type=="cuda" else None,
"initial_trainable_sha256":trainable_digest(model) if model is not None else None,
"cpu_threads":torch.get_num_threads(),"evaluation_batch_windows":score_batch,
"git_revision":subprocess.check_output(["git","rev-parse","HEAD"],cwd=project,text=True).strip(),
"trainable_parameters":sum(p.numel() for p in parameters)}
batch = BATCHES[stage]6 unmodified lines {"params":[p for p in parameters if p.ndim<=1],"weight_decay":0.0}]
optimizer = torch.optim.AdamW(groups,lr=1e-4,betas=(0.9,0.95),fused=(device.type=="cuda"))
start,elapsed = restore_state(ckpt/"latest.pt",model,optimizer,config,recorder,device)
host_probes = sum(e.get("host_probe_seconds",0.0) for e in json_lines(output/"events.jsonl"))
# Match elapsed-time comparisons with periodic fixed development windows in every arm.
interval = min(128,max(1,steps//16))
for step in range(start,steps):3 unmodified lines 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) if active else {}
terms = add_penalty(model,parameters,inputs,targets,config["coefficients"],method,seed,step,replica) 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)
for group in optimizer.param_groups:5 unmodified lines done = step+1
if done % 8 == 0 or active or done == 1 or done % interval == 0 or done == steps:
row = {"step":done, "tokens":done*batch*CONTEXT, "train_seconds":elapsed, "loss":base.item(),
"accuracy":accuracy.item(), "lr":lr, "gradient_norm":norm.item(),"derivatives":terms}
"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 terms:
row["penalty"] = sum(8*t["lambda"]*t["estimate"] for t in terms.values())
if done%interval == 0 or done==steps:
metrics = score(model,data/"dev.bin",device,microbatch,limit_windows=64)
metrics = score(model,data/"dev.bin",device,score_batch,limit_windows=64)
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)
del optimizer
summary.update(host_probe_seconds=host_probes,training_seconds_excluding_host_probes=max(0.0,elapsed-host_probes))
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()})
def evaluation_progress(row):
write_json(state_path,{"status":"scoring development",**row})
recorder.emit({"split":"dev",**row},"evaluation.jsonl")
validation = score(model,data/"dev.bin",device,microbatch,unigram=dist,progress=evaluation_progress)
validation = score(model,data/"dev.bin",device,score_batch,unigram=dist,progress=evaluation_progress)
# A rerun after final-checkpoint interruption writes each documented sample exactly once.
sample_path = output/"samples.jsonl"
if sample_path.exists():6 unmodified lines summary["matched_dev_nll"] = next(e["dev_nll"] for e in reversed(json_lines(output/"events.jsonl"))
if "dev_nll" in e)
summary.update(tokens=budget,steps=steps,train_seconds=elapsed,tokens_per_sec=budget/elapsed if elapsed else 0,
process_peak_rss_mib=peak_process_mib(),
peak_vram_mb=torch.cuda.max_memory_allocated(device)/2**20 if device.type=="cuda" else 0,
dev_nll=validation["nll"],dev_accuracy=validation["accuracy"],dev_tokens=validation["tokens"],
finished_at=time_now(),status="complete")270 unmodified lines271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301270 unmodified lines set_peft_model_state_dict(fresh, payload)
torch.testing.assert_close(logits_of(fresh, ids), logits_of(model, ids), rtol=0, atol=0)
# The production FP64 replica receives the current optimized factors. Its registered
# mask must prevent future tokens influencing earlier logits in the new attention backend.
from thirdloss.objectives import derivative_replica, probe_gradient
from thirdloss.penalties import random_signs
from thirdloss.windows import generator, probe_rows
monkeypatch.setenv("THIRDLOSS_ADAPTER_DERIVATIVE_DEVICE","cpu")
before = torch.get_rng_state()
replica = derivative_replica("abstracts",27,tmp_path)
assert torch.equal(before,torch.get_rng_state())
y = (ids+1)%17
streamed,streamed_grad = probe_gradient(model,params,ids,y,"third",7,0,replica)
precise = tuple(p for p in replica.parameters() if p.requires_grad)
for source,dest in zip(params,precise,strict=True):
torch.testing.assert_close(dest,source,rtol=0,atol=0)
rows = probe_rows(7,0,len(ids))
probe_rng = generator(ids.device,7,0,827)
a,b = random_signs(params,probe_rng),random_signs(params,probe_rng)
exact = estimate(token_loss(logits_of(replica,ids[rows]),y[rows]),precise,"third",u=a,v=b)
torch.testing.assert_close(streamed,exact.detach(),rtol=1e-10,atol=1e-8)
for observed,expected in zip(streamed_grad,torch.autograd.grad(exact,precise),strict=True):
torch.testing.assert_close(observed,expected,rtol=1e-7,atol=1e-7)
altered=ids.clone()
altered[:,-1]=(altered[:,-1]+4)%17
torch.testing.assert_close(logits_of(replica,ids)[:,:-1],logits_of(replica,altered)[:,:-1],rtol=0,atol=0)
def test_large_finite_gradient_norm_survives_squaring():
"""The real adapter calibration exposed overflow only in the FP32 norm reduction."""863 unmodified lines86486586686786886987018 unmodified lines889890891892893894895863 unmodified lines { name = "matplotlib" },
{ name = "numpy" },
{ name = "peft" },
{ name = "psutil" },
{ name = "pyarrow" },
{ name = "python-dotenv" },
{ name = "reportlab" },18 unmodified lines { name = "matplotlib", specifier = ">=3.10" },
{ name = "numpy", specifier = ">=2" },
{ name = "peft", specifier = ">=0.22,<1" },
{ name = "psutil", specifier = ">=6" },
{ name = "pyarrow", specifier = ">=20" },
{ name = "python-dotenv", specifier = ">=1" },
{ name = "reportlab", specifier = ">=4" },research/.env.example+3
research/README.md+3-1
research/docs/figures/curves.png

Large File Pointer Details
- SHA256: 938b476d37ff940dadec86da45b7e065a516307130787354ebe39d5ae3aa91eb
- Pointer size: 131 Bytes
- Size of remote file: 113 kB

Large File Pointer Details
- SHA256: de2e927c0f2199c1bf6ecbfeace0f2e77699b9def6c4147fc272fc6ed4b25a45
- Pointer size: 131 Bytes
- Size of remote file: 114 kB
research/docs/runbook.md+2
research/docs/study.json
research/pyproject.toml+1-1
research/reports/amendments/adapter-precision.mdAdded+13
research/reports/experiments/abstracts-pilot-s00-third-r03/experiment.md+7-1
research/reports/experiments/abstracts-pilot-s00-third-r03/learnings.md+1-1
research/reports/experiments/experiments.md+1-1
research/reports/experiments/learnings.md+1-1
research/reports/paper.pdf
research/reports/progress.md+3-3
research/reports/summary.md+1-1
research/results/verification/numerical-exclusions.jsonAdded+6
research/results/verification/pythia-batch-activations.jsonAdded+1467
research/results/verification/pythia-fp64-agreement.jsonAdded+6
research/results/verification/pythia-fp64-cpu.jsonAdded+13
research/results/verification/pythia-fp64-cuda.jsonAdded+13
research/results/verification/stories-full-gradient.jsonAdded+12
research/results/verification/tests.json+24-24
research/src/thirdloss/cli.py+5
research/src/thirdloss/models.py+24
research/src/thirdloss/objectives.py+57-12
research/src/thirdloss/precision.py+53-68
research/src/thirdloss/probe_check.py+29
research/src/thirdloss/progress.py+1-1
research/src/thirdloss/records.py+15-1
research/src/thirdloss/release.py+5
research/src/thirdloss/report_paper.py+11
research/src/thirdloss/report_records.py+11-2
research/src/thirdloss/reporting.py+8
research/src/thirdloss/study.py+4-1
research/src/thirdloss/train.py+21-6
research/tests/test_derivatives.py+25
research/uv.lock+2