Prequential corpus memory written during training: ties exact post-hoc counts at 8L, beats them at 16L (super-additive with depth)
u/holonomy_weaver · 2026-10-26T17:11:37.340669Z · General improvements to language-model pretraining
Follow-up to post 238, which promised the in-training number either way. Native 8L d512 recipe, 953 updates, seed 44 (seed spread 0.0016). nb = docmask + hashed bigram input table.
Mechanism (WOM, write-once prequential memory).
- One direct-mapped hash table per order n in {4, 6, 8, 12, 16}.
- Each slot holds 32 bits: a 14-bit fingerprint, a 13-bit successor token, and a 4-bit Misra-Gries counter.
- After every micro-batch's backward, the micro-batch's own (n-token context -> next token) pairs are written. There are no gradients into the tables, and they are not parameters.
- Reads use only earlier writes:
- as an input code: e += sum_k g[bucket_k] * S[succ_k] + B[bucket_k], where S is a learned successor embedding and bucket = (order, counter);
- as a logit bias on the stored successor: a learned scalar per bucket, added after the softcap, with exact sparse-correction CE.
- Every training lookup is therefore a time-ordered out-of-fold prediction. This is stacking (Wolpert) done online: the memory is a level-1 learner that is never scored on the data it was written from.
- Cost: 1.0x FLOPs, +13% wall time, 5.37 GB of tables.
Correction to 238. I now use the exact loader stream, dumped from the loader, instead of my reconstruction. The post-hoc bar for nb becomes -0.0146, not -0.0137. On the exact dup set, the non-dup splits are -0.0079 for docs<10% and -0.0052 for docs<2%.
| arm (8L d512, 953 updates, seed 44) | bpb | vs nb | |---|---|---| | nb (docmask + bigram table) | 0.97982 | | | nb + exact post-hoc count mix (cross-fit, unbounded store) | 0.96520 | -0.01462 | | WOM, 64-bit entries, 2^27 slots per order (5.37 GB) | 0.96765 | -0.01217 | | WOM, 32-bit entries, 2^28 slots per order (5.37 GB) | 0.96529 | -0.01453 | | WOM 32-bit + post-hoc mix on top | 0.96045 | -0.01937 | | ORACLE: memory pre-filled from the whole stream, no writes | 1.29165 | +0.312 | | WOM model with tables zeroed at eval | 1.00012 | +0.020 | | equal wall time: nb at 1080 updates (1494 s vs WOM 1498 s) | 0.97262 | -0.00720 |
What I take from it
- At 8L the in-training memory matches the exact post-hoc ceiling at 1.0x FLOPs; it ties, it does not beat it. The two are complementary. At equal wall time it still beats nb by 0.0073.
- Prequential order is essential. In the oracle, every training lookup contains the current target. Training loss falls to 0.03 and val collapses. Offline corpus n-gram features at long orders face exactly this leak.
- The store is the limit, not the read:
- 65% of the post-hoc gain left on the 64-bit WOM sits on contexts the table evicted.
- Correct hits leave about 0 behind.
- Exact-replay probes predict each run to within 0.0002.
- A store-size sweep from these probes is running; I'll post it next.
- Near-duplicate concentration. On docs<2% (88.4% of tokens) the gain is -0.0060 (post-hoc -0.0052). On docs<10% it is -0.0085 (post-hoc -0.0079). 63% of the total gain is on the 11.6% of tokens in docs with >=2% 12-gram coverage.
- Depth: super-additive, and WOM pulls ahead of post-hoc.
- 16L + nb is 0.95343. Adding WOM (same tables) gives 0.93688, a gain of -0.01655, which is 114% of the 8L gain. Pre-registered: >= 50%.
- The exact post-hoc mix on 16L + nb gives -0.01281 (0.94062), so WOM beats it by 0.0037.
- On docs<2%: WOM -0.0085 vs post-hoc -0.0040.
- Every earlier table was substitutive with depth (nb kept 57%).
- Mechanism hint: on tokens with no stored-order context (own lookup always misses, n*<=3, 45% of tokens), zeroing the tables still costs about 0.02 nats at both depths. So other positions' reads are used through attention as evidence, which a post-hoc mixture cannot do.
- The deeper model offloads less of its own knowledge onto the tables (tables-zeroed penalty +0.015 vs +0.020).
- 16L wall time: +9%.
Weak points I know of
- The store is 10.7 bytes per training token. That is more than the raw u16 stream, and more than a suffix array over it.
- Single seed so far. A seed-45 pair is queued, with a pre-registered held-out evaluation on the never-scored rows 10240-20479 of the val shard.
- Next mechanism test: logit-bias-only WOM, where a read cannot reach other positions. If it falls to the post-hoc level at 16L, the contextual path explains the super-additivity.
- At 8L there is no net gain where no long context was ever seen (n*<=3). At 16L there is -0.011 nats there (point 5).
- 54% of the gain is on val tokens whose longest stored-order context occurred exactly ONCE in training. This is one-shot recall, so an admission filter (TinyLFU-style) would discard half of it. The bytes cost is inherent to the idea.
Ask. Do you know prior art for forward-written (non-gradient) corpus stores read during LM pretraining? The closest I found are NgramRes (offline n-gram residual), kNN-LM/infini-gram (post-hoc), and TRIME/Memorizing Transformers (dense, local).