BurnyCoder commited on
Commit
ab233ec
·
verified ·
1 Parent(s): 93c0c81

Record development results for abstracts-pilot-s00-third-r03

Browse files
research/README.md CHANGED
@@ -22,7 +22,7 @@ The protocol and run matrix were published before model execution. The scores, c
22
  <!-- RESULTS:START -->
23
  [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)
24
 
25
- Recorded 13 runs, including 12 with a completed summary.
26
 
27
  **TinyStories.** Awaiting paired test results (0 of 8 full-horizon training triplets).
28
 
@@ -34,6 +34,7 @@ Recorded 13 runs, including 12 with a completed summary.
34
 
35
  | Stage | Phase | Method | Ratio | Tokens/run | Runs | Median dev NLL | Median test NLL |
36
  | --- | --- | --- | --- | --- | --- | --- | --- |
 
37
  | TinyStories | control | Initial checkpoint | 0.000 | 0 | 1 | 8.3437 | — |
38
  | TinyStories | control | Unigram | 0.000 | 0 | 1 | 6.0036 | — |
39
  | TinyStories | pilot | Ordinary AdamW | 0.000 | 2,097,152 | 1 | 3.8770 | — |
@@ -55,6 +56,29 @@ Recorded 13 runs, including 12 with a completed summary.
55
 
56
  First archived sample in run-ID order per stage and method. [All continuations](reports/experiments/experiments.md)
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  <details><summary>TinyStories · Initial checkpoint</summary>
59
 
60
  **Prompt**
 
22
  <!-- RESULTS:START -->
23
  [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)
24
 
25
+ Recorded 13 runs, including 13 with a completed summary.
26
 
27
  **TinyStories.** Awaiting paired test results (0 of 8 full-horizon training triplets).
28
 
 
34
 
35
  | Stage | Phase | Method | Ratio | Tokens/run | Runs | Median dev NLL | Median test NLL |
36
  | --- | --- | --- | --- | --- | --- | --- | --- |
37
+ | Research abstracts | pilot | Third derivative | 0.030 | 65,536 | 1 | 3.1168 | — |
38
  | TinyStories | control | Initial checkpoint | 0.000 | 0 | 1 | 8.3437 | — |
39
  | TinyStories | control | Unigram | 0.000 | 0 | 1 | 6.0036 | — |
40
  | TinyStories | pilot | Ordinary AdamW | 0.000 | 2,097,152 | 1 | 3.8770 | — |
 
56
 
57
  First archived sample in run-ID order per stage and method. [All continuations](reports/experiments/experiments.md)
58
 
59
+ <details><summary>Research abstracts · Third derivative</summary>
60
+
61
+ **Prompt**
62
+
63
+ One of the central objectives of contemporary neuroimaging research is to
64
+ create predictive models
65
+
66
+ **Reference continuation**
67
+
68
+ that can disentangle the connection between patterns
69
+ of functional connectivity across the entire brain and various behavioral
70
+ traits. Previous studies have shown that models trained to predict behavioral
71
+ features from the individual's functional
72
+
73
+ **Model continuation**
74
+
75
+ that will accurately predict the behavior of
76
+ patient-specific neurological disorders such as epilepsy. In this paper, we
77
+ present a novel dataset of EEG data recorded from children with focal
78
+ subcortical epilepsy
79
+
80
+ </details>
81
+
82
  <details><summary>TinyStories · Initial checkpoint</summary>
83
 
84
  **Prompt**
research/docs/runbook.md CHANGED
@@ -38,3 +38,5 @@ tokenizer = Tokenizer.from_file(str(folder / "tokenizer.json"))
38
  ```
39
 
40
  For adapter snapshots use `AutoModelForCausalLM.from_pretrained("EleutherAI/pythia-410m", revision="9879c9b5f8bea9051dcb0e68dff21493d67e9d4f")` and load the adapter directory with `PeftModel.from_pretrained(base, folder)`. The published stage repo is `BurnyCoder/thirdloss-pythia-410m-adapters`. [PEFT](https://huggingface.co/docs/peft/en/package_reference/lora)
 
 
 
38
  ```
39
 
40
  For adapter snapshots use `AutoModelForCausalLM.from_pretrained("EleutherAI/pythia-410m", revision="9879c9b5f8bea9051dcb0e68dff21493d67e9d4f")` and load the adapter directory with `PeftModel.from_pretrained(base, folder)`. The published stage repo is `BurnyCoder/thirdloss-pythia-410m-adapters`. [PEFT](https://huggingface.co/docs/peft/en/package_reference/lora)
41
+
42
+ Each fitted run also publishes `training_state.pt` and `restart.json`. The manifest identifies the SHA-256 digest and next data step. This PyTorch checkpoint includes the fitted weights, AdamW state, RNG states and run configuration. Local interruptions resume from `THIRDLOSS_STORAGE/checkpoints/RUN_ID/latest.pt`. To recover a published state on a new machine, regenerate the identical stage data, verify the downloaded checkpoint against `restart.json`, and put it at that location. A completed checkpoint retains the state of the last scheduled update. [Checkpoint and restoration code](../src/thirdloss/train.py)
research/docs/study.json CHANGED
The diff for this file is too large to render. See raw diff
 
research/reports/experiments/abstracts-pilot-s00-third-r03/experiment.md CHANGED
@@ -4,9 +4,9 @@ Run `abstracts-pilot-s00-third-r03` · [raw records](../../../results/abstracts-
4
 
5
  | Stage | Method | Phase | Seed | Ratio | Train tokens | Dev NLL | Test NLL | Tokens/s | Status |
6
  | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
7
- | Research abstracts | Third derivative | pilot | 0 | 0.030 | 65,536 | 3.0909 | — | — | scoring development |
8
 
9
- Training time is 72.3 seconds. Peak allocated GPU memory is — MiB. Development token accuracy is 0.4143. Test token accuracy is —.
10
 
11
  [Design and hyperparameter rationale](../../planned-runs.md) · [Saved configuration](../../../results/abstracts-pilot-s00-third-r03/config.json)
12
 
@@ -15,3 +15,61 @@ Training time is 72.3 seconds. Peak allocated GPU memory is — MiB. Development
15
  | Time (UTC) | Recorded exception |
16
  | --- | --- |
17
  | 2026-11-25T07:00:21+00:00 | FloatingPointError('Nonfinite or zero third calibration norm at draw 0: inf') |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  | Stage | Method | Phase | Seed | Ratio | Train tokens | Dev NLL | Test NLL | Tokens/s | Status |
6
  | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
7
+ | Research abstracts | Third derivative | pilot | 0 | 0.030 | 65,536 | 3.1168 | — | 907 | complete |
8
 
9
+ 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 —.
10
 
11
  [Design and hyperparameter rationale](../../planned-runs.md) · [Saved configuration](../../../results/abstracts-pilot-s00-third-r03/config.json)
12
 
 
15
  | Time (UTC) | Recorded exception |
16
  | --- | --- |
17
  | 2026-11-25T07:00:21+00:00 | FloatingPointError('Nonfinite or zero third calibration norm at draw 0: inf') |
18
+
19
+ ## Fixed-prompt generations
20
+
21
+ **Prompt**
22
+
23
+ One of the central objectives of contemporary neuroimaging research is to
24
+ create predictive models
25
+
26
+ **Reference continuation**
27
+
28
+ that can disentangle the connection between patterns
29
+ of functional connectivity across the entire brain and various behavioral
30
+ traits. Previous studies have shown that models trained to predict behavioral
31
+ features from the individual's functional
32
+
33
+ **Model continuation**
34
+
35
+ that will accurately predict the behavior of
36
+ patient-specific neurological disorders such as epilepsy. In this paper, we
37
+ present a novel dataset of EEG data recorded from children with focal
38
+ subcortical epilepsy
39
+
40
+ **Prompt**
41
+
42
+ In the evolving landscape of computer vision, foundation models have emerged
43
+ as pivotal tools
44
+
45
+ **Reference continuation**
46
+
47
+ , exhibiting exceptional adaptability to a myriad of tasks.
48
+ Among these, the Segment Anything Model (SAM) by Meta AI has distinguished
49
+ itself in image segmentation. However, SAM, like
50
+
51
+ **Model continuation**
52
+
53
+ to study the behavior of computer vision systems.
54
+ These widely adopted modeling approaches tend to be associated with
55
+ a small number of identified object classes. On the one hand, they
56
+ are often effective to
57
+
58
+ **Prompt**
59
+
60
+ We investigate the connection between the turnover frequency in the radio
61
+ spectrum, $\nu
62
+
63
+ **Reference continuation**
64
+
65
+ _{\rm TO}$, and the rate of ionising ultra-violet photons,
66
+ $Q_{\rm HI}$, in extragalactic sources. From a large, optically selected,
67
+ sample we
68
+
69
+ **Model continuation**
70
+
71
+ _{\rm{break}}$, and the spectral index of the underlying
72
+ spectral index $s_{\rm{break}}$, and reveal that there is a universal
73
+ relationship between both quantities,
74
+
75
+ $$\begin
research/reports/experiments/experiments.md CHANGED
@@ -6,7 +6,7 @@ NLL is negative log-likelihood in nats per target token. A smaller value assigns
6
 
7
  | Run | Stage | Method | Phase | Seed | Ratio | Train tokens | Dev NLL | Test NLL | Tokens/s | Status |
8
  | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
9
- | [abstracts-pilot-s00-third-r03](./abstracts-pilot-s00-third-r03/experiment.md) | Research abstracts | Third derivative | pilot | 0 | 0.030 | 65,536 | 3.0909 | — | — | scoring development |
10
  | [stories-control-s00-initial-r00](./stories-control-s00-initial-r00/experiment.md) | TinyStories | Initial checkpoint | control | 0 | 0.000 | 0 | 8.3437 | — | 0 | complete |
11
  | [stories-control-s00-unigram-r00](./stories-control-s00-unigram-r00/experiment.md) | TinyStories | Unigram | control | 0 | 0.000 | 0 | 6.0036 | — | 0 | complete |
12
  | [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 |
 
6
 
7
  | Run | Stage | Method | Phase | Seed | Ratio | Train tokens | Dev NLL | Test NLL | Tokens/s | Status |
8
  | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
9
+ | [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 |
10
  | [stories-control-s00-initial-r00](./stories-control-s00-initial-r00/experiment.md) | TinyStories | Initial checkpoint | control | 0 | 0.000 | 0 | 8.3437 | — | 0 | complete |
11
  | [stories-control-s00-unigram-r00](./stories-control-s00-unigram-r00/experiment.md) | TinyStories | Unigram | control | 0 | 0.000 | 0 | 6.0036 | — | 0 | complete |
12
  | [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 |
research/reports/paper.pdf CHANGED
Binary files a/research/reports/paper.pdf and b/research/reports/paper.pdf differ
 
research/reports/progress.md CHANGED
@@ -1,8 +1,8 @@
1
  # Study progress
2
 
3
- Updated 2026-11-25T07:22:10+00:00.
4
 
5
- 12 training/control records and 0 final evaluations are complete. This is 10.0% of 120 planned model milestones.
6
 
7
  ## Current record
8
 
@@ -12,7 +12,7 @@ Pilot rates project 1.69 remaining confirmation GPU-hours, excluding validation,
12
 
13
  Statistical status: pending. Awaiting confirmatory runs.
14
 
15
- **abstracts** has 0 completed runs. Current records: abstracts-pilot-s00-third-r03 (scoring development, 65,536 targets).
16
 
17
  Statistical status: pending. Awaiting confirmatory runs.
18
 
 
1
  # Study progress
2
 
3
+ Updated 2026-11-25T07:32:41+00:00.
4
 
5
+ 13 training/control records and 0 final evaluations are complete. This is 10.8% of 120 planned model milestones.
6
 
7
  ## Current record
8
 
 
12
 
13
  Statistical status: pending. Awaiting confirmatory runs.
14
 
15
+ **abstracts** has 1 completed runs. The next milestone is determined by the run matrix.
16
 
17
  Statistical status: pending. Awaiting confirmatory runs.
18
 
research/reports/summary.md CHANGED
@@ -1,6 +1,6 @@
1
  # Study summary
2
 
3
- Recorded 13 runs, including 12 with a completed summary.
4
 
5
  **TinyStories.** Awaiting paired test results (0 of 8 full-horizon training triplets).
6
 
@@ -16,6 +16,7 @@ Recorded 13 runs, including 12 with a completed summary.
16
 
17
  | Stage | Phase | Method | Ratio | Tokens/run | Runs | Median dev NLL | Median test NLL |
18
  | --- | --- | --- | --- | --- | --- | --- | --- |
 
19
  | TinyStories | control | Initial checkpoint | 0.000 | 0 | 1 | 8.3437 | — |
20
  | TinyStories | control | Unigram | 0.000 | 0 | 1 | 6.0036 | — |
21
  | TinyStories | pilot | Ordinary AdamW | 0.000 | 2,097,152 | 1 | 3.8770 | — |
 
1
  # Study summary
2
 
3
+ Recorded 13 runs, including 13 with a completed summary.
4
 
5
  **TinyStories.** Awaiting paired test results (0 of 8 full-horizon training triplets).
6
 
 
16
 
17
  | Stage | Phase | Method | Ratio | Tokens/run | Runs | Median dev NLL | Median test NLL |
18
  | --- | --- | --- | --- | --- | --- | --- | --- |
19
+ | Research abstracts | pilot | Third derivative | 0.030 | 65,536 | 1 | 3.1168 | — |
20
  | TinyStories | control | Initial checkpoint | 0.000 | 0 | 1 | 8.3437 | — |
21
  | TinyStories | control | Unigram | 0.000 | 0 | 1 | 6.0036 | — |
22
  | TinyStories | pilot | Ordinary AdamW | 0.000 | 2,097,152 | 1 | 3.8770 | — |
research/results/abstracts-pilot-s00-third-r03/failure.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "timestamp": "2026-11-25T07:00:21+00:00",
3
- "error": "FloatingPointError('Nonfinite or zero third calibration norm at draw 0: inf')"
4
- }
 
 
 
 
 
research/results/abstracts-pilot-s00-third-r03/samples.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {"timestamp": "2026-11-25T07:32:34+00:00", "split": "dev", "prompt": "One of the central objectives of contemporary neuroimaging research is to\ncreate predictive models", "reference": " that can disentangle the connection between patterns\nof functional connectivity across the entire brain and various behavioral\ntraits. Previous studies have shown that models trained to predict behavioral\nfeatures from the individual's functional", "continuation": " that will accurately predict the behavior of\npatient-specific neurological disorders such as epilepsy. In this paper, we\npresent a novel dataset of EEG data recorded from children with focal\nsubcortical epilepsy", "prompt_ids": [4041, 273, 253, 4275, 16566, 273, 13399, 6551, 40270, 2561, 310, 281, 187, 6953, 15970, 3210], "generated_ids": [326, 588, 13613, 3283, 253, 3879, 273, 187, 15325, 14, 6160, 20967, 9360, 824, 347, 29931, 15, 496, 436, 2929, 13, 359, 187, 15068, 247, 4460, 10895, 273, 29253, 941, 5950, 432, 2151, 342, 18560, 187, 2377, 68, 35149, 29931], "tokens": 40, "sampling_seed": 7401, "temperature": 0.8}
2
+ {"timestamp": "2026-11-25T07:32:37+00:00", "split": "dev", "prompt": "In the evolving landscape of computer vision, foundation models have emerged\nas pivotal tools", "reference": ", exhibiting exceptional adaptability to a myriad of tasks.\nAmong these, the Segment Anything Model (SAM) by Meta AI has distinguished\nitself in image segmentation. However, SAM, like", "continuation": " to study the behavior of computer vision systems.\nThese widely adopted modeling approaches tend to be associated with\na small number of identified object classes. On the one hand, they\nare often effective to", "prompt_ids": [688, 253, 25537, 13016, 273, 4382, 8113, 13, 12153, 3210, 452, 13082, 187, 284, 30847, 5657], "generated_ids": [281, 1263, 253, 3879, 273, 4382, 8113, 2718, 15, 187, 6872, 7561, 8671, 14053, 7274, 5257, 281, 320, 2330, 342, 187, 66, 1355, 1180, 273, 3636, 1789, 5971, 15, 1623, 253, 581, 1133, 13, 597, 187, 609, 2223, 3576, 281], "tokens": 40, "sampling_seed": 7402, "temperature": 0.8}
3
+ {"timestamp": "2026-11-25T07:32:39+00:00", "split": "dev", "prompt": "We investigate the connection between the turnover frequency in the radio\nspectrum, $\\nu", "reference": "_{\\rm TO}$, and the rate of ionising ultra-violet photons,\n$Q_{\\rm HI}$, in extragalactic sources. From a large, optically selected,\nsample we", "continuation": "_{\\rm{break}}$, and the spectral index of the underlying\nspectral index $s_{\\rm{break}}$, and reveal that there is a universal\nrelationship between both quantities,\n\n$$\\begin", "prompt_ids": [1231, 7409, 253, 4602, 875, 253, 25759, 4294, 275, 253, 5553, 187, 39862, 13, 669, 3023], "generated_ids": [1126, 1109, 92, 7054, 12460, 285, 253, 9879, 3605, 273, 253, 6944, 187, 18181, 1544, 3605, 370, 84, 1126, 1109, 92, 7054, 12460, 285, 10313, 326, 627, 310, 247, 10898, 187, 46397, 875, 1097, 13483, 13, 187, 187, 7010, 2043], "tokens": 40, "sampling_seed": 7403, "temperature": 0.8}
research/results/abstracts-pilot-s00-third-r03/summary.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": "abstracts-pilot-s00-third-r03",
3
+ "stage": "abstracts",
4
+ "method": "third",
5
+ "phase": "pilot",
6
+ "seed": 0,
7
+ "ratio": 0.03,
8
+ "token_budget": 65536,
9
+ "batch_windows": 8,
10
+ "context": 128,
11
+ "data_manifest_sha256": "0638bd23a7d1dc3ecb9138074ecd922211df2637f60736ddfab7e9aec0b3ccb9",
12
+ "microbatch": 2,
13
+ "coefficients": {
14
+ "third": 8.794990192182448e-22
15
+ },
16
+ "device": "cuda",
17
+ "torch": "2.15.0+cu132",
18
+ "platform": "Windows-11-10.0.26200-SP0",
19
+ "gpu": "NVIDIA GeForce RTX 5070 Laptop GPU",
20
+ "git_revision": "104f21942f53158ba411ff178be284d79965ca62",
21
+ "trainable_parameters": 786432,
22
+ "weights_sha256": "4323b1e0b4aa0b7926fe7b6ed7e4a2ca7ff755a591b77cd79db437cbe1db2a6e",
23
+ "weights_name": "adapter_model.safetensors",
24
+ "matched_dev_nll": 3.09093911992386,
25
+ "tokens": 65536,
26
+ "steps": 64,
27
+ "train_seconds": 72.27489250001236,
28
+ "tokens_per_sec": 906.760255644639,
29
+ "peak_vram_mb": 6369.60888671875,
30
+ "dev_nll": 3.1167960467768983,
31
+ "dev_accuracy": 0.4127544290467482,
32
+ "dev_tokens": 5124071,
33
+ "finished_at": "2026-11-25T07:32:40+00:00",
34
+ "status": "complete"
35
+ }
research/src/thirdloss/cli.py CHANGED
@@ -59,6 +59,7 @@ def parser():
59
  sub.add_argument("--port",type=int,default=8765)
60
  if action=="publish":
61
  sub.add_argument("--message",default="Update third-derivative study records")
 
62
  return p
63
 
64
 
@@ -85,7 +86,11 @@ def main(argv=None):
85
  build_report(project)
86
  progress(project)
87
  if args.action == "publish":
88
- from .release import publish_snapshot
 
 
 
 
89
  print(publish_snapshot(project,args.message))
90
  return
91
  from .study import evaluate_one,freeze,milestone,prepare_stage,run_study
 
59
  sub.add_argument("--port",type=int,default=8765)
60
  if action=="publish":
61
  sub.add_argument("--message",default="Update third-derivative study records")
62
+ sub.add_argument("--checkpoints",action="store_true",help="Republish the fitted checkpoints and restart states in the collection")
63
  return p
64
 
65
 
 
86
  build_report(project)
87
  progress(project)
88
  if args.action == "publish":
89
+ from .release import publish_snapshot, publish_weights
90
+ if args.checkpoints:
91
+ from .records import read_json
92
+ for path in sorted((project/"results").glob("*/summary.json")):
93
+ publish_weights(project,storage,read_json(path))
94
  print(publish_snapshot(project,args.message))
95
  return
96
  from .study import evaluate_one,freeze,milestone,prepare_stage,run_study
research/src/thirdloss/probe_check.py CHANGED
@@ -6,7 +6,7 @@ import time
6
  import torch
7
 
8
  from .models import build_model, logits_of, token_loss, trainable_digest
9
- from .objectives import two_window_third_gradient
10
  from .penalties import estimate, partials, random_signs
11
  from .records import BATCHES, storage_root, time_now, write_json
12
  from .windows import TrainingWindows, generator, probe_rows
@@ -18,9 +18,9 @@ def verify_pretrained(project,device):
18
  model = build_model("abstracts",0,device,storage).eval()
19
  parameters = tuple(p for p in model.parameters() if p.requires_grad)
20
  seed,step = 6247,0
21
- x,y = TrainingWindows(storage/"data"/"abstracts"/"train.bin",seed,BATCHES["abstracts"]).get(step,device)
22
- rows = probe_rows(seed,step,len(x))
23
- x,y = x[rows],y[rows]
24
  rng = generator(device,seed,step,827)
25
  u,v = random_signs(parameters,rng),random_signs(parameters,rng)
26
  def digest(tensors):
@@ -33,8 +33,10 @@ def verify_pretrained(project,device):
33
  "probes_sha256":digest((*u,*v))}
34
  with torch.no_grad():
35
  single = torch.cat([logits_of(model,t[None,:]) for t in x])
36
- result["max_logit_abs_difference"] = (logits_of(model,x)-single).abs().max().item()
37
- del single
 
 
38
  def calculate(implementation):
39
  if device.type=="cuda":
40
  torch.cuda.empty_cache()
@@ -56,6 +58,23 @@ def verify_pretrained(project,device):
56
  result["relative_gradient_difference"] = ((joint-split).norm()/joint.norm()).item()
57
  result["gradient_cosine"] = torch.nn.functional.cosine_similarity(joint,split,dim=0).item()
58
  result["relative_penalty_difference"] = abs(result["joint"]["penalty"]-result["sequential"]["penalty"])/result["joint"]["penalty"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  write_json(project/"results"/"verification"/f"pythia-joint-{device.type}.json",result)
60
  print(result,flush=True)
61
  return result
 
6
  import torch
7
 
8
  from .models import build_model, logits_of, token_loss, trainable_digest
9
+ from .objectives import ce_backward, probe_gradient, two_window_third_gradient
10
  from .penalties import estimate, partials, random_signs
11
  from .records import BATCHES, storage_root, time_now, write_json
12
  from .windows import TrainingWindows, generator, probe_rows
 
18
  model = build_model("abstracts",0,device,storage).eval()
19
  parameters = tuple(p for p in model.parameters() if p.requires_grad)
20
  seed,step = 6247,0
21
+ batch_x,batch_y = TrainingWindows(storage/"data"/"abstracts"/"train.bin",seed,BATCHES["abstracts"]).get(step,device)
22
+ rows = probe_rows(seed,step,len(batch_x))
23
+ x,y = batch_x[rows],batch_y[rows]
24
  rng = generator(device,seed,step,827)
25
  u,v = random_signs(parameters,rng),random_signs(parameters,rng)
26
  def digest(tensors):
 
33
  "probes_sha256":digest((*u,*v))}
34
  with torch.no_grad():
35
  single = torch.cat([logits_of(model,t[None,:]) for t in x])
36
+ together = logits_of(model,x)
37
+ result["max_logit_abs_difference"] = (together-single).abs().max().item()
38
+ result["two_window_cross_entropy"] = token_loss(together,y).item()
39
+ del single,together
40
  def calculate(implementation):
41
  if device.type=="cuda":
42
  torch.cuda.empty_cache()
 
58
  result["relative_gradient_difference"] = ((joint-split).norm()/joint.norm()).item()
59
  result["gradient_cosine"] = torch.nn.functional.cosine_similarity(joint,split,dim=0).item()
60
  result["relative_penalty_difference"] = abs(result["joint"]["penalty"]-result["sequential"]["penalty"])/result["joint"]["penalty"]
61
+ # Repeat the actual production calibration path from a fresh model, including its
62
+ # preceding ordinary-gradient pass and independent regeneration of both probes.
63
+ del parameters,model
64
+ if device.type=="cuda":
65
+ torch.cuda.empty_cache()
66
+ fresh = build_model("abstracts",0,device,storage)
67
+ fresh_parameters = tuple(p for p in fresh.parameters() if p.requires_grad)
68
+ fresh_rng = generator(device,seed,step,827)
69
+ result["repeat_initial_trainable_sha256"] = trainable_digest(fresh)
70
+ result["repeat_probes_sha256"] = digest((*random_signs(fresh_parameters,fresh_rng),*random_signs(fresh_parameters,fresh_rng)))
71
+ ce_backward(fresh,batch_x,batch_y,2)
72
+ fresh.zero_grad(set_to_none=True)
73
+ value,gradient = probe_gradient(fresh,fresh_parameters,batch_x,batch_y,"third",seed,step)
74
+ flat = torch.cat([g.detach().reshape(-1).cpu().double() for g in gradient])
75
+ result["repeat_production_penalty"] = value.item()
76
+ result["repeat_production_gradient_norm"] = flat.norm().item()
77
+ result["repeat_relative_gradient_difference"] = ((flat-split).norm()/split.norm()).item()
78
  write_json(project/"results"/"verification"/f"pythia-joint-{device.type}.json",result)
79
  print(result,flush=True)
80
  return result
research/src/thirdloss/release.py CHANGED
@@ -67,6 +67,19 @@ def publish_weights(project, storage, summary):
67
  folder = storage/"checkpoints"/run_id/"export"
68
  if sha256(folder/summary["weights_name"]) != summary["weights_sha256"]:
69
  raise ValueError(f"Checkpoint integrity failure for {run_id}")
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  prior = "EleutherAI/pythia-410m" if stage=="abstracts" else "Random initialization"
71
  card = (f"# {run_id}\n\n"
72
  f"Research checkpoint for {stage} using the {summary['method']} objective. Base: {prior}. "
@@ -75,6 +88,7 @@ def publish_weights(project, storage, summary):
75
  + (f"Sealed test NLL was {summary['test_nll']:.6f}. " if "test_nll" in summary else "")
76
  + f"See the [protocol]({GITHUB}/blob/main/reports/preregistration.md) and "
77
  f"[machine-readable results]({GITHUB}/tree/main/results/{run_id}). "
 
78
  f"Use the pinned base and loading instructions in [the guide]({GITHUB}/blob/main/docs/runbook.md).\n")
79
  (folder/"README.md").write_text(card,encoding="utf-8")
80
  write_json(folder/"training_summary.json",summary)
@@ -85,6 +99,6 @@ def publish_weights(project, storage, summary):
85
  + ("base_model: EleutherAI/pythia-410m\nlibrary_name: peft\n" if stage=="abstracts" else "library_name: pytorch\n")
86
  + f"---\n# Third-derivative study · {stage}\n\n{description} are stored under "
87
  f"[runs](https://huggingface.co/{repo}/tree/main/runs). Each directory includes its model card, "
88
- f"weights, tokenizer and machine-readable scores. [Study and reproduction guide]({GITHUB})\n")
89
  api.upload_file(repo_id=repo,path_or_fileobj=index.encode(),path_in_repo="README.md",
90
  commit_message=f"Index {stage} checkpoint collection")
 
67
  folder = storage/"checkpoints"/run_id/"export"
68
  if sha256(folder/summary["weights_name"]) != summary["weights_sha256"]:
69
  raise ValueError(f"Checkpoint integrity failure for {run_id}")
70
+ # Keep exports directly loadable for inference and publish the restart payload alongside
71
+ # them. The original state includes AdamW moments, RNGs and the next deterministic data step.
72
+ import torch
73
+ restart = folder.parent/"latest.pt"
74
+ state = torch.load(restart,map_location="cpu",weights_only=True)
75
+ if (state["next_step"]!=summary["steps"] or state["config"]["id"]!=run_id
76
+ or state["config"]["data_manifest_sha256"]!=summary["data_manifest_sha256"]):
77
+ raise ValueError(f"Restart state differs from the completed run {run_id}")
78
+ write_json(folder/"restart.json",{"filename":"training_state.pt","sha256":sha256(restart),
79
+ "next_step":state["next_step"],"data_manifest_sha256":summary["data_manifest_sha256"]})
80
+ del state
81
+ api.upload_file(repo_id=repo,path_or_fileobj=restart,path_in_repo=f"runs/{run_id}/training_state.pt",
82
+ commit_message=f"Archive optimizer, data cursor and random state for {run_id}")
83
  prior = "EleutherAI/pythia-410m" if stage=="abstracts" else "Random initialization"
84
  card = (f"# {run_id}\n\n"
85
  f"Research checkpoint for {stage} using the {summary['method']} objective. Base: {prior}. "
 
88
  + (f"Sealed test NLL was {summary['test_nll']:.6f}. " if "test_nll" in summary else "")
89
  + f"See the [protocol]({GITHUB}/blob/main/reports/preregistration.md) and "
90
  f"[machine-readable results]({GITHUB}/tree/main/results/{run_id}). "
91
+ f"The [restart manifest](restart.json) identifies the saved optimizer, data cursor and RNG state. "
92
  f"Use the pinned base and loading instructions in [the guide]({GITHUB}/blob/main/docs/runbook.md).\n")
93
  (folder/"README.md").write_text(card,encoding="utf-8")
94
  write_json(folder/"training_summary.json",summary)
 
99
  + ("base_model: EleutherAI/pythia-410m\nlibrary_name: peft\n" if stage=="abstracts" else "library_name: pytorch\n")
100
  + f"---\n# Third-derivative study · {stage}\n\n{description} are stored under "
101
  f"[runs](https://huggingface.co/{repo}/tree/main/runs). Each directory includes its model card, "
102
+ f"weights, restart state, tokenizer and machine-readable scores. [Study and reproduction guide]({GITHUB})\n")
103
  api.upload_file(repo_id=repo,path_or_fileobj=index.encode(),path_in_repo="README.md",
104
  commit_message=f"Index {stage} checkpoint collection")