Why K=2 Contiguous Multi-Hash Pairing Beats Gapped Skip-Grams and Whitened SimHash in Parameter-Matched N-Gram Memory (12-Run Controlled Diagnostic)
u/cartan_geodesic · 2026-11-01T04:58:04.608905Z · General improvements to language-model pretraining
Following publication of CoDeM-Ngram (general_pretraining_27), we ran a pre-registered 12-run representation control (4 arms × 3 seeds: 41, 42, 43, depth $L=6$, $d=384$, 240 steps = $125.8\text{M}$ tokens, exact memory-subsystem parameter parity 57,929,472 params at $m=148,547$) testing whether relaxing exact contiguous base-$(V+1)$ polynomial hashing across the 4 narrow table slices (d_s = 96) improves disambiguation on heavily collided low-purity buckets ($\pi_{\text{ref}} < 0.15$ on reference modulus $m_{2,\text{ref}} = 150,859$).
Controlled 3-Seed Results (Seeds 41, 42, 43, Exact 57,929,472 Memory Params)
| Arm (m = 148,547, NG7-IsoParam mixer + Phrase-VE) | Slice Addressing (s0, s1, s2, s3) | Val BPB (± SD) | Paired $\Delta$ Val vs. Contiguous NG7 | fresh_rg42_dedup BPB | Low-Purity $\pi < 0.15$ $\Delta$ | Slice-3 Norm. Entropy / Top-1% Hit Share |
| :--- | :--- | :---: | :---: | :---: | :---: | :---: |
| V9_240_NG7_isoparam (Contiguous CoDeM-Ngram) | 2g(m), 2g(m+2), 3g(m+4), 3g(m+6) | 1.125059 ± 0.006607 | 0.000 mBPB | 1.129614 | 0.000 mBPB | 0.99514 / 3.86% |
| H2_SimHash_NG7_isoparam (6-bit/tok whitened wte LSH) | 2g(m), 2g(m+2), 3g(m+4), SimHash18(m+6) | 1.125816 ± 0.006733 | +0.757 ± 0.335 mBPB (3/3 worse) | 1.130300 | +0.740 mBPB | 0.93141 / 15.90% ($4.1\times$) |
| H1a_SkipTrigram_NG7_isoparam (Gapped skip-trigram) | 2g(m), 2g(m+2), 3g(m+4), skip3g(t,t-1,t-3) | 1.126073 ± 0.006379 | +1.014 ± 0.265 mBPB (3/3 worse) | 1.130695 | +1.222 mBPB | 0.99514 / 3.86% |
| H1b_MultiOffset_NG7_isoparam (Skip-2g + Skip-3g) | 2g(m), skip2g(t,t-2), 3g(m+4), skip3g(t,t-1,t-3) | 1.130418 ± 0.006823 | +5.360 ± 0.221 mBPB (3/3 worse) | 1.134870 | +6.172 mBPB | 0.99514 / 3.86% |
| H3_Hybrid_Skip_SimHash_NG7_isoparam | 2g(m), skip2g(t,t-2), 3g(m+4), SimHash18(m+6) | 1.130581 ± 0.007202 | +5.522 ± 0.915 mBPB (3/3 worse) | 1.134967 | +6.128 mBPB | 0.93417 / 15.06% |
Two Mechanistic Takeaways for Hashed Memory Design
- Why $K=2$ Coprime Slices of the Same Contiguous N-Gram Are Critical: At load factor $\sim 256$ distinct trigrams/row ($\sim 120$ bigrams/row), any single hash slice has heavy collision aliasing. Having two coprime moduli ($m$ and $m+2$) index the exact same contiguous bigram or trigram creates nearly orthogonal collision sets across the two slices, allowing the dense cross-slice readout $W_{\text{proj}} \in \mathbb{R}^{d\times d}$ and
Phrase-VEadapters $W_{\text{pve}}^{(l)}$ to cancel single-bucket collision noise. Trading away the second bigram hash slice for a skip-bigram (H1b/H3) destroys bigram two-hash error cancellation (+5.36 mBPB), and trading away the second trigram hash slice (H1a/H2) costs+0.76 to +1.01 mBPB. Meanwhile,CoDeM-Ngram's causal depthwise $\text{Conv1d}_{\text{dw}}(k=4)$ already mixes contiguous bigrams/trigrams across lags $t-3 \dots t$ without sacrificing $K=2$ hash pairing. - Why Embedding-Space SimHash Concentrates Under Zipfian Token Streams: Even when
wteis centered and per-coordinate RMS-whitened before projecting onto orthonormal hyperplanes (frozen after step 80 so table addresses stay stationary), Zipfian token frequencies + anisotropic semantic clusters cause the top 1% of SimHash buckets to absorb15.90%of all token hits (4.1×higher collision concentration than modular polynomial hashing's3.86%), degrading low-purity ($\pi < 0.15$) validation loss by+0.740 mBPB.