MemOnce: A Scalable Memory Architecture for Large Language Models

Chang Nie, Chaoyou Fu, Songlin Liu, Yiqing Hu, Caifeng ShanarXiv 2026 · arXiv

It’s late, your coffee is cold, and you’re probably wondering why we’re still talking about context windows. We have models that can "technically" handle a million tokens, but the cost is astronomical. Standard Transformers suffer from a "memory tax": as the conversation gets longer, the Key-Value (KV) cache—the model's short-term memory—grows linearly until it chokes your GPU.

The paper "MemOnce: A Scalable Memory Architecture for Large Language Models" proposes a way to break this cycle. It’s a blueprint for a model that remembers everything but only pays for what it uses.

TL;DR

MemOnce is a new architecture that allows LLMs to handle massive contexts (up to 1M tokens) with a near-constant memory footprint. By caching only a tiny fraction of the final layer and "re-inflating" it into full memory on-demand, it achieves a staggering 1313× reduction in memory usage and a 6.9× speedup in processing long prompts compared to standard models.

What Problem Does This Paper Address?

The AI community is currently stuck in a tug-of-war between two architectures:

  1. Transformers: They remember everything in vivid detail by storing "KV caches" for every single token at every single layer. This is great for accuracy but terrible for scalability—eventually, you run out of VRAM.
  2. Linear Models (like Mamba): They compress history into a fixed-size "hidden state." This is incredibly fast and memory-efficient, but they tend to have "goldfish memory," struggling to recall fine-grained details from deep in the past.

The authors of MemOnce wanted to find the "Goldilocks" zone: the high-fidelity recall of a Transformer with the constant-memory efficiency of a linear model.

Methods

The secret sauce of MemOnce consists of two main components:

1. The Memory Encoder-Decoder

Instead of saving the KV cache for every layer (which is redundant), MemOnce only saves a small subset (e.g., 1/8th) of the final-layer hidden states. When the model needs to look back, it uses lightweight "decoders" (simple MLPs) to dynamically reconstruct the KV caches for all the other layers on the fly. Think of it like a high-ratio zip file for the model's brain.

2. Memory Sparse Attention

Even with compressed memory, looking at a million tokens is slow. MemOnce uses a "top-K" retrieval system to pick out only the most relevant chunks of memory for the current input. The clever bit: It calculates which chunks are important only once and reuses those indices across all layers. This avoids the massive computational overhead of traditional sparse attention.

Overview of the MemOnce architecture showing the Hybrid Backbone and the Encoder-Decoder loop.

Datasets

The researchers didn't just test this on toy problems. They used:

  • Pre-training: FineWeb-Edu-10B (a high-quality web crawl dataset).
  • Post-training: They introduced MemOnce-1M, a new corpus of 1 million multi-turn conversation samples designed to train the model on long-range factual recall and multi-hop reasoning.
  • Evaluation: A gauntlet of benchmarks including MemBench, LoCoMo, and PersonaMem, covering context lengths from 4K all the way to 1M tokens.

Key Insights and Ideas

  • The Final Layer is a Semantic Goldmine: The authors realized that by the time information reaches the final layer, it’s "compressed" enough that it can be used to reconstruct what the earlier layers need. This eliminates the need for layer-wise storage.
  • Noise Filtering as a Feature: Surprisingly, MemOnce often outperforms full-context models. By using sparse retrieval, it effectively filters out "distractor" information that might otherwise confuse the model in a massive context window.
  • Pareto Frontier Shift: Usually, "efficient" models are a compromise. As shown in Figure 1, MemOnce represents a genuine leap forward, offering better performance and better speed than existing native memory models.
Comparison of memory state cache vs. context length (left) and performance vs. latency (right).

Key Results

The numbers are, frankly, a bit ridiculous:

  • Memory Efficiency: At a 1M token context, MemOnce reduced the memory state cache by 1313× compared to a standard Qwen3.5-4B baseline.
  • Speed: Prefill latency (the time it takes to "read" the prompt) was 6.9× faster, and decoding throughput improved by 3.5×.
  • Accuracy: On a suite of five memory benchmarks, MemOnce improved overall performance by +5.77% over the full-context baseline. It didn't just keep up; it won.
  • Scaling: The model scales beautifully. As you add more parameters, the performance gap between MemOnce and traditional architectures actually widens.
Validation perplexity vs. model scale, showing MemOnce delivering the best scaling performance.

Limitations and Future Work

While the results are impressive, the authors note a few hurdles:

  • Compute Constraints: Most of the "from-scratch" pre-training was done at the 1B parameter scale. While they adapted 4B models successfully, the behavior at the 70B+ scale remains to be seen.
  • Complex Agent Tasks: While it excels at recall and reasoning, its performance in highly interactive, multi-step tool-use scenarios (like complex coding agents) hasn't been fully stress-tested yet.
  • Future Directions: The team plans to scale MemOnce to much larger parameter counts and explore its potential in "continual learning" scenarios where the model never stops absorbing new information.

In short, MemOnce suggests that we don't need bigger GPUs to get longer context—we just need a smarter way to remember. Now, go get some sleep.

Summary updated

Abstract

Deploying large language models (LLMs) in long-horizon and continual interactions requires maintaining reusable memory states for future inference, posing challenges for existing architectures. Standard Transformers accumulate layer-wise, token-level KV caches, incurring linear GPU memory growth and quadratic computational complexity as the context expands. In contrast, linear-time architectures compress history into fixed-size states, but struggle to retain fine-grained details. We introduce MemOnce, a foundation architecture that learns scalable memory states for language models. MemOnce is based on two core designs: (a) Memory encoder-decoder: it caches only a small subset of final-layer hidden states as compact memory representations and dynamically decodes them back into KV caches for attention layers; (b) Memory sparse attention: for each continual input, MemOnce adaptively retrieves relevant memory representations, with the sparse indices computed only once across layers. Coupling these two designs enables efficient on-the-fly memory loading and KV cache decoding, drastically reducing the GPU memory footprint and achieving linear-time complexity. We conduct extensive experiments to show that MemOnce outperforms Transformers and other architectures across varying model sizes, context lengths, and training paradigms (pretraining and post-training adaptation). In particular, adapting Qwen3.5-4B with MemOnce reduces memory state cache by 1313$\times$ and prefill latency by 6.9$\times$ at 1M context, and improves throughput by 3.5$\times$ and overall memory performance by +5.77%. Finally, MemOnce generalizes zero-shot to downstream representation tasks, achieving competitive results against specialized models.
BibTeX
@misc{nie2026memonce,
  author = {Chang Nie and Chaoyou Fu and Songlin Liu and Yiqing Hu and Caifeng Shan},
  title = {{MemOnce: A Scalable Memory Architecture for Large Language Models}},
  year = {2026},
  eprint = {2611.27973},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.27973},
}
Figure