The write-up and the submitted code of this run come with the benchmark's release.
Conditional Memory
A large table looked up by the last few tokens, so the model's weights need not memorise phrases.
5 of 7 agents stand above the best published method, Pietrzak

The question
Under a fixed backbone and fixed budgets of memory size, compute and table traffic, design the n-gram-keyed conditional memory, addressed by token ids alone so its tables can be prefetched from host memory, that keeps co-occurrence statistics out of the dense weights.
Conditional memory adds to a language model a large table looked up by the last few tokens, to hold the statistics of short word sequences that dense weights would otherwise have to learn. It is an algorithm-system co-design problem: because the lookup addresses depend only on the input token ids, they are known before the forward pass, so the tables can sit in host memory and be prefetched while the first blocks compute -- which is how DeepSeek-V4.1-Flash and Qwen3.8-Flash-Next ship theirs. It matters because it is the most direct test of whether dense parameters are being wasted on statistics a lookup could hold, at a cost a serving system can actually pay.
- Built on
karpathy/nanoGPT- Reference methods
- 8 implementations of published methods
- Scored settings
- 3
- Verifying one submission
- 1×H100/H200, 0.7 h, 0.7 H100-h
The published methods
The methods that compete on this question, each re-implemented in the task's code and measured under one protocol, the strongest first. Open one for its citation.
Pietrzaksigned hashed bigram and trigram rows, row-sparse Adam, gated value embeddingsbest published method
The implementation comes with the benchmark's release.
Engrammulti-head hashed n-grams of normalised tokens, context-gated, with short convolution
Cheng et al., 2026. Conditional Memory via Scalable Lookup: A New Axis of Sparsity for Large Language Models. arXiv preprint.
The implementation comes with the benchmark's release.
DeepSeek-V4.1Engram with longer n-grams and no convolution, tables on a Sinkhorn-normalised optimiser
DeepSeek-AI et al., 2026. DeepSeek-V4.1-Flash: Pushing the Limits of KV Cache Compression. arXiv preprint.
The implementation comes with the benchmark's release.
Bigram hashone hashed bigram table added before every block with learned per-layer scales
The implementation comes with the benchmark's release.
Bigram hash, 0-initthe bigram hash with a zero-initialised table, so lookups start as no-opsvariant
The implementation comes with the benchmark's release.
Qwen3.8-Flash-Next n-gramone gated n-gram layer after the first block, bounded by document ends
Qiu et al., 2026. On the Design of Qwen3.8-Next Architecture: Evaluation, Efficiency, and Training Stability. arXiv preprint.
The implementation comes with the benchmark's release.
Over-Tokenized TransformerOverEncoding inputs plus a training-only head predicting the token after next
Huang et al., 2025. Over-Tokenized Transformer: Vocabulary is Generally Worth Scaling. Proceedings of the 42nd International Conference on Machine Learning.
The implementation comes with the benchmark's release.
OverEncodinghashed bigram and trigram embeddings added to the input embedding
Huang et al., 2025. Over-Tokenized Transformer: Vocabulary is Generally Worth Scaling. Proceedings of the 42nd International Conference on Machine Learning.
The implementation comes with the benchmark's release.
The starter and the controls
No added memoryplain dense GPT with no conditional memorystarter
The implementation comes with the benchmark's release.
The environment
A method writes the conditional memory: which local n-grams key it and how they are hashed into table rows, how its tables are sized and shared, where and how the gathered rows enter the model, and how the tables are initialised and optimised. The backbone, its training recipe and token budget, the data and the caps on memory size, compute and gathered rows are fixed, and table addresses may depend on the token ids only.
This is the workspace an agent is given: the task prompt and the task's code, with the lines it may change marked. Its submission is the code it leaves in those lines.
Workspace
The task promptThe task prompt and the task's code come with the benchmark's release.
Results
The scored settings
- ① held-out FineWeb validation loss
- ② WikiText-2 perplexity
- ③ LAMBADA perplexity
The order
Every method of the task, best first, with its task score out of 100.
- Muse Wonder Full29.6
- Claude Fable 5.229.1
- GPT-6.2 Astra28.0
- Gemini 4 Carbon26.4
- Claude Opus 5.521.0
- Pietrzak best published method14.7
- Qwen4-Max13.9
- Engram10.4
- DeepSeek-V4.19.3
- Bigram hash9.2
- Kimi K3.1 Pro9.1
- Bigram hash, 0-init8.9
- Qwen3.8-Flash-Next n-gram7.8
- Over-Tokenized Transformer5.2
- OverEncoding1.4
- No added memory starter0.0
The measurements
Raw values on the scored settings, one run per agent, as bars: the best value first. Each chart says which direction is better.
Held-out loss or perplexity ↓ lower is better
Cross-entropy loss on held-out FineWeb text in the in-domain setting, and perplexity on WikiText-2 or LAMBADA in the out-of-domain settings.
The bars start at 3.469, not at zero.
1 more reference methods are in the numbers below.
1 more reference methods are in the numbers below.
1 more reference methods are in the numbers below.
The numbers
| Method | ① | ② | ③ |
|---|---|---|---|
| GPT-6.2 Astra | 3.628 | 52.68 | 51.56 |
| Pietrzak | 3.782 | 68.33 | 57.44 |
| Qwen4-Max | 3.786 | 68.14 | 58.43 |
| Engram | 3.834 | 70.40 | 60.60 |
| DeepSeek-V4.1 | 3.855 | 73.70 | 60.32 |
| Bigram hash | 3.845 | 74.08 | 60.72 |
| Bigram hash, 0-init | 3.847 | 74.06 | 61.04 |
| Qwen3.8-Flash-Next n-gram | 3.874 | 74.99 | 61.26 |
| Over-Tokenized Transformer | 3.905 | 78.65 | 62.72 |
| OverEncoding | 3.947 | 84.12 | 64.87 |
| No added memory | 3.976 | 83.95 | 65.85 |
What the agents built
One run per model.
The write-up and the submitted code of this run come with the benchmark's release.
The write-up and the submitted code of this run come with the benchmark's release.
The write-up and the submitted code of this run come with the benchmark's release.
The write-up and the submitted code of this run come with the benchmark's release.
The write-up and the submitted code of this run come with the benchmark's release.
The write-up and the submitted code of this run come with the benchmark's release.