TL;DR
How do you give a language model an encyclopedic memory without paying a massive computational bill for every single word it generates? This paper establishes mathematical scaling laws for "sparse memory" architectures—specifically Product Key Memory (PKM)—mapping out exactly when to use dense models, Mixture-of-Experts (MoE), or ultra-sparse memory banks depending on your compute and storage budgets. Spoiler: if you have plenty of storage space—even slow phone flash memory—fine-grained memory lookups cannot just lower your model's error, they can also run over 7× faster than MoE on edge devices.
What Problem Does This Paper Address?
For years, the golden rule of training Large Language Models (LLMs)—popularized by Chinchilla—told us how to balance parameter count ($N$) and training data ($D$) for a fixed compute budget. In standard "dense" Transformers, every parameter does math on every token, tying model memory directly to computational cost.
Mixture-of-Experts (MoE) broke this tie by routing tokens to only a few neural sub-networks ("experts") at a time. Now, researchers are pushing this separation to the extreme with sparse parametric memory like Product Key Memory (PKM). Instead of activating chunky neural layers, PKM treats memory like a massive key-value database, retrieving just a handful of tiny vector entries per token. While we know PKM works, nobody knew the rules for scaling it: if your compute or storage budget doubles, should you add more active compute, a bigger memory bank, or train on more tokens?
Methods
The authors trained 44 distinct model configurations across four architectural families:
- Dense Transformers (standard baseline).
- MoE (sparsely activated feed-forward experts).
- PKM (learned queries retrieve values from a massive, context-dependent memory table).
- STEM (replaces parts of feed-forward layers with deterministic, token-indexed embedding lookups).
To capture how stored capacity behaves separately from active math, they extend classical scaling laws from two variables to three: active parameters ($N$), training tokens ($D$), and inactive/memory parameters ($M$). Unlike traditional laws where model size and data contribute independently to the final cross-entropy loss, their new 9-coefficient equation lets $M$ and $N$ directly alter both the baseline model error and the rate at which the model learns from data ($D$). They also pair these loss predictions with a hardware roofline model—a physics-style bottleneck calculation—to see how fast these models actually run when parameters spill over from fast DRAM into sluggish flash storage on mobile devices.
Datasets
All models were trained on the DCLM-Edu corpus using the GPT-NeoX-20B tokenizer, and evaluated via cross-entropy loss on a shared held-out subset. Rather than introducing a new text benchmark, the authors generated a massive empirical dataset of 421 training endpoints, spanning up to 2.0B active parameters, 21.9B total parameters (with PKM memory banks up to 139× larger than the active model), and 128B training tokens.
Key Insights and Ideas
- There is no single "winner" architecture—only resource regimes: Mapping minimum loss across total parameter capacity ($T = N + M$) and training compute ($C$) reveals distinct territories. Dense models win when compute is abundant relative to parameter capacity; PKM dominates when parameter capacity is abundant relative to compute; and MoE holds the middle ground.
- Sparsity isn't a single magic ratio: Within PKM, optimal sparsity is a tug-of-war. Given a fixed compute budget, increasing your parameter storage budget means you should crank up sparsity (put more parameters into inactive memory). Conversely, given a fixed parameter budget, throwing more compute at the model favors less sparsity (allocating more parameters to active math).
- Sparsity flavors don't mix: You cannot use one universal equation for all sparse models. Attempting to fit a single shared scaling law to pooled PKM and MoE data degraded MoE loss predictions in every matched test (increasing error by 1.35× to 2.05×), proving that fine-grained vector lookup fundamentally scales differently than routed neural experts.
- Granularity saves mobile inference: When a model is too big for phone RAM, inactive parameters must live on flash storage (~17× slower). When MoE processes a window of tokens, different tokens wake up different massive experts (78.6M parameters per load in their setup), choking the flash drive. PKM only fetches tiny memory vectors (0.3M parameters per load)—a ~260× reduction in data per distinct fetch.
Key Results
- Predictive precision: On held-out low-loss extrapolations ($\text{LLLO}_{30}$, withholding the best 30% of runs), the 3-variable law achieves an RMSE of $5.86 \times 10^{-3}$ for PKM and $8.49 \times 10^{-3}$ for MoE. Their compact 6-coefficient 2-variable law for Dense and STEM models beat Chinchilla in 32 out of 32 held-out comparisons and beat the newer 9-coefficient Farseer law in 27 of 32.
- Coupled cluster scaling: Along a realistic hardware scaling path (scaling GPU count and training days together, calibrated to H100s, while factoring in lifetime inference FLOPs), PKM consistently achieves the lowest loss while operating at much higher total-to-active expansion ratios (35× to 160×) than MoE (33× to 84×).
- Mobile speedups: For ~3.3B–3.9B active-parameter models overflowing onto mobile flash (at a 512-token processing window), roofline modeling estimates PKM achieves a 7.61× token-throughput speedup over MoE at an 8× total-to-active expansion ratio, ballooning to a 30.45× speedup at 32× expansion because PKM's retrieval traffic stays flat while MoE drowns in expert loads.
Limitations and Future Work
The authors are admirably transparent about where the map ends and the territory begins:
- Idealized FLOP accounting: Their optimization relies on the standard $C \approx 6ND$ compute approximation, which ignores routing overhead, memory-access latency, and inter-GPU communication. Equal FLOPs do not guarantee equal wall-clock training time, especially at extreme sparsity.
- Theoretical hardware numbers: The dramatic 7.6×–30.4× mobile speedups come from analytical roofline models rather than physical smartphone benchmarks; real-world caching and OS overhead need end-to-end testing.
- Architectural scope: Results apply to baseline PKM and standard MoE up to ~22B parameters. Newer memory variants (like UltraMem or $n$-gram lookups like Engram) and finer-grained MoEs might shift the boundaries on the architectural map, making larger-scale validation the natural next step.
Summary updated