Navigation menu
MemOnce: A Scalable Memory Architecture for Large Language Models
MemOnce: A Scalable Memory Architecture for Large Language Models
Chang Nie, Chaoyou Fu, Songlin Liu, Yiqing Hu, Caifeng Shan
2026-11-23▲ 20arXiv 2611.27973v1Hugging FaceCode
AI-generated from the full paper (deepseek-flash). It may contain mistakes; check the original.
TL;DR
MemOnce is a memory architecture that caches a compact subset of final-layer hidden states and retrieves them once to decode KV caches on demand, aiming for accurate recall with linear-time inference and bounded active memory.
Problem
Existing architectures face a trade-off between retention fidelity and inference scalability. Transformers with global attention retain layer-wise token-level KV caches, causing linear GPU memory growth and quadratic computation as context expands. Recurrent and linear models compress history into fixed-size states for constant-memory linear-time inference, but bounded state capacity can induce information decay and hinder fine-grained long-horizon recall. Prior work in attention optimizations, native memory models, and external memory systems still faces global cache growth, performance degradation, retrieval overhead, catastrophic forgetting, or costly external stores.
Method
MemOnce maintains a single compact global cache and retrieves relevant memory only once during continual inference to decode layer-wise KV caches on demand. Its memory encoder-decoder caches a small subset of final-layer hidden states as compact memory representations and dynamically decodes them via lightweight MLPs into KV caches, achieving Lr× compression across depth and time. Memory sparse attention adaptively selects top-K task-relevant states for each input and shares sparse routing indices across all attention layers and decoding steps. The default backbone is an L-stage hybrid that interleaves three linear blocks such as GDN with one Memory Sparse Attention block. Post-training uses chunked memory encoding, an InfoNCE contrastive loss to supervise retrieval, and frozen-backbone generation after constructing the active memory state.
Results
- MemOnce is reported as the first native memory model to surpass the full-context baseline and to outperform prior memory methods. §1
- At 1M context, MemOnce reduces memory state cache, prefill latency, and improves throughput. §1
- At 128K context, MemOnce has lower query-time retrieval latency and data transfer than M+ and RAG-Rewrite. §E.4
- Retrieving K=16 long-term representations yields a large gain over K=0, performance peaks at K=64, and K=128 slightly reduces the average score while doubling the retrieval footprint. §E.3
- Increasing the compression ratio from 1× to 8× causes only negligible accuracy drops with linear states persisted or discarded. §E.1
- At larger scales, MemOnce achieves the best validation perplexity and highest overall downstream accuracy at 603M and 945M. §F.1
Limitations
- The paper states that pre-training from scratch is conducted up to the 1B parameter scale due to available computing resources, and full pre-training at larger scales such as 7B or beyond remains future work.
- The paper states that performance in downstream agent tasks remains to be fully validated, particularly long-horizon interactive coding and multi-step tool use.
- The post-training memory benchmark results shown are at 2B and 4B; the paper does not report post-trained memory results at larger model scales.
Key points
- MemOnce maintains a single compact global cache and retrieves relevant memory only once to decode layer-wise KV caches on demand. §1
- The memory encoder-decoder caches a small subset of final-layer hidden states and decodes them via lightweight MLPs into KV caches, giving Lr× compression across depth and time. §1
- Memory sparse attention selects top-K task-relevant states per input and shares sparse routing indices across all attention layers and decoding steps. §1
- The default backbone is an L-stage hybrid that interleaves three linear blocks such as GDN with one Memory Sparse Attention block. §3
- Post-training uses chunked memory encoding up to 8 segments or 4096 tokens, with independent per-chunk encoding that avoids sequential retrieval during prefill. §B.2
- The indexing projection is jointly optimized with an InfoNCE contrastive loss over relevant historical states. §B.2
- During generation the memory adapter is disabled and the frozen backbone uses on-demand decoded KV caches, preserving base model general capabilities without catastrophic forgetting. §B.2
- By default MemOnce discards cross-segment linear recurrent states, since both persisted and discarded settings perform nearly identically. §E.2
Mind map
Sign In
Choose a method to continue
By signing in, you agree to our Terms and Privacy Policy

