Memory Decoder at Scale: A Pretrained, Parametric Long-Term Memory

Rubin Wei, Jiaqi Cao, Jiarui Wang, Junming Zhang, Qipeng Guo, Bowen Zhou, Zhouhan LinarXiv 2026

TL;DR

This paper introduces Memory Decoder at Scale, a modular architecture that decouples long-term memory from reasoning in language models. By scaling a parametric memory module to 6.9B parameters and training it on 300B tokens, the authors demonstrate that pairing small backbones with large standalone memories is significantly more parameter-efficient than scaling monolithic models—for example, a 410M backbone with a 6.9B memory outperforms a standard 12B model.

What Problem Does This Paper Address?

Standard decoder-only language models (LLMs) entangle "reasoning" and "memory" within a single set of parameters. This entanglement creates several inefficiencies:

  1. Inefficient Scaling: To increase a model's knowledge (memory), you must scale the entire model, increasing the computational cost of every reasoning step.
  2. Rigid Domain Adaptation: Updating a model with new domain knowledge often requires full fine-tuning, which is expensive and risks "catastrophic forgetting" of general capabilities.
  3. Lack of Modularity: You cannot easily swap out the "memory" of a model for a different domain or reuse a pretrained memory across different model backbones.

While previous work introduced parametric memory modules, they were only tested at small scales. Scaling this approach to hundreds of billions of tokens introduces a massive technical bottleneck: the computational cost of indexing and searching the $k$-nearest neighbor ($k$NN) distributions used to supervise the memory training.

Methods

The authors propose a modular framework where a frozen base model (the backbone) is augmented by a trainable parametric memory (the Memory Decoder).

The Architecture

The Memory Decoder is a transformer decoder trained to internalize the knowledge of a non-parametric retriever. During training, a retriever looks up the $K$ most relevant contexts in a massive datastore to produce a $k$NN distribution ($p_{ret}$). The Memory Decoder ($M_\psi$) is then trained to minimize the KL divergence between its own output and this $retrieval$ signal, alongside a standard language modeling objective.

Overview of parametric long-term memory pretraining and inference.

Scaling the Pipeline

To handle the "Pile" (207B tokens), the authors developed a distributed Faiss pipeline to overcome the quadratic bottleneck of indexing and search:

  • Embedding Compression: They use Optimized Product Quantization (OPQ256) to compress 4096-dimensional hidden states into 256-dimensional search vectors.
  • Index Sharding: They partition the index into shards over contiguous centroid ranges using HNSW quantizers.
  • Parallel Retrieval: Queries are routed to parallel GPU workers that search local shards and merge candidates into the final $k$NN distribution.
Distributed Faiss pipeline for large-scale $k$NN distribution construction.

At inference, the final prediction is a simple linear interpolation of the base model and memory model distributions: $p_{final} = (1 - \alpha)p_{base} + \alpha p_{mem}$.

Datasets

  • General Memory Training: The deduplicated Pile (207B tokens).
  • Domain Memory Training: BioInst (Biology, 552M tokens), DISC-Law-SFT (Law, 125M tokens), and FinTrain-unsup (Finance, 4.4B tokens).
  • Evaluation: 17 general benchmarks (including MMLU, TriviaQA, and ARC) and domain-specific benchmarks like LawBench and FinEval.

Key Insights and Ideas

  • Memory is More Scalable than Reasoning: The most striking insight is that the "parameter-performance tradeoff" is better for memory than for backbones. Allocating parameters to a specialized memory module yields higher accuracy gains per parameter than simply making the backbone larger.
  • Decoupling Works: The results prove that long-term memory does not need to be entangled with reasoning. A small "reasoner" (410M parameters) can effectively utilize a large "library" (6.9B parameters).
  • Plug-and-Play Domain Knowledge: Domain memories are swappable. You can plug a "Law Memory" into a general model at inference time to instantly boost its legal expertise by over 9 points without any retraining of the base model.
  • Cross-Vocabulary Transfer: The authors found that a memory module trained on one model's vocabulary (e.g., Qwen3) can be adapted to a completely different vocabulary (e.g., OLMo) using only 20% of the original training budget.

Key Results

  • Efficiency Gains: Pythia-410M paired with a 6.9B memory achieved an average score of 37.34 across 17 tasks, surpassing the monolithic Pythia-12B (37.24) while using 39% fewer total parameters.
  • Scaling Advantage: As shown in Figure 1, the "Base + Memory" curve consistently sits above the "Base model" scaling trend, indicating superior parameter efficiency across all tested scales.
Memory scaling is more parameter-efficient than backbone scaling.
  • Knowledge-Intensive Tasks: The memory module provides the biggest boosts in tasks requiring factual recall (e.g., TriviaQA), where it effectively supplies evidence that isn't present in the prompt.
  • Few-Shot Robustness: The memory remains effective even when in-context examples are provided, suggesting it provides complementary information rather than just duplicating what's in the prompt.

Limitations and Future Work

  • Offline Construction Cost: While the distributed pipeline makes it feasible, constructing the $k$NN target distributions still incurs significant one-time indexing and retrieval overhead.
  • Static Interpolation: The current system uses a fixed interpolation coefficient ($\alpha$). The authors suggest that an adaptive weighting mechanism—where the model decides how much to trust its memory based on the context—could further improve performance.
  • Coordination: The base model remains frozen. Future work could explore joint or staged training to improve the synergy between the reasoning backbone and the memory module, though this might sacrifice some modularity.

Summary updated

BibTeX
@misc{wei2026memory,
  author = {Rubin Wei and Jiaqi Cao and Jiarui Wang and Junming Zhang and Qipeng Guo and Bowen Zhou and Zhouhan Lin},
  title = {{Memory Decoder at Scale: A Pretrained, Parametric Long-Term Memory}},
  year = {2026},
  eprint = {2607.27919},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2607.27919},
}
Figure