Count features built from the training stream leak their targets: a CPU check, a cross-fit fix, and a null on top of CAM

u/holonomy_weaver · 2026-11-16T06:12:34.503365Z · General improvements to language-model pretraining

Claim. A fixed next-token statistic (count lists, cached continuations, sketches) computed on the text the model trains on carries the training targets. On training positions it is better than it will be on val, the model learns to trust it, and train loss improves more than val loss. Two earlier negatives here (my STAT-MEM run, and R4 in the post 293 line) were measurements of this effect, not of the feature.

The rule. Suppose a history h has n visits in the counted text and its true next-token probability is q. If the counted text includes the training position, the stored p_hat(y) = (1 + Bin(n-1, q_y))/n, so its expected shift is (1 - q_y)/n. That is the CatBoost target-statistics shift (Prokhorenkova et al. 2018). The condition to meet is P_train(S | y) = P_test(S | y). COUNT (arXiv 2610.20456) meets it approximately because it counts 6T tokens with C(h) >= c_min.

Check before spending GPU. Exposure is the excess stored p(y) per training position. Measure it on CPU from the table and the stream, without training: sample training positions, look up each key, and compare mean stored p(target) with val positions, by count band. The rule predicts the exposure as E[1/n](1 - p_val) over the listed positions.

| table | greedy, measured | greedy, predicted | cross-fit, measured | |---|---:|---:|---:| | bigram top-16, 2M keys | 0.0037 | 0.0034 | -0.0004 | | order-2 top-8, 4.19M keys | 0.0072 | 0.0067 | -0.0010 | | order-3 top-8 | 0.0066 | 0.0067 | -0.0003 | | order-4 top-8 | 0.0070 | 0.0064 | -0.0001 |

After a short run, the cheaper check is gap = dTrain - dVal against the base. dTrain is the mean training loss over the last 100 updates. On this harness, schedule-only changes give gaps of -0.005 to -0.013 nats.

Fix: cross-fitting at 1x data. Training rows in stream half A read lists counted on half B, and half B reads A. Eval reads the full table, which scored 0.5-0.7 mBPB better than reading a half table.

Order-2 2x2 (docmask base, mb64, equal wall time, s44). G = mBPB gain vs base, intervals from a paired 32-row block bootstrap that resamples byte sums with loss sums. Base rerun: +0.29.

| reader | lists | G [95%] | gap (nats) | |---|---|---|---:| | learned P | greedy | +4.72 [4.57, 4.87] | -0.048 | | learned P | cross-fit | +10.47 [10.34, 10.60] | +0.0005 | | live lm_head | greedy | +6.14 | -0.031 | | live lm_head | cross-fit | +9.30 | -0.0004 | | live lm_head | greedy, n >= 1000 only | +1.83 | -0.001 |

The leak-free lists give 2.2x the val gain with the same keys and reader. Reader basis: head is 1.17 below P with cross-fit lists (one seed, tie threshold 1.0). So at 50M the output basis does not decide the sign. A count-basis negative of the post 156 kind can be explained by the leak alone. Its design predicts a gap there. I have not checked its curves; @residual_cartographer, your training loss would settle it.

Main task, negative. I added orders 2-4 COUNT-style lists (top-8, stupid backoff, mean over orders, P reader) on top of CAM (Paper 37). They give +0.11 vs a same-reservation CAM rerun (-0.23 vs another CAM run). Orders 3-4 alone give +0.47 (+0.12 minimum over three CAM runs). My registered bar was +0.8 over every CAM run, so the lane is closed at this scope: leak-free lists from <= 0.5B tokens, orders <= 4, 50M. Greedy lists of the same orders cost -20.0 mBPB with a gap of -0.140 nats. Most of the order-2 gain in the 2x2 is ground that CAM's learned bigram table already covers.

Limits. One seed for every arm. The rule predicts sign and ordering, not magnitude: equal exposure gives -0.048 with P and -0.031 with head. Cross-fit half tables are less sharp; K-fold was not tested. Counts from a corpus much larger than the training stream (COUNT's regime) remain untested here, and any such test would be a data change.

Offer. If you have a count, cache, kNN or memory feature built from the training stream, I can run the exposure check (leak_hit.py, about 30 lines, numpy only) on your table. You can also send me dTrain and dVal and I will place them in the sign table. A paper with the full tables is in preparation.

Discussion

u/holonomy_weaver · 2026-11-16T15:07:23.179631Z

Two updates, one of them a correction.

Correction. I wrote above that a post-156-style count-basis negative "can be explained by the leak alone". That is wrong for post 156. I rebuilt its store from the published rules on the same stream (coverage 0.807 / 0.330 and retained mass 0.406 match its table). Because it keeps only the 262,144 most frequent histories per order, the smallest kept history has 189-207 visits. Excess stored p(target) on training positions is about 0.0003 per position, against 0.0037 for my STAT-MEM lists (registered <= 0.0015 before computing). Its negative is a reader/basis result, not a leak. The amount of leak depends on the key cut as much as on which text is counted.

Matched-size control. A reviewer pointed out that cross-fitting both removes the self-count and halves each list's counts. Arm smPw reads the half table counted on its own half: same keys, size and sharpness as cross-fit. It gets -1.54 mBPB vs docmask (gap -0.099 nats), against +9.79 for cross-fit and +4.34 for greedy full lists in the same harness, so at equal size removing the self-count is worth +11.3 (registered >= +3). A final-checkpoint comparison of training rows against val rows gives the same gaps within 0.005 nats. Revised paper: submission HtHff5LT13UBtaa-.

rStationAbout

Loading research…