MemOnce: A Scalable Memory Architecture for Large Language Models
Chang Nie, Chaoyou Fu, Songlin Liu, Yiqing Hu, Caifeng Shan
arXiv:2611.27973v1When large language models move from one-off prompts to long-running conversations, agents, or document-scale reasoning, memory stops being a nice extra and becomes a core systems problem. The model has to remember what happened before, reuse that information later, and do it without blowing up GPU memory or latency. That is the problem this paper tackles. The basic tension is easy to state. Standard Transformers keep token-level key-value caches for every layer. That preserves detail, but as context grows, memory use grows linearly with length and computation becomes increasingly expensive. On the other side, recurrent and linear-time models compress history into a fixed-size state, which is efficient, but that compression can lose fine-grained information over long horizons. So the field has been stuck between two imperfect extremes: detailed but expensive, or efficient but lossy. The paper positions MemOnce as a way to break that trade-off. The authors frame the whole problem as learning an active memory state for continual inference: instead of repeatedly recomputing the full history, the model should distill history into reusable memory, then load only what is relevant for the current input. That sounds simple, but the hard part is making it both expressive and scalable. To understand MemOnce, it helps to place it against existing approaches. One family of methods tries to optimize attention itself. These include sparse attention, hybrid architectures, and cross-layer cache sharing. They can reduce some overhead, but they still often maintain caches that scale with context length, or they still need routing decisions across layers. A second family is native memory models, which compress history into learned states. These are efficient, but they can suffer from capacity limits, retrieval overhead, or forgetting. A third family uses external memory systems, like databases or agent memory stores, which are flexible but costly to manage and hard to train end to end. MemOnce is designed as a foundation architecture that sits in the middle of this landscape. Its key idea is to keep one compact global memory, retrieve relevant pieces only once, and then decode those pieces into the layer-wise key-value caches needed by attention. In other words, it does not try to preserve every token cache forever, and it does not force the model to live with a tiny recurrent state. Instead, it stores a compressed representation of the past and reconstructs attention-ready caches on demand. The architecture has two main parts. The first is a memory encoder-decoder. During inference, MemOnce keeps only a small subset of the final-layer hidden states as memory representations. The paper’s intuition is that later hidden states in a segment already summarize earlier content in that segment, so you can keep only the tail of each segment rather than every token at every layer. This memory is written once into a global cache. Then, when the model needs to use that memory, a decoder maps the compact representations back into layer-specific key and value caches through lightweight layer-specific MLP projections. So the model stores a compressed semantic memory, but reconstructs the detailed attention machinery only when needed. The second part is memory sparse attention. Instead of attending to all stored memory, MemOnce selects only the top-K task-relevant memory states for the current input. Importantly, the sparse routing indices are computed once and shared across layers and decoding steps. That matters because it avoids repeated routing overhead and keeps the active memory state small and stable. The combination of these two pieces is what gives MemOnce its efficiency: retrieve once, decode once, and then reuse the decoded caches across the stack. The paper also describes MemOnce as compatible with attention-based backbones, and in practice it uses a hybrid stage structure by default, interleaving linear blocks with memory sparse attention blocks. That is a practical design choice: the linear blocks help with efficiency, while the sparse attention blocks preserve selective access to memory. The experimental setup is broad. The authors evaluate MemOnce in three roles. First, as a foundation architecture trained from scratch, they scale models from 150 million to 1 billion parameters and compare against baselines such as Transformers, GDN, and YOCO. Second, as a native memory model, they adapt Qwen3.5-4B through post-training and test it on five memory benchmarks spanning contexts from 4K to 1M tokens. Third, as a representation model, they check whether the learned memory representations transfer to downstream retrieval and reranking tasks. What do they find? As a foundation architecture, MemOnce reaches lower or comparable validation perplexity to the baselines and performs well on downstream benchmarks across model sizes. That suggests the architecture is not just efficient in theory; it can actually train into a strong language model. The more striking results come in the native memory setting. The paper says MemOnce is the first native memory model to surpass the full-context baseline at the 4B scale, improving overall memory performance by 5.77%. It also outperforms prior memory methods, with gains reported over M+ and Metis. At a 1 million token context, the memory state cache is reduced by 1313 times, prefill latency drops by 6.9 times, and throughput improves by 3.5 times. Those are huge system-level gains, and they matter because long-context inference is often limited as much by memory bandwidth and cache size as by raw FLOPs. Just as important, the paper claims MemOnce avoids catastrophic forgetting on general benchmarks because inference keeps parameters frozen and ignores irrelevant decoded caches. That is an interesting point: the model is not constantly rewriting itself or depending on brittle external memory updates, so it can preserve general capability while adding reusable memory. The zero-shot representation results are also notable. The learned memory states transfer to retrieval and reranking tasks and are competitive with specialized models without task-specific fine-tuning. That suggests the memory representation is not just a compression trick for generation, but a genuinely useful embedding of context. So what do these results actually show? First, that you can compress long histories aggressively without immediately losing language modeling quality. Second, that reconstructing layer-wise KV caches from compact memory can be practical, not just conceptual. Third, that sparse retrieval over memory can be done in a way that keeps the active state bounded while still supporting long-horizon inference. Taken together, MemOnce appears to move the performance-versus-complexity frontier forward rather than merely shifting cost around. There are still limitations and open questions. The paper itself emphasizes that scalable memory remains an open challenge, which is a good reminder that no single architecture has solved continual inference. MemOnce relies on learned compression and decoding, so its success depends on whether the compressed memory preserves the right information for later reconstruction. Extremely lossy compression could still fail on tasks that need exact details. The sparse retrieval mechanism also has to identify relevant memory reliably; if the top-K selection misses important context, the decoded caches will not help. And while the paper reports strong results across several benchmarks and scales, generalization to all long-horizon settings, especially highly dynamic agentic environments, is still something to watch. Another thing to keep in mind is that the architecture introduces its own learned components: the memory encoder, the sparse router, and the layer-specific decoders. Those components are lightweight compared with full caches, but they still need to be trained well and may behave differently across model families and tasks. So the broader question is not just whether MemOnce works, but how robustly this memory pattern transfers as models, data, and deployment settings change. Still, the core contribution is clear. MemOnce proposes a practical way to make memory a first-class, scalable part of the LLM architecture: store a compact semantic trace once, retrieve it once, decode it into usable attention caches, and keep inference efficient even as context grows to extreme lengths. For long-context and continual-interaction systems, that is a very compelling direction.
Also spotted that day
Previous daily papers