Skip to content

Commit 4770dc8

Browse files
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

File tree

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
{
2+
"fib_positions": [
3+
0,
4+
1,
5+
2,
6+
3,
7+
5,
8+
8,
9+
13,
10+
21,
11+
34,
12+
55,
13+
89
14+
],
15+
"io": {
16+
"dense_tps": 6326071.006453157,
17+
"fib_strided_tps": 615049.2649294924,
18+
"io_speedup": 1.1313399570913787,
19+
"tokens_per_step_ratio": 11.636363636363637
20+
},
21+
"training": {
22+
"dense": {
23+
"final_val": 2.439574755728245,
24+
"wall_time": 165.73717188835144,
25+
"val_history": [
26+
[
27+
0,
28+
93.84651374816895,
29+
0.6487147808074951
30+
],
31+
[
32+
300,
33+
2.9589420706033707,
34+
34.95324182510376
35+
],
36+
[
37+
600,
38+
2.7304074317216873,
39+
67.44706463813782
40+
],
41+
[
42+
900,
43+
2.633310705423355,
44+
99.65429472923279
45+
],
46+
[
47+
1200,
48+
2.5748927742242813,
49+
132.35856246948242
50+
],
51+
[
52+
1499,
53+
2.4448484927415848,
54+
164.80518317222595
55+
]
56+
],
57+
"n_params": 801664
58+
},
59+
"fib_strided": {
60+
"final_val": 2.527419835329056,
61+
"wall_time": 29.47221612930298,
62+
"val_history": [
63+
[
64+
0,
65+
92.4401741027832,
66+
0.11414289474487305
67+
],
68+
[
69+
300,
70+
2.9404813647270203,
71+
5.8881285190582275
72+
],
73+
[
74+
600,
75+
2.710630863904953,
76+
11.654790163040161
77+
],
78+
[
79+
900,
80+
2.5755429416894913,
81+
17.463533639907837
82+
],
83+
[
84+
1200,
85+
2.6059189289808273,
86+
23.19077968597412
87+
],
88+
[
89+
1499,
90+
2.6035294383764267,
91+
29.29991126060486
92+
]
93+
],
94+
"n_params": 801664
95+
}
96+
}
97+
}

0 commit comments

Comments
 (0)