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.
Sam: A language model can remember more without keeping its entire history active. MemOnce reports better average recall than a full-history model, while sharply reducing the memory needed during use.
Alex: That sounds like a useful trade, especially for continuing conversations. Is this a new model architecture, or a system that searches old messages?
Sam: It’s an architecture method paper, presented as an arXiv preprint by Chang Nie and colleagues at Nanjing University and the University of Science and Technology of China. It learns compact memories, then brings selected memories back into the model when needed.
Alex: So the audience includes researchers building models that need to carry information across interactions, not just answer one long prompt.
Sam: Yes. The practical question is whether remembering past interactions must keep making responses slower and more expensive. We’ll unpack the design, the evidence for better recall, and why constant active memory does not mean constant total storage.
Alex: Start with the bottleneck. What does an ordinary model keep that makes a growing conversation expensive?
Sam: A standard Transformer keeps a key-value cache: stored attention records that save it from recomputing previous text. Those records accumulate for tokens across the model’s layers. As history grows, the cache grows, and processing the whole context has quadratic computational cost.
Alex: The alternative is to compress history into a fixed-size state. But then the question becomes which details survive.
Sam: That’s the trade-off the authors identify. Linear and recurrent models keep bounded states, but can lose fine-grained historical information. Other approaches share caches across layers or select relevant history, yet still store growing caches or repeat retrieval work throughout the model.
Alex: Retrieval and cache sharing already exist, then. What is MemOnce combining that those approaches do not?
Sam: Two designs that depend on each other. First, store a compressed set of final-layer representations and learn how to decode them for different attention layers. Second, retrieve relevant memories once per query and reuse that selection across layers and subsequent response generation.
Alex: Let’s make the compression concrete. What actually gets saved from a piece of conversation?
Sam: The encoder processes historical text in chunks. It produces hidden states, the model’s internal numerical representations. By default, it saves only the trailing one-eighth of those states from the final layer.
Alex: Keeping the end of a chunk sounds risky. Why should those positions carry facts that appeared earlier?
Sam: The design relies on information accumulating toward later positions as the model processes the chunk. Those trailing states are learned representations, not simply the last words copied from the text. In the authors’ compression tests, retaining that smaller set caused very little average accuracy loss.
Alex: And saving only the final layer removes the need to preserve separate historical records at every depth. But different layers still need different information when answering.
Sam: That is why MemOnce does not just reuse identical records everywhere. Small, layer-specific networks decode the saved representations into the key-value caches each attention layer needs. The novelty is learned reconstruction, rather than direct sharing alone.
Alex: That handles compact storage. How does the model decide which old memories deserve to be reconstructed?
Sam: It keeps recent memories in a short-term window and moves older ones into a long-term pool. The query gets an internal representation, which is compared with compact descriptors of stored chunks. The closest matches join the recent window, and only that selected set supplies historical attention.
Alex: So it does not search again at every layer, or change its historical selection with every generated word. That should reduce repeated retrieval and data movement.
Sam: That is the intended systems benefit. Older memories can sit in host memory or on solid-state storage until selected. The active subset has a fixed budget, even as the persistent memory bank expands.
Alex: Then “constant memory” needs a qualification. The archive still grows somewhere, even if the active memories stay bounded.
Sam: Absolutely. The claim concerns the active memory-state cache, not all storage or all graphics-processor memory. The persistent pool grows, and the implementation also keeps a growing retrieval index on the graphics processor. Those distinctions matter when interpreting the headline savings.
Alex: Let’s turn to evidence. Did they build models from scratch, or attach this mechanism to an existing model?
Sam: Both. They pretrained architectures under matched data and training budgets, finding generally competitive language modeling and downstream accuracy. Separately, they adapted pretrained Qwen models, freezing the backbone while training the memory machinery and encoding adapters.
Alex: The claim that grabs attention is better recall than the full-history model. How broad was that comparison?
Sam: The main comparison covered five memory benchmarks, ranging from short histories to million-token contexts. On the four-billion-parameter model, average accuracy rose from about fifty-four percent to sixty percent. That compares MemOnce with its full-context Qwen counterpart.
Alex: An average can conceal a trade-off. Did selective memory win on every benchmark?
Sam: No. The full-context model remained better on LoCoMo, a conversational memory benchmark. MemOnce won on the other benchmarks in that comparison. The authors attribute its overall gain to filtering irrelevant history, reducing the dilution of attention over long sequences.
Alex: Does anything test that filtering explanation, rather than just show a better final score?
Sam: Their retrieval-budget experiment helps. Removing long-term retrieval sharply reduced recall, while adding a modest retrieved set recovered most of the gain. Expanding the set beyond the best setting reduced average performance, consistent with extra low-relevance memories introducing noise.
Alex: What do the efficiency results mean in use? Faster history processing, less storage on the graphics processor, or faster answers?
Sam: All three improved at the longest tested context, though they are separate measurements. The active memory-state cache was roughly thirteen hundred times smaller than the Qwen baseline’s. Prefill, meaning processing history before generating a response, was about seven times faster.
Alex: Are those savings equally compelling for shorter histories, where moving and decoding memories could become overhead?
Sam: No. At the shortest context in their efficiency comparison, the full-context Qwen baseline finished prefill faster. MemOnce’s advantage grew with context length, while its decoding throughput stayed nearly steady. This is a long-history result, not a universal speedup.
Alex: What makes you cautious about carrying these benchmark results into an actual research agent?
Sam: The authors explicitly say complex agent tasks remain insufficiently validated, including interactive coding and multi-step tool use. Their scratch pretraining also stops at roughly a billion parameters. Adapting larger pretrained models does not establish that larger models trained entirely this way will behave similarly.
Alex: And the response scores themselves include automated judging, rather than every answer being assessed by people.
Sam: Yes. Multiple-choice tasks use exact accuracy, while open-ended tasks use benchmark-specific language-model judging. I’d call this substantial evidence across the reported benchmarks and systems tests, but not validation of reliable memory throughout open-ended agent work.
Alex: Who should read the full document, and where should they begin?
Sam: Researchers designing model architectures or long-context inference should start with Memory Encoder-Decoder and Memory Sparse Attention. Then read the detailed inference-efficiency comparison, separating active cache, offloaded storage, and retrieval overhead. Agent researchers should read the limitations before treating recall gains as evidence of better interactive task performance.
Alex: And what should everyone else carry away?
Sam: A model’s stored history and its active history do not have to be the same size. MemOnce makes that separation useful by learning both what to save and how to bring selected memories back into attention.
Alex: Thanks for listening.