Commit 4770dc8
committed
transformerless_lm: lazy-loading validated (5.6x speedup) + lazy-training bench
LAZY-LOADING RESULT (per the prior bench, now committed):
dense : 1500 steps in 165.7s -> val 2.4396 (baseline)
fib_strided : 1500 steps in 29.5s -> val 2.5274
5.62x wall-clock speedup at +3.6% val loss. The Fibonacci-strided
data loader reads ~10 tokens per "effective" 128-position window
({0, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89}); same trained model
converges nearly as well from 11x sparser IO.
This commit adds the lazy-TRAINING bench (train_lazy_training.py) with
three Fibonacci-frequency mechanisms tested separately and merged:
v1 (FFPU) : Frequency-Folded Parameter Updates -- each tensor
gets a Fibonacci tier; optimizer.step() applies
its update with probability 1/F(tier) per step.
Expected to give modest speedup since optimizer
step is ~1% of training cost (most cost is in
forward/backward FLOPs, not the param-update).
v2 (StoFib-Depth) : Stochastic Fibonacci depth -- block at depth i
is active with prob 1/F(i+1). Block 0 always
runs; block 1 runs 1/2 the time; block 2 runs
1/3 the time. Saves forward AND backward FLOPs
on inactive blocks.
v3 (FibCurriculum): Fibonacci curriculum -- seq_len grows through
stages {11, 21, 34, 55, 89, 128}. Early steps
work with tiny sequences (cheap); late steps
are full cost. Equal step count per stage.
merged_all : All three composed. Expected biggest speedup at
greatest loss penalty unless principles are
gracefully compatible.
Each variant compared to a dense_baseline at matched 1500-step count;
wall-clock, val loss, and "Δval%" reported. Validation threshold:
within +10% val vs baseline at a >1.1x speedup.1 parent a41fd57 commit 4770dc8
2 files changed
Lines changed: 475 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
0 commit comments