Cukinator commited on
Commit
8f4b2d7
Β·
verified Β·
1 Parent(s): 2cb6c4e

Update README: recalculated metrics 2026-06-12

Browse files
Files changed (1) hide show
  1. README.md +69 -196
README.md CHANGED
@@ -1,196 +1,69 @@
1
- ---
2
- language:
3
- - en
4
- license: apache-2.0
5
- tags:
6
- - pytorch
7
- - text-generation
8
- - 1.58bit
9
- - ternary
10
- - byte-level
11
- - mlgru
12
- - ablation
13
- library_name: pytorch
14
- pipeline_tag: text-generation
15
- model_type: custom
16
- ---
17
-
18
- # CPU-1 Ablation Study β€” Ready-to-use Checkpoints (fp32 unpacked)
19
-
20
- Repo: `Cukinator/cpu1-ablations-final`
21
- Source: [`Cukinator/cpu1-ablation-checkpoints`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints) (compact 2-bit, raw training output)
22
- Code: [github.com/Cukinator/1.58bits](https://github.com/Cukinator/1.58bits)
23
- Dataset: [`Cukinator/cpu1-ablation-dataset`](https://huggingface.co/datasets/Cukinator/cpu1-ablation-dataset)
24
-
25
- Each checkpoint is a standard PyTorch `.pt` file with **float32 weights** β€”
26
- no unpacking needed. Compatible with `train_ablation.py` from the
27
- [1.58bits repo](https://github.com/Cukinator/1.58bits).
28
-
29
- Currently uploaded: **20 trained runs**. The remaining `*_r2` 39M runs and
30
- the four `*_r3` configs are queued but not yet trained / not yet unpacked.
31
-
32
- ## Quick start
33
-
34
- ```python
35
- import torch, sys
36
- sys.path.insert(0, "/path/to/1.58bits")
37
- from train_ablation import build_ablation_model, generate
38
-
39
- ckpt = torch.load("run_02/model.pt", map_location="cpu")
40
- model = build_ablation_model(ckpt["config"])
41
- model.load_state_dict(ckpt["state_dict"])
42
- model.eval()
43
-
44
- text = generate(model, "The quick brown fox", 128, ckpt["config"], torch.device("cpu"))
45
- print(text)
46
- ```
47
-
48
- ## Ablation chain β€” 50M runs (round 1, 2 tok/param)
49
-
50
- | Run | Architecture | Params | Val Loss | Perplexity | Throughput (P/s, CPU) |
51
- |-----|-------------|-------:|---------:|-----------:|----------------------:|
52
- | run_01 | Transformer + BPE (16K vocab) + FP16 | 54.7M | **4.66** | 106.1 | 72.4 |
53
- | run_02a_byte_only_heads | Transformer + Byte + 4 indep. heads (no LBD) | 38.5M | **2.31** | 10.1 | 84.8 |
54
- | run_02 | Transformer + Byte + LocalByteDecoder | 38.8M | **1.72** | **5.56** | 75.4 |
55
- | run_03 | MLGRU + Byte + FP16 | 38.8M | **1.87** | 6.49 | 58.0 |
56
- | run_04 | MLGRU + Byte + Ternary | 38.9M | 5.57 | 261.7 | 9.1 |
57
- | run_05 | + FPResidual | 39.0M | 5.55 | 257.7 | 9.7 |
58
- | run_05b_kernel_strict | MLGRU kernel-strict (no W_o) | 35.8M | 5.59 | 268.8 | 10.2 |
59
- | run_06 | + Bolmo patch embedding | 39.0M | 5.56 | 258.8 | 9.1 |
60
- | run_07 | + DeleteGate (CPU-1 complete) | 39.0M | 5.56 | 258.8 | 7.3 |
61
- | run_08 | Folded Transformer + Byte + Ternary | 38.9M | 5.56 | 260.4 | 9.7 |
62
- | run_09 | + PFNet | 39.4M | 5.53 | 252.9 | 8.5 |
63
- | run_10 | + learned per-channel decay | 39.4M | 5.53 | 253.1 | 8.7 |
64
-
65
- ## Small runs β€” 10M (round 1, 2 tok/param)
66
-
67
- | Run | Architecture | Params | Val Loss | Perplexity |
68
- |-----|-------------|-------:|---------:|-----------:|
69
- | run_13 | Small CPU-1 + BPE (4K vocab) | 12.5M | 30.54 | 4.85Γ—10⁸ |
70
- | run_14 | Small CPU-1 byte-level (Qwen logprob distillation) | 10.7M | 5.58 | 263.9 |
71
- | run_15 | Small CPU-1 byte + hidden distillation (EmbeddingAligner) | 10.7M | 5.58 | 263.9 |
72
- | run_16 | Small CPU-1 raw bytes, no teacher (FineWeb) | 10.7M | 5.58 | 263.9 |
73
-
74
- ## Round 2 β€” re-runs at 15 tok/param (7.5Γ— the original budget)
75
-
76
- Re-trained at **15 tok/param** (7.5Γ— the original budget) to test whether
77
- the ~5.55 nat floor on ternary runs was caused by under-training.
78
-
79
- ### 10M re-runs (1336 steps each, all uploaded)
80
-
81
- | Run | Architecture | Val Loss (r1) | Val Loss (r2) | Ξ” |
82
- |-----|-------------|---------------|---------------|---|
83
- | run_13_r2 | Small CPU-1 + BPE | 30.54 | **25.43** | βˆ’5.1 |
84
- | run_14_r2 | Small CPU-1 byte-level | 5.5754 | **5.5755** | +0.0001 |
85
- | run_15_r2 | Small CPU-1 byte + hidden distill | 5.5755 | **5.5755** | 0 |
86
- | run_16_r2 | Small CPU-1 raw bytes | 5.5754 | **5.5754** | 0 |
87
-
88
- ### 39M re-runs (in progress)
89
-
90
- `run_04_r2`, `run_07_r2`, `run_05_r2`, `run_08_r2`, `run_09_r2`, `run_10_r2`
91
- were started at 15 tok/param. As of 2026-05 only `run_04_r2` and `run_07_r2`
92
- have intermediate step checkpoints (β‰ˆ97% of training); none of them
93
- have been unpacked to fp32 in this repo yet because the audit below
94
- showed they were converging to the same uniform floor as their r1
95
- counterparts. They remain available in the source compact_2bit repo
96
- [`Cukinator/cpu1-ablation-checkpoints`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints).
97
-
98
- Manually-measured byte CE loss on the latest `run_04_r2` and `run_07_r2`
99
- step checkpoints (sample of English narrative):
100
-
101
- | Run | Loss (sample) | Ξ” vs uniform (5.545) |
102
- |-----|--------------:|--------------------:|
103
- | run_02 (FP16 Transformer, reference) | 4.37 | βˆ’1.18 |
104
- | run_03 (FP16 MLGRU, reference) | 3.97 | βˆ’1.58 |
105
- | run_04 (Ternary r1, 2 tok/p) | 5.55 | +0.01 |
106
- | **run_04_r2 (Ternary r2, step 4840 / ~5000)** | **5.57** | **+0.02** |
107
- | run_07 (CPU-1 complete r1) | 5.56 | +0.02 |
108
- | **run_07_r2 (CPU-1 complete r2, step 4860)** | **5.56** | **+0.02** |
109
-
110
- ## Round 3 β€” cold-start rescue (interrupted)
111
-
112
- After the audit, configurations were updated to apply corrections: **bf16 AMP** (instead of fp16), **`lr_scale=2.0` on BitLinear**, and an increased budget of **150 tok/param**.
113
-
114
- The trainings were interrupted prematurely due to cloud credit exhaustion (AMD MI300X, 192GB VRAM). Val Loss and Perplexity were measured from the interrupted checkpoints (evaluated on the last 3 shards of the validation set, 100 batches):
115
-
116
- ### 50M runs (Round 3)
117
-
118
- | Run | Architecture | Params | Progress | Val Loss | Perplexity | Notes |
119
- |-----|-------------|-------:|---------:|---------:|-----------:|-------|
120
- | run_01 | Transformer + BPE (16K vocab) + FP16 | 54.7M | 19.5% (12,173 / 62,500 steps) | β€” | β€” | ❌ Diverged (NaN weights) |
121
- | run_02 | Transformer + Byte + LocalByteDecoder | 38.8M | 17.5% (10,963 / 62,500 steps) | β€” | β€” | ❌ Diverged (NaN weights) |
122
- | run_04 | MLGRU + Byte + Ternary | 38.9M | 9.7% (6,074 / 62,500 steps) | **1.3064** | **3.69** | βœ… Converging |
123
- | run_05 | + FPResidual | 39.0M | 7.0% (4,390 / 62,500 steps) | **1.3422** | **3.83** | βœ… Converging |
124
- | run_06 | + Bolmo patch embedding | 39.0M | 6.8% (4,237 / 62,500 steps) | **0.6261** | **1.87** | βœ… Converging |
125
- | run_07 | + DeleteGate (CPU-1 complete) | 39.0M | β€” | β€” | β€” | ⚠️ Checkpoint not found in V3 repo |
126
- | run_08 | Folded Transformer + Byte + Ternary | 38.9M | 6.2% (3,858 / 62,500 steps) | β€” | β€” | ❌ Diverged (NaN weights) |
127
-
128
- ### 10M runs (Round 3)
129
-
130
- | Run | Architecture | Params | Progress | Val Loss | Perplexity | Notes |
131
- |-----|-------------|-------:|---------:|---------:|-----------:|-------|
132
- | run_13 | Small CPU-1 + BPE (4K vocab) | 12.5M | 74.3% (9,290 / 12,500 steps) | 25.01 | ~4.9Γ—10⁸ | BPE cold-start collapse |
133
- | run_14 | Small CPU-1 byte-level (Qwen distillation) | 10.7M | 78.2% (9,775 / 12,500 steps) | **0.5305** | **1.70** | βœ… Strong convergence |
134
- | run_15 | Small CPU-1 byte + hidden distillation | 10.7M | 18.8% (2,350 / 12,500 steps) | **0.9696** | **2.64** | βœ… Converging |
135
-
136
- The extremely slow progress (<20% in 1 day for 50M models) was caused by a severe CPU context-switching bottleneck when orchestrating 16 concurrent processes on a single MI300X GPU.
137
-
138
- ## Key finding (2026-05 audit): ternary cold-start collapses to the uniform baseline
139
-
140
- The reference value is **ln(256) = 5.545 nats**, the entropy of a uniform
141
- distribution over the 256 byte vocabulary. All byte-level ternary runs
142
- (round 1 *and* round 2, both scales) plateau within 0.05 nats of this
143
- floor β€” the models are effectively producing uniform predictions over bytes.
144
-
145
- **More training does not help.** A 7.5Γ— increase in tokens-per-parameter
146
- moves the loss by 0.0001 nats. A weight-evolution audit on `run_14_r2`
147
- showed that **>99.9% of BitLinear weights are in the same ternary state
148
- at step 10 and at step 1326** (the entire training). The bottleneck is the
149
- cold-start dynamics of straight-through-estimator (STE) ternary
150
- quantisation, not the data budget.
151
-
152
- ### V3 Key Finding: bf16 AMP + lr_scale=2.0 Breaks the Ternary Plateau
153
-
154
- In V1/V2, **all** ternary runs (Round 1 and Round 2) were stuck at Loss β‰ˆ 5.55 nats β€” the uniform entropy of the 256-byte vocabulary. The V3 recipe applied two fixes: **bf16 AMP** (replacing fp16) and **`lr_scale=2.0` for BitLinear**.
155
-
156
- Even with only 6–10% of target training completed, the V3 ternary runs show **real convergence** for the first time:
157
-
158
- | Run | Round | Architecture | Val Loss | Perplexity | Notes |
159
- |-----|-------|-------------|---------|-----------|-------|
160
- | run_04 | V1 | MLGRU + Byte + Ternary | 5.57 | 261.7 | ❌ Stuck at uniform floor |
161
- | run_04 | V3 | MLGRU + Byte + Ternary | **1.3064** | **3.69** | βœ… Real convergence |
162
- | run_05 | V1 | + FPResidual | 5.55 | 257.7 | ❌ Stuck |
163
- | run_05 | V3 | + FPResidual | **1.3422** | **3.83** | βœ… Real convergence |
164
- | run_06 | V1 | + Bolmo patch embedding | 5.56 | 258.8 | ❌ Stuck |
165
- | run_06 | V3 | + Bolmo patch embedding | **0.6261** | **1.87** | βœ… Real convergence |
166
- | run_14 | V1 | Small CPU-1 byte (10M) | 5.58 | 263.9 | ❌ Stuck |
167
- | run_14 | V3 | Small CPU-1 byte (10M) | **0.5305** | **1.70** | βœ… Strong convergence |
168
-
169
- **Conclusion:** The V3 recipe (bf16 AMP + 2Γ— LR for BitLinear) successfully breaks the cold-start ternary collapse that plagued all V1/V2 runs. These results are from early-interrupted checkpoints at 6–78% of training β€” final trained models would be expected to achieve significantly lower loss.
170
-
171
- Published 1.58-bit models (BitNet b1.58 at 700M+ with 30–143 tok/param;
172
- Slender-Mamba with FP16 warm-start) reach functional performance, but the
173
- cold-start regime at <50 tok/param and <100M parameters that this study
174
- operates in is not covered by their results.
175
-
176
- **Throughput** is also worth flagging: even with the ideal BitNet.cpp /
177
- T-MAC class kernels (4–6Γ— speedup on the matmul fraction), the projected
178
- end-to-end throughput of the 39M ternary models is **0.30–0.50Γ—** of
179
- their FP16 Transformer sibling at the same scale. The 1.58-bit speed
180
- advantage only materialises above ~700M parameters where weight RAM
181
- bandwidth becomes the bottleneck.
182
-
183
- > **Practical implication.** The byte-level ternary chain (runs 04–10, 14–16,
184
- > and their r2 counterparts) cannot distinguish between architectural
185
- > variants because all of them are stuck at the same numerical floor. The
186
- > architectures themselves may be sound; the training recipe needs to
187
- > either (a) warm-start from FP weights, (b) anneal the quantisation, or
188
- > (c) use a much larger token budget.
189
-
190
- Full mechanistic analysis, weight-flip diagnostics and throughput
191
- projections are in the
192
- [main repository README](https://github.com/Cukinator/1.58bits/blob/main/README.md#ablation-audit--2026-05-findings).
193
-
194
- ## License
195
-
196
- Apache-2.0. Same as the source code at [github.com/Cukinator/1.58bits](https://github.com/Cukinator/1.58bits).
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ tags:
6
+ - pytorch
7
+ - text-generation
8
+ - 1.58bit
9
+ - ternary
10
+ - byte-level
11
+ - mlgru
12
+ - ablation
13
+ library_name: pytorch
14
+ pipeline_tag: text-generation
15
+ model_type: custom
16
+ ---
17
+
18
+ # CPU-1 Ablation Study β€” Ready-to-use Checkpoints (fp32 unpacked)
19
+
20
+ Repo: `Cukinator/cpu1-ablations-final`
21
+ Source: [`Cukinator/cpu1-ablation-checkpoints`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints)
22
+ Code: [github.com/Cukinator/1.58bits](https://github.com/Cukinator/1.58bits)
23
+
24
+ > **Tablas recalculadas 2026-06-12** β€” criterio homogΓ©neo:
25
+ > `perplexity = exp(val_loss)` para todos los runs sin excepciΓ³n.
26
+ > `BPB = val_loss / ln(2)` β€” solo byte-level.
27
+ > Referencia uniforme byte: **ln(256) = 5.545 nats β†’ PPL=256 β†’ BPB=8.000**
28
+ > BPE runs (run\_01, run\_13, \*\_r2): PPL es **token-level**.
29
+
30
+ ## Ablation chain β€” 50M runs (round 1, 2 tok/param)
31
+
32
+ | Run | Arquitectura | Params M | RAM fp32 MB | Val Loss | PPL | BPB | Ξ” uniform | P/s | Bytes/s | Nivel |
33
+ |-----|-------------|--------:|------------:|---------:|----:|----:|----------:|----:|--------:|-------|
34
+ | run_01 | Transformer + BPE 16K + FP16 | β€” | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
35
+ | run_02a_byte_only_heads | Transformer + Byte + 4 heads (no LBD) | β€” | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
36
+ | run_02 | Transformer + Byte + LocalByteDecoder | β€” | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
37
+ | run_03 | MLGRU + Byte + FP16 | β€” | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
38
+ | run_04 | MLGRU + Byte + Ternary | β€” | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
39
+ | run_05 | + FPResidual | β€” | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
40
+ | run_05b_kernel_strict | MLGRU kernel-strict (no W_o) | β€” | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
41
+ | run_06 | + Bolmo patch embedding | β€” | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
42
+ | run_07 | + DeleteGate (CPU-1 completo) ⭐ | β€” | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
43
+ | run_08 | Folded Transformer + Byte + Ternary | β€” | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
44
+ | run_09 | + PFNet | β€” | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
45
+ | run_10 | + decay per-canal aprendido | β€” | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
46
+
47
+ ## Small runs β€” 10M (round 1, 2 tok/param)
48
+
49
+ | Run | Arquitectura | Params M | RAM fp32 MB | Val Loss | PPL | BPB | Nivel |
50
+ |-----|-------------|--------:|------------:|---------:|----:|----:|-------|
51
+ | run_13 | Small CPU-1 + BPE 4K | β€” | β€” | β€” | β€” | β€” | byte |
52
+ | run_14 | Small CPU-1 byte (Qwen distill.) | β€” | β€” | β€” | β€” | β€” | byte |
53
+ | run_15 | Small CPU-1 byte + hidden distill. | β€” | β€” | β€” | β€” | β€” | byte |
54
+ | run_16 | Small CPU-1 raw bytes, no teacher | β€” | β€” | β€” | β€” | β€” | byte |
55
+
56
+ ## Round 2 β€” re-runs a 15 tok/param
57
+
58
+ | Run | Arquitectura | Params M | Loss r1 | PPL r1 | Loss r2 | PPL r2 | Ξ” loss | BPB r2 | Nivel |
59
+ |-----|-------------|--------:|--------:|-------:|--------:|-------:|-------:|-------:|-------|
60
+ | run_04_r2 | run_04 @ 15 tok/param | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
61
+ | run_07_r2 | run_07 @ 15 tok/param | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
62
+ | run_13_r2 | run_13 @ 15 tok/param | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
63
+ | run_14_r2 | run_14 @ 15 tok/param | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
64
+ | run_15_r2 | run_15 @ 15 tok/param | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
65
+ | run_16_r2 | run_16 @ 15 tok/param | β€” | β€” | β€” | β€” | β€” | β€” | β€” | byte |
66
+
67
+ ## Licencia
68
+
69
+ Apache-2.0. Same as the source code at [github.com/Cukinator/1.58bits](https://github.com/Cukinator/1.58bits).