fractus-cte-atom / docs /TRAINING_LOG.md
thefinalboss's picture
WORK_LOG/TRAINING_LOG: v4 pass finished (6,412,060,672 ids, VAL 2.4483), final ckpt on HF, pod stopped
3b28ed3 verified
|
Raw History Blame Contribute Delete
24.5 kB
# Training log, Oct 2026 (ATOM 1B, AdamW restart)
All entries are from 2026-10-11 unless noted. Only facts recorded during the run are listed. Times are not given.
## Chronology
1. **First run: SGD + repeat term.** Trained with SGD and the `REPEAT_COEF` term. The run diverged: the repeat log-prob plunged and CE degraded (seen at `REPEAT_COEF=0.1`). The term is unbounded.
2. **Restart with `REPEAT_COEF=0`.** The run continued without the repeat term.
3. **Pod expired.** The Vast.ai pod stopped at the contract `end_date`, after about 4.5 hours.
4. **New pod, resume.** A new pod was rented and training resumed from the last checkpoint.
5. **Patches to `scripts/fast4gpu_atom.py`** (applied on the pod; see [`pod_patches.diff`](pod_patches.diff)):
1. Strict checkpoint load fix: batch-dependent carry buffers (`thought_state`, `attn_S`, `attn_z`, `kuramoto_phases`) are replaced by the new engine's buffers on load.
2. Added the missing `ss_prob = ss_prob_at(pos, ss_p0, ss_p1, ss_ramp)` line.
3. Linear LR warmup (`WARMUP_STEPS`).
4. Optimizer state saved to `<ckpt>.opt` (written before the `.pt` and the manifest).
5. Optimizer state reloaded on resume, with a warning if missing.
The pod's script also skips the optimizer step when the gradient norm is non-finite (logged). This guard is not part of the five patch notes.
6. **LR / optimizer tests** (table below). SGD stayed on a plateau whatever the LR. AdamW at 3e-4 trained; AdamW at 1e-3 diverged.
7. **Switch to AdamW.** Current run: `OPT=adamw LR=3e-4 WARMUP_STEPS=800 BATCH=16 SEQ=128 COMPILE=1 PROBE_EVERY=0 SS_RATE=0.25 REPEAT_COEF=0 SAVE_EVERY=10000 ...`
## LR / optimizer tests
| Optimizer | LR | Result |
|---|---|---|
| SGD | 7e-4 | plateau, tf ≈ 3.2 |
| SGD | 3e-3 | plateau, tf ≈ 3.2 |
| SGD | 2e-4 | plateau, tf ≈ 3.2 |
| SGD (61M-id run) | n/a | stayed at tf ≈ 3.3 |
| AdamW | 3e-4 | tf ≈ 2.24 at 1.64M ids, from scratch |
| AdamW | 1e-3 | diverges |
tf = teacher-forced loss. SGD tf ≈ 3.2-3.3 regardless of LR.
## Throughput benchmarks
1x RTX 5090, B=16, SEQ=128.
| Setting | ids/s (wall) |
|---|---|
| Non-compiled | 3.65k |
| `COMPILE=1`, `SS_RATE=1` | ~8.9k |
| `COMPILE=1`, `SS_RATE=0.25` | 13.5k |
| `COMPILE=1`, `SS_RATE=0` | ~16k |
| `COMPILE=1`, AdamW, `SS_RATE=0.25` | ~11.4k |
## Operational notes
- `COMPILE=1` requires `PROBE_EVERY=0`. The probe crashes with `index is on cpu` in `unique40_probe`.
- Resume: set `CKPT_IN` and `START_TOKEN` (= `start_token_next` from the manifest), keep the `.opt` next to the `.pt`, and use `WARMUP_STEPS=0` if the `.opt` is loaded.
- The Hugging Face Hub silently ignores `.pt` files. Checkpoints are stored as `.bin` and optimizer state as `.opt.bin`.
- Hugging Face checkpoint locations (`thefinalboss/fractus-cte-atom`): `checkpoints/atom/` is the current AdamW run; `checkpoints/atom_sgd_61M/` is the archived SGD run.
- Vast.ai: rentals have an `end_date`. Pick offers whose duration covers the whole run.
## 2026-10-12: NaN gradient in `elu_plus_one`
- **Symptom.** The first full-corpus AdamW run (`LR=3e-4`, `WARMUP_STEPS=800`) logged `non-finite grad norm` from step 1769 (~3.6M ids). Within a few hundred steps, nearly every TF and SS step was skipped (about 1.25 skip messages per step). The weights stayed frozen at tf ≈ 2.3 (ema_tf ≈ 2.36) up to ~82M ids. An earlier AdamW run with the same seed crashed at the same point with a device-side assert in `sample_tokens_chunked` (NaN probabilities), because it had no skip guard and the weights became NaN.
- **Cause.** `fractus/nn/stats.py` `elu_plus_one` computed `exp(x)` for all x in the discarded branch of `torch.where`. For x > ~88.7, `exp(x) = inf`, and the backward gives 0 * inf = NaN while the forward stays finite. AdamW pushed the block-0 key pre-activation to 88.9.
- **Reproduction (CPU, frozen checkpoint, B=2, SEQ=128).** Max pre-activation 73.1 gave a finite gradient (norm 15.6). Max 88.9 gave a NaN gradient in `observe.weight`, `blocks.0.attn.w_qkv`, `blocks.0.attn.b_qkv` and `blocks.0.norm_attn`. With the fix, the same inputs gave finite gradients (norms 8.5 to 21.7).
- **Ruled out.** Unbounded carry: documents are ~3.7k ids with a BOS in every lane, so each row resets every ~29 chunks. The repeat term: the SS pass, which has no repeat term, also failed.
- **Fix.** `neg = alpha * (torch.exp(x.clamp(max=0.0)) - 1.0) + 1.0`. Same forward values, finite gradient. Skips now log the first 5 parameter names with non-finite gradients.
- **Restart.** The frozen checkpoints were deleted and the run restarted from scratch with the fix (`MAX_STEPS=2153780`, one pass over every lane, `SAVE_EVERY=5000`).
- **Validation.** Fresh run, 2000 steps, same config: 0 non-finite messages; tf 2.158, ema_tf 2.134 at 4.10M ids (step 2000), past the old failure step.
- **Attention safe division: tested, not kept.** `num / torch.where(safe, den, 1)` in `fractus/nn/attention.py` was forward bit-identical (fp32 and bf16) but TF throughput fell from 12.7k to 9.4k ids/s at step 400. Reverted; it is not needed for the NaN fix.
## 2026-10-12/13: divergences without NaN, guarded restart
- **Run with LR 3e-4 constant (fresh, full corpus).** Mean tf per 100M ids: 2.07 (0-100M), 2.42-2.61 (100-700M). Between 710.2M and 710.7M ids, tf went from 3.03 to 36.65; ema_tf then stayed at ~12-50 (mean tf 13.9 over 700-780M ids). 0 non-finite gradients. Corpus check at the jump position (all 16 lanes): no ids outside 0-265, no zeros, runs of at most 2-3 identical ids, id histogram close to 10M ids earlier. Stopped at 778.2M ids.
- **Resume from 409.6M ids with cosine LR (3e-4 to 3e-5 over 1,953,780 steps), clip 1.0.** Pre-clip grad norm bucket means between 700M and 780M ids: 40.5-60.2, no upward trend. At 788.9M ids gn = 583 (tf 30.3), at 789.7M ids gn = 3,220 (tf 78.9), LR 2.94e-4. Later gn values reached 963,532. Stopped at 849.9M ids. An automatic 10 h push had replaced `checkpoints/atom/` with the diverged 829.4M checkpoint; it was restored to the 409.6M checkpoint.
- **Clipping.** `clip_grad_norm_(..., 1.0)` was active in both runs (it already existed in the script); it did not prevent the divergences.
- **Guarded restart** from the 409.6M checkpoint: LR 1e-4 cosine to 1e-5, 500-step warmup, spike guard (skip when gn > max(300, 10 x EMA)), rollback request after 50 consecutive skipped steps or ema_tf > 4.0 for 1,000 steps (runner restarts from the last good checkpoint at half LR, max 3 times), rotating step checkpoints with a `good/` copy (ema_tf < 3.0, no skip in the last 2,000 steps), and a push loop that uploads only `good/`. Healthy checkpoint archived in `checkpoints/atom_409M_good/`.
## 2026-10-13/17: guarded run, rollbacks, LR offset fix, resume at 2.485B ids
- **Rollbacks.** The guarded run rolled back twice to the last `good/` checkpoint at half LR: on Oct 13 and on Oct 14 (00:57 UTC, 51 consecutive skipped steps at 877.8M ids; LR 5e-5 to 2.5e-5, min 2.5e-6).
- **LR offset fix.** A runner restart reset the cosine schedule to step 0. `scripts/fast4gpu_atom.py` now reads `LR_STEP_OFFSET` and `LR_TOTAL_STEPS` and computes `t = (n + LR_STEP_OFFSET) / LR_TOTAL_STEPS`, so a resume continues the schedule instead of restarting it. The runner (`scripts/atom_runner.py`) stores both values in its state file.
- **Resume.** On Oct 15 (17:22 UTC) the run resumed from the `good/` checkpoint at 2.485B ids with `WARMUP_STEPS=0`, `LR_STEP_OFFSET=785000`, `LR_TOTAL_STEPS=1725158`, 940,158 steps left. Guards (spike skip, rollback request, `good/` checkpoints, push of `good/` only) unchanged.
- **Status (Oct 16).** ~3.61B ids, ~11.3k ids/s wall (TF 82%, SS 17%), LR ~5.2e-6, mem peak 29.3 GB. Expected to finish around Oct 17.
## 2026-10-17: v2 trainer (fast4gpu_atom_v2), resume from atom_final
- **Final v1 run.** Finished Oct 17 16:48 UTC at step 940,158: 4,410,941,440 ids (one full pass over every lane), ema_tf 0.332, 3,199 skipped steps in total, 11,279 ids/s wall (TF 82%, SS 17%). Pushed to HF `checkpoints/atom_final/` (commit `d9baf70`).
- **New file `scripts/fast4gpu_atom_v2.py`** (copy of `fast4gpu_atom.py`, which is unchanged). Every addition is env-gated, and the defaults keep the old behavior:
- `SS_RAMP_ORIGIN_IDS`: the SS probability ramp counts ids from this position. In v1 the ramp ran on absolute ids, so on a resume it was already finished. There is no other cap on the SS probability: `ss_prob_at` clamps to [start, end], and the `0.5 *` in `v4_ss_pass` is a loss weight.
- `CARRY_DECAY` / `CARRY_CLAMP`: scale or norm-clamp `attn_S` and `attn_z` after each chunk (detached). `thought_state` and the Kuramoto phases are not touched.
- `EPOCH_WRAP=1`: `start_token_next` 275,683,840 is exactly the end of each lane (period = ((lane_len-1)//SEQ)*SEQ). The lane offset becomes `off % period`; `START_TOKEN`, `ids_processed` and the manifests stay monotonic; all carries reset at a wrap.
- The log line also prints `ss_p`.
- **New runner and pusher.** `scripts/run_v2.py` (copy of the run8 runner: `/workspace/ckpt_v2`, `run_v2_state.json`, `train_v2.log`, same rollback logic), `scripts/push_good_atom_v2.py` (push_good v2 on `ckpt_v2`, pushes `good/` every 10 h to `checkpoints/atom_v2/` only), `scripts/launch_v2.sh`.
- **LR=0 carry-decay check.** good/ checkpoint, 60 steps, no weight change, TF loss:
| attn_S/attn_z decay per chunk | TF loss |
|---|---|
| 1.0 | 0.5-1.2 |
| 0.99 | 0.8-1.3 |
| 0.97 | 1.0-2.2 |
| 0.9 | 2.2-3.3 |
| 0.5 | 6.6-9.8 |
Uniform is ln 266 = 5.58. The model depends on the absolute size of the carry.
- **Aborted run 1** (decay 0.5, SS_RATE 1.0, SS 0.5->0.85, LR 1e-4 warmup 500): tf 13.7 at step 200, ema_tf 6.7 at step 800, rollback request at step 1000 (ema_tf > 4 for 1000 steps). Stopped.
- **Aborted run 2** (decay 0.97, same otherwise): ema_tf 8.3 / 11.9 / 11.3 / 9.4 at steps 200/400/600/800, 30 skips. Stopped.
- **Isolation tests.** 300 steps each from good/, no runner, scratch dirs. tf / ema_tf / ss at steps 50, 100, 200, 300 (ema starts high because the first chunk starts from an empty carry; "-" = no SS pass on that logged step):
| test | decay | SS_RATE | LR (warmup 500) | step 50 | step 100 | step 200 | step 300 | skips | ids/s |
|---|---|---|---|---|---|---|---|---|---|
| T4 | 1.0 | 0.25 | 2.5e-5 | 0.44 / 16.7 / - | 0.69 / 6.46 / 1.84 | 0.65 / 1.36 / - | 0.63 / 0.78 / - | 1 | 11,585 |
| T1 | 1.0 | 1.0 | 1e-4 | 2.89 / 17.7 / 4.12 | 3.90 / 8.79 / 5.02 | 8.78 / 8.37 / 9.89 | 7.39 / 9.46 / 9.08 | 9 | 7,478 |
| T2 | 1.0 | 0.25 | 1e-4 | 0.46 / 16.7 / - | 0.73 / 6.56 / 1.54 | 2.78 / 2.08 / - | 2.56 / 2.70 / - | 1 | 11,464 |
| T3 | 0.97 | 1.0 | 2.5e-5 | 2.09 / 17.6 / 3.32 | 2.05 / 7.74 / 3.55 | 4.06 / 3.91 / 5.38 | 4.34 / 4.06 / 6.17 | 3 | 7,435 |
SS on every step damages TF even at LR 1e-5 (T1, T3). LR 1e-4 also degrades TF on its own (T2). Carry decay 0.97 is not the main factor. 0 non-finite gradients in all tests.
- **Launched run (Oct 17 21:45 UTC) = T4 config.** `CARRY_DECAY=1.0 SS_RATE=0.25 SS_PROB_START=0.5 SS_PROB_END=0.85 SS_RAMP_TOKENS=100000000 SS_RAMP_ORIGIN_IDS=4410941440 EPOCH_WRAP=1`, AdamW LR 2.5e-5 cosine to 2.5e-6, warmup 500, `LR_TOTAL_STEPS=MAX_STEPS=2153780` (one pass), weights and optimizer from `ckpt_full/good/` (step_00940158), `START_TOKEN=275683840`, guards and rollback unchanged, `OUT_DIR=/workspace/ckpt_v2`.
## 2026-10-18: v2 SS_RATE 0.25 -> 0.35
- **Why.** Generation tests at ss_p 0.85 (step_00050000, 4,513,341,440 ids): greedy unique@40 mean 16.3/40 (A:128), below the user's 20/40 threshold. Rule: SS on 10% more of the steps.
- **Change.** Only `SS_RATE` in `run_v2.py` BASE env (0.25 -> 0.35). Unchanged: `SS_PROB_START=0.5 SS_PROB_END=0.85 SS_RAMP_TOKENS=100000000 SS_RAMP_ORIGIN_IDS=4410941440` (so ss_p stays 0.85), `CARRY_DECAY=1.0`, `EPOCH_WRAP=1`, LR 2.5e-5 cosine to 2.5e-6 over `LR_TOTAL_STEPS=2153780`, warmup 500, guards.
- **Resume.** Oct 18 00:33 UTC (20:33 ET) from step_00055000 (4,523,581,440 ids, ema_tf 0.901), weights + optimizer from `/workspace/ckpt_v2_pre_ss035/step_00055000/`, `START_TOKEN=282723840`, `MAX_STEPS=2098780`, `LR_STEP_OFFSET=55000`. Old step dirs moved out of `ckpt_v2/` because the step counter restarts at 0 and step dirs are rotated by name.
- **Effect (first 20 min).** 0 non-finite; lr back at 2.496e-5 after the 500-step warmup; ss_p 0.850; 10,700 ids/s (11,376 before), SS 22-23% of wall time (17% before); ema_tf 0.98-1.39 (0.84-1.05 before); 31 skipped steps in ~6,800 steps. First good ckpt: new step_00005000, 4,533,821,440 ids, ema_tf 1.115. Gen retest: A:128 unique@40 mean 14.0/40 (no change yet).
## 2026-10-18: v2 SS_RATE ladder 0.35 -> 0.50 -> 0.75
Each rung changes only `SS_RATE` in `run_v2.py` (backups `run_v2.py.bak_ss035_20261018_0107`, `.bak_ss050_20261018_0145`). Everything else stays the same: ss_p 0.85 (same ramp and origin), CARRY_DECAY 1.0, LR 2.5e-5 cosine to 2.5e-6 over 2,153,780 total steps with the step offset carried forward, warmup 500, guards. Procedure: stop runner/pusher/trainer right after a good promotion, then move that step dir out of `ckpt_v2/` as the single backup (the step counter restarts and step dirs are rotated by name), delete the previous backup, update `run_v2_state.json`, and run `launch_v2.sh`.
| rung | relaunch (ET) | resume ckpt (ids) | start_token / lr_step_offset / steps_left | ids/s before -> after | SS share | ema_tf after | test result |
|---|---|---|---|---|---|---|---|
| 0.50 | Oct 17 21:07 | 0.35-run step_10000 (4,544,061,440) | 284,003,840 / 65,000 / 2,088,780 | 10,640 -> 9,750 | 23% -> 30% | 1.35-1.76 | step_5000 (4,554,301,440): A:128 14.7/40, CONT B:512 unique 16.3/40, exact 4.3/40, cont TF 1.78 nats/id mean |
| 0.75 | Oct 17 21:44 | 0.50-run step_10000 (4,564,541,440) | 285,283,840 / 75,000 / 2,078,780 | 9,720 -> 8,330 | 30% -> 39% | 1.8-2.45 (1,000 steps, 8,312-8,412 ids/s, 2 skips) | stopped, see below |
0 non-finite gradients after either relaunch.
## 2026-10-18: v2 rollback to HF step_00005000, SS_RATE 0.35
- **Why.** The ladder made TF worse without better free-running output. At 0.50: CONT B:512 unique@40 16.3/40 (0.35 baseline 19.0), exact 4.3/40 (5.7), continuation TF ~1.8 nats/id (~0.9), top-1 0.55 (0.71); short prompts A:128 14.7/40. At 0.75: ema_tf 1.8-2.45 at 8,336 ids/s. The user stopped the ladder and chose to restart from the last HF good checkpoint at SS_RATE 0.35 and not raise SS further.
- **Resume point.** HF `checkpoints/atom_v2/` = first v2 run step_00005000 (SS_RATE 0.25): 4,421,181,440 ids, ema_tf 1.127, start_token_next 276,323,840. Weights + optimizer downloaded to `/workspace/ckpt_v2_from_hf5000/` (renamed `.bin`/`.opt.bin` to `.pt`/`.opt`). All ladder checkpoints (0.35/0.50/0.75) deleted from the pod.
- **Config.** Original T4 config, only `SS_RATE=0.35`: `CARRY_DECAY=1.0 SS_PROB_START=0.5 SS_PROB_END=0.85 SS_RAMP_TOKENS=100000000 SS_RAMP_ORIGIN_IDS=4410941440 EPOCH_WRAP=1`, AdamW LR 2.5e-5 cosine to 2.5e-6, warmup 500, `LR_TOTAL_STEPS=2153780`, `LR_STEP_OFFSET=5000`, `MAX_STEPS=2148780`, `START_TOKEN=276323840`, guards and rollback unchanged.
- **Launch.** Oct 18 01:56:57 UTC (21:56:57 ET Oct 17). Optimizer loaded, ids from 4,421,181,440, ss_p 0.537 (ramps back to 0.85 by 4,510,941,440 ids), lr 2.5e-5 from step 600, ~10,200-10,370 ids/s, SS 25% of wall time, ema_tf 2.12 / 1.31 / 1.15 / 1.71 at steps 200/400/600/800, 2 skips (SS GN spikes) by step 890, 0 non-finite.
## 2026-10-18: disk-full crash at step_50000 save, resume from step_45000
- 04:37:35Z (00:37 ET) torch.save failed (disk full) writing step_50000. Resumed from the validated step_00045000 (4,513,341,440 ids, start_token_next 282,083,840, lr_step_offset 50,000, steps_left 2,103,780); 10.24M ids lost.
- Freed space: HF-download copy (15 GB), stale step_40000 good/ (15 GB), step_50000 .opt, v1 final .opt (on HF). Relaunch 05:08:52Z (01:08 ET), same config. ids/s ~10,700, ss_p 0.850, lr 2.497e-5, ema_tf 1.12-1.33, first save step_05000 OK (4,523,581,440 ids), 34 GB free afterwards.
## 2026-10-18: v3, scheduled sampling on the last 8 ids of each chunk only (SS_TAIL_IDS=8)
- **Why.** At step_60000 (4,636,221,440 ids) of the SS_RATE 0.35 run, TF loss kept improving (CONT TF 0.82 nats/id, top-1 0.76) but free-running generation did not (CONT B:512 unique@40 16.3/40, exact-position 5.7/40). User order: keep SS_RATE 0.35, but apply the model-sampled inputs only to the tail of each chunk and keep the rest teacher-forced.
- **What SS did in v2.** A "chunk" is one training row: SEQ=128 consecutive ids of one lane (B=16 lanes, 2,048 ids/step); the carried state (thought_state, attn_S/attn_z, Kuramoto phases) flows from chunk to chunk of the same lane. Each step runs the TF pass (forward+backward+AdamW step). With probability SS_RATE=0.35 the step also runs an SS pass: the carry is restored to its pre-chunk value, tokens are drawn (T=0.9) from the detached TF hidden at every position, input position t>=1 is replaced by the draw made at t-1 with probability ss_p (0.85, ramp finished), the whole chunk runs again in parallel (one forward, not sequential), loss 0.5*CE(all 128 targets)+lb, second optimizer step. So in v2 ~85% of the inputs of an SS chunk were model draws. "TF 77% / SS 23%" in the log is the wall-time split.
- **Change (v3).** New file `scripts/fast4gpu_atom_v3.py` (copy of v2) with env `SS_TAIL_IDS` (default 0 = v2 behavior, checked bit-identical on the mask). With `SS_TAIL_IDS=8`, the replacement mask is zeroed for input positions 0..119; positions 120..127 are still replaced with probability ss_p by the same one-step draws. Loss, targets, carry handling, SS_RATE, ss_p ramp, LR, guards and checkpoints unchanged. Extra log field `ss_tail` = CE of the SS pass on the last 8 targets. Same cost per SS pass (still one parallel forward), so throughput is unchanged. Runner `scripts/run_v3.py` (ckpt dir `/workspace/ckpt_v3`, log `train_v3.log`), pusher `scripts/push_good_atom_v3.py` (good/ promotion, HF `checkpoints/atom_v3/`).
- **Resume point.** v2 step_00060000: 4,636,221,440 ids, start_token 289,763,840 (start_token_next of its manifest), lr_step_offset 110,000 (v2 segment step N = absolute LR step 50,000 + N, the segment was launched with offset 50,000), steps_left 2,043,780 (2,103,780 - 60,000), lr_total 2,153,780. On the pod the step_60000 files had been rotated away (good/ had moved to step_70000, then step_75000), so the weights were re-uploaded from the box copy (md5 e31433f3cb6587785e34d5e4cf689e99, verified on the pod). Its `.opt` no longer existed anywhere (HF has step_45000/50000 only), so the AdamW moments are those of v2 step_75000 (the newest .opt), with the usual 500-step warmup.
- **Validation.** 400-step scratch run: 0 skips, 0 non-finite, ema_tf 0.649, tf 0.50-0.76, ss 0.72, ss_tail 1.84-2.16 (v2 ss was 2.0-3.0 with the whole chunk mixed), 10,652 ids/s wall, mem_peak 29.2 GB, save path OK.
- **Launch.** v2 trainer/runner/pusher stopped 09:14:27Z (05:14 ET) at ~4,669.8M ids (v2 good/ = step_75000, 4,666,941,440 ids, kept). v3 launched 09:16:38Z (05:16:38 ET). First wall lines: 4,636,631,040 ids at 10,392 ids/s, then 10,510 / 10,481; ema_tf 0.66-0.69 after warmup, 0 skips, 0 non-finite.
- **Retest after +20.48M ids (v3 step_10000, 4,656,701,440 ids).** CONT B:512 unique@40 16/20/18 (mean 18.0, step_60000: 16.3), exact position 2/4/1 (mean 2.3, was 5.7), cont TF C512 0.50 nats/id (was 0.82), top-1 0.85 (was 0.76). B:128 unique 19.3 / exact 4.3, A:128 16.7 / 3.0. The CPU harness varies by ~2 ids between runs on the same weights (see WORK_LOG), so the unique gain is small and the exact-position drop is real but noisy. ema_tf 0.55-0.64, 10 GN-spike skips, 0 non-finite.
## 2026-10-18: corpus v4 (real language) built, trainer v4 prepared (not launched)
- **Why.** The v1-v3 corpus is 99.83% templates with only 243,575 distinct 16-grams in 4.41B ids (`docs/CORPUS_TEMPLATE_AUDIT.md`). The user approved real language datasets.
- **Corpus.** `atom_corpus_v4` holds 1,400,295,456 train ids in 7 shards plus a 5,598,840-id val shard, with identical Atom encoding (linguistic, max span 32, BOS ... EOS per doc, raw int16).
- Mix: FineWeb-Edu 50.0%, Wikipedia 17.9%, TinyStoriesV2 14.3%, PG-19 10.7%, old corpus 7.2%, shuffled at doc level.
- Distinct 16-grams per 100M ids: 75.4M vs 182k for the old corpus.
- On the pod at `/workspace/atom_corpus_v4/`, on HF at `atom_corpus_v4/`. Details in `docs/CORPUS_V4.md`.
- **Trainer v4.** `scripts/fast4gpu_atom_v4.py` (v3 + multi-shard corpus dir, `CORPUS_SWITCH`, `IDS_BASE`, periodic held-out VAL loss) and `scripts/run_v4.py`.
- Resumes weights and AdamW state from the v3 good/ checkpoint at the moment of launch. At build time that was step_00245000 of the v3 segment, 5,137,981,440 ids.
- Starts at lane offset 0 of v4. B=16, SEQ=128, SS_RATE 0.35, SS_TAIL_IDS 8, ss_p 0.85.
- LR 2.35e-5 cosine to 2.5e-6, warmup 500. VAL every 2,500 steps.
- The guards are relaxed for the switch, because v3 scores 19.8-24.7 nats/id on real text (CPU check).
- Installed on the pod, not launched. v3 keeps running.
- **Budget.** A full pass takes 36.7 h / $19.27 at 10.6k ids/s and $0.525/h. Credit was $18.08 at 19:34 ET, so the run should be launched with `PLAN_IDS` ~1.1B (28.8 h, $15.13).
## 2026-10-18 23:05 ET: switch to v4 (real-language corpus)
- **Stop v3.** Runner, pusher and trainer were stopped at 03:05:14Z (23:05 ET). The last v3 log line was at 5,318,205,440 ids.
- Resume point: v3 good/ = v3-segment step_00330000, 5,312,061,440 ids, ema_tf 0.526, saved 02:55Z.
- That checkpoint is not on HF (the last HF v3 push is 5,025,341,440 ids). It is kept on the pod in `ckpt_v3/good/` and hard-linked as `/workspace/ckpt_v4_from_v3/`.
- **Launch v4.** 03:05:23Z (23:05 ET) with `PLAN_IDS=1100000000 bash /workspace/launch_v4.sh`.
- `run_v4.py` -> `scripts/fast4gpu_atom_v4.py`, `CORPUS=/workspace/atom_corpus_v4` (16 lanes of 87,518,466 ids), `CORPUS_SWITCH=1`, `START_TOKEN=0`, `IDS_BASE=5312061440`.
- Weights and AdamW state come from the checkpoint above.
- LR 2.35e-5 cosine to 2.5e-6 over 537,109 steps, warmup 500.
- SS_RATE 0.35, SS_TAIL_IDS 8, ss_p 0.85. B=16, SEQ=128.
- VAL every 2,500 steps on 262,144 held-out ids.
- **First 15 min.**
- VAL before step 1: 16.98 nats/id (v3 on real text).
- ema_tf 12.35 (0.4M ids) -> 5.17 (1.6M) -> 3.79 (6.1M) -> 3.63 (9.4M). tf 2.9-4.6.
- 10,400-10,560 ids/s wall, SS 23-24% of wall time, mem_peak 29.2 GB.
- 0 non-finite, 0 rollbacks.
- 35 isolated GN skips by step ~4,600. Step 0 had gn 1.88M, and there were two more >1M spikes in the 2,000-step grace. After the grace, the threshold is 10x gn_ema (~1,000-1,200). At most 1 consecutive skip.
- **Processes / logs.**
- Processes: `run_v4.py` (`/workspace/run_v4.pid`), `fast4gpu_atom_v4.py` (`/workspace/trainer_v4.pid`), `push_good_atom_v4.py` (`/workspace/push_v4.pid`).
- Logs: `/workspace/train_v4.log`, `/workspace/runner_v4.log`, `/workspace/push_v4.log`, `/workspace/ckpt_v4/val_log.jsonl`.
- Checkpoints in `/workspace/ckpt_v4/`. State in `/workspace/run_v4_state.json`.
### v4 note 00:50 ET Oct 19
- Rollback #1 at 23:46 ET (03:46:51Z): 51 consecutive skipped steps. The runner restarted from `ckpt_v4/good` (20.48M v4 ids) with LR 1.175e-5. The data position kept moving forward (start_token 1,627,904). The runner launched with `opt_in: null`, i.e. without optimizer state.
- Around 00:40 ET the skip count jumped from 26 to 163, with up to 21+ consecutive skips. It subsided before reaching the rollback threshold.
- At 56.4M v4 ids: tf ~2.6-2.7, VAL 2.77 (at 51.6M), 10.57k ids/s.
- Pod disk cleanup: 60 GB free (see WORK_LOG).
## 2026-10-20 04:01 ET: v4 pass finished, pod stopped
- Trainer `fast4gpu_atom_v4.py` exited with code 0 at 08:01:33Z after reaching `PLAN_IDS=1100000000`.
- Final step 524,391: 1,099,999,232 v4 ids, so 6,412,060,672 ids in total (5,312,061,440 from v3 + v4). ema_tf 2.381, 370 skipped steps, no NaN, 1 rollback (Oct 19).
- Validation (held-out real text, 262,144 ids): first 16.98, best 2.4436 (step 502,500), last 2.4483 nats/id (step 522,500).
- Throughput: 10,564 ids/s wall over 101,662 s (TF 13,890 ids/s, SS 16,350 ids/s, SS on the last 8 ids at 0.35).
- HF: final weights + optimizer in `checkpoints/atom_v4/step_final/` (`fractus_atom_1b_gpu0.bin`, `fractus_atom_1b_gpu0.opt.bin`, `RESUME_MANIFEST_atom_gpu0.json`, `GOOD.json`); logs in `logs/atom_v4/`.
- No credit left for more training, so the Vast pod (instance 55477318) was stopped (not destroyed).