CPU-native language models trained from scratch on free-tier hardware. No GPU, no pretrained weights, no shortcuts. 40+ experiments, honest results.
Every experiment on TinyStories (~550M tokens), trained for 2 hours on 4 free CPU cores unless noted.
| Version | Series | Architecture | Params | Val PPL | Speed | Coherent? |
|---|---|---|---|---|---|---|
| v5 40h | FlashLM | Ternary recurrence | 29.7M | 1.36 | — | No |
| v7.4 | FlashLM | Gated DeltaNet + SWA | 6.6M | 2.33 | — | No |
| v10 FSP | FlashLM | Attention + FSP | 3.74M | 10.24 | 2.8K | Partial |
| v5.2 | FlashLM | Attention + RoPE | 5.0M | 10.56 | — | No |
| v11 CumMix | FlashLM | All-novel (PowerNorm+DualMomAdam) | 3.66M | 32.21 | 2.9K | No |
| v6 | FlashLM | forget+predict+compete | 3.9M | 19.43 | 2.6K | No |
| v8 | CPUFlow | FSP + hard slot routing (M=32) | 2.0M | 9.30 | 7K | No |
| v9.7 best semi-coherent | CPUFlow | cumsum + RAM-Net (no routing loss) | 2.47M | 10.23 | 3.4K | Semi |
| v5-LN baseline | CPUFlow | Fused cumsum + LayerNorm + FSP | 2.0M | 11.94 | 7.8K | Semi |
| v9 | CPUFlow | cumsum + RAM-Net + contrastive routing | 2.48M | 9.73 | 3.6K | No |
| v7 warm | CPUFlow | v5-LN + soft memory bank | 2.26M | 13.72 | 5.8K | No |
| v3 | CPUFlow | Linear attention cumsum | 1.99M | 25.00 | 6K | Partial |
v9.7 achieves semi-coherent generation at PPL 10.23. Stories have named characters, pronoun tracking, dialogue, and narrative structure. But coherence breaks down ~100 tokens in with word salad and contradictions. No FlashLM model achieves true coherence.
PPL ≠ coherence. v8 (PPL 9.30, hard slot routing) is incoherent. v5-LN (PPL 11.94, cumsum only) is semi-coherent. v9.7 (PPL 10.23, cumsum + memory) is also semi-coherent. The cumsum backbone helps but does not solve coherence. Neither model produces logically consistent stories.
Entity tracking remains unsolved at 2.5M parameters. Six different mechanisms failed: softmax memory (v7), discrete slots (v8), supervised slots (v8.5), Product Softmax (v9), contrastive routing (v9.5), two-phase contrastive (v9.6). The binding threshold (~160M params) is a fundamental barrier.
The key positive finding: sparse memory adds capacity without breaking coherence. RAM-Net's Product Softmax (512 slots, Top-8) improves PPL by 1.7 points as a parameter-efficient capacity expansion. This is useful for CPU-native models.
v5-LN cumsum backbone + RAM-Net sparse memory sidepath. Semi-coherent generation at PPL 10.23. Every component uses operations where CPU excels.
From minimal scan to memory-enhanced coherent generation. Each version isolates one change.
compress→relu→gate→cumsum→expand. No norms, no position encoding, no FFN. Proved cumsum works but PPL 260.
Added PowerNorm, CumStepPos, FFN, FSP. NaN at step 1036 revealed that normalization choice matters.
q·cumsum(kv)/cumsum(k). First stable CPU-native model. Bidirectional v4 failed (leaks future).
Fused Q/K/V (one matmul instead of three). NaN at step 1020. PowerNorm was 57% of compute.
PowerNorm → LayerNorm (MKL fused kernel, 27x faster). Zero NaN over 6,886 steps. Coherent baseline at PPL 11.94.
32-slot content-addressable memory. Cold start: gates collapsed (stayed at 0.12). Warm start: gates opened but softmax still blended across slots.
Hard argmax routing + straight-through estimator. Best PPL (9.30) but incoherent — discrete routing disrupts continuous context.
Product Softmax addressing (3×8 = 512 virtual slots, Top-8). Low PPL (9.67) but still incoherent — entity addresses collapsed.
v5-LN cumsum backbone + RAM-Net memory sidepath (no entity routing). Semi-coherent generation with 1.7 PPL improvement over baseline. Loses coherence ~100 tokens in.
What 40+ experiments taught us about CPU-native language modeling.
Future Sentence Prediction improved PPL 2.5× with 1.7% parameter overhead. All 21 architecture-only changes failed to match this gain.
v8 (PPL 9.30, hard slot routing) produces incoherent text. v5-LN (PPL 11.94, cumsum only) is semi-coherent. v9.7 (PPL 10.23, cumsum + memory) is also semi-coherent. Neither achieves true coherence. The cumsum backbone helps but does not solve it.
PowerNorm (learned exponent) was 57% of compute. LayerNorm (MKL fused kernel) is 27x faster. More steps per second beats better per-step learning.
Custom AVX2 fused scan kernel ran at 0.54x speed of pure PyTorch. MKL-optimized matmuls and vectorized ops are hard to beat with hand-written kernels.
Removing FFN saves 18% compute but doubles PPL (11.94→22.75). The per-position nonlinear transformation is essential.
Six mechanisms tried: softmax memory (v7), discrete slots (v8), supervised slots (v8.5), Product Softmax (v9), contrastive routing (v9.5), two-phase contrastive (v9.6). All collapsed to mode-averaging. The binding threshold (~160M params) is real.
On CPU, PyTorch dispatch overhead dominates over actual compute. CPUFlow minimizes operations from 233 to ~50, giving 2x real throughput improvement.
Output projections (D→vocab × 4) dominate at 8.6G FLOPs vs 1.2G for the model. Caused 2.7x slowdown and PPL 181 on CPU.
CPUFlow v9.7 at 2.47M parameters, val PPL 10.23. Semi-coherent stories — named characters and pronoun tracking work, but coherence breaks down ~100 tokens in.
"She tried to open the key, but it was too small" — Semantic confusion. Opening a key is nonsensical; the model conflates "open" (door/lock) with "use" (key). The cumsum context maintains Lily as the actor but blends lock/key properties.
"She pulled and walked up, up the church" — Scene drift. The story shifts from park to church with no transition. The continuous cumsum state gradually drifts, losing the original setting.
Coherence breaks down ~100 tokens in. Named characters and pronoun tracking work early ("Lily... She"), but the cumsum state saturates with mixed contexts, producing word salad. No FlashLM model achieves true coherence. Sparse memory (v9.7) improves PPL but doesn't solve this.
Everything is open source under MIT license. 40+ experiments, including failures.