1M Token Conversations Without GPU Memory Spikes: MemOnce Ushers in the Era of Local Long-Memory Agents
MemOnce, a memory architecture designed for long-horizon and continual interactions, demonstrates linear-time memory reuse performance—achieving a 1313x reducti
As large language models (LLMs) expand beyond simple question-answering into analyzing hundreds of pages of documents or running long-horizon autonomous agent workflows, efficiently retaining massive conversational histories has become a central challenge. Traditional Transformer architectures suffer from a critical bottleneck: as contexts grow longer, the key-value cache (KV Cache—temporary memory storing previous token computations to avoid redundant recalculations) expands linearly, while computational complexity explodes quadratically with sequence length. Addressing this memory barrier head-on, researchers have introduced 'MemOnce', a novel memory architecture tailored for long-term interactions.

Image source: https://arxiv.org/abs/2611.27973
MemOnce is a foundational memory architecture engineered to let language models compress, retain, and dynamically reuse extensive past interactions. It overcomes the tendency of prior linear-time architectures to lose fine-grained contextual details during aggressive compression, maintaining robust memory retention even across massive context windows.
Memory Encoder-Decoder and Sparse Attention Mechanics
The architecture of MemOnce rests upon two core design principles. First is the memory encoder-decoder: rather than naively stacking every token from an ongoing dialogue, the model caches only a compact subset of final-layer hidden states (internal vector representations capturing semantic meaning) as lightweight memory representations. When new inputs arrive, MemOnce dynamically decodes these compact representations back into the exact KV cache formats required by attention layers.
Second is the memory sparse attention mechanism. Instead of repeatedly running heavy computations across every layer for every incoming token, MemOnce adaptively retrieves relevant memory representations. Crucially, these sparse indices are computed only once across all layers. Coupling these two designs enables efficient, on-the-fly memory loading and KV cache decoding, drastically reducing the GPU memory footprint while achieving linear-time complexity (where computational growth scales linearly rather than quadratically with input length).
Groundbreaking Metrics at a 1M Context Window
The research team conducted extensive evaluations across varying model sizes and context lengths. Notably, adapting the open-source large language model Qwen3.5-4B with MemOnce yielded striking performance improvements.
At a massive 1-million-token context length, MemOnce reduced the memory state cache by an astounding 1313x. Furthermore, prefill latency (the waiting time from receiving a prompt to generating the first token) was slashed by 6.9x. Alongside these gains, system throughput improved by 3.5x, and overall memory performance saw a 5.77% boost. These figures indicate that the approach successfully resolves capacity constraints while delivering practical speed and efficiency gains.
Implications for Local AI Agents
This research offers a promising pathway for individuals and enterprises to handle million-token document archives locally or operate long-term project agents spanning months—all without relying on prohibitively expensive server infrastructure. Building AI systems capable of recalling extensive personal conversation histories, complex codebases, or comprehensive enterprise logs without context degradation is now significantly more feasible.
At the same time, because MemOnce is currently a preprint published on arXiv ahead of formal peer review, further real-world validation across diverse commercial production environments remains necessary. Nevertheless, by structurally alleviating the memory explosion problem inherent to standard Transformers, MemOnce establishes a vital milestone for future LLM architecture design.