MemOnce: A Scalable Memory Architecture for Large Language Models

Chang Nie, Chaoyou Fu, Songlin Liu, Yiqing Hu, Caifeng Shan

arXiv:2611.27973 · 2026-11-23 공개 · arXiv · PDF

llm transformer large-language-models kv-cache sparse-attention throughput-optimization context-length memory-architecture

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 1313times and prefill latency by 6.9times at 1M context, and improves throughput by 3.5times and overall memory performance by +5.77%. Finally, MemOnce generalizes zero-shot to downstream representation tasks, achieving competitive results against specialized models.

한국어 요약

한 줄 요약

MemOnce는 Qwen3.5-4B에서 1313× 메모리 절감과 6.9× 전처리 속도 향상을 달성한 LLM용 확장 가능한 메모리 아키텍처이다.

핵심 기여도

핵심 아이디어

MemOnce는 기존 Transformer 아키텍처의 선형 메모리 증가와 이차적 계산 복잡도 문제를 해결하기 위해, **memory encoder-decoder**와 **memory sparse attention** 두 가지 핵심 모듈을 결합한 새로운 메모리 아키텍처를 제안한다.

이 두 모듈은 메모리 캐시의 단일 저장과 필요 시 디코딩을 통해, 메모리 점유율을 줄이고, 실시간 추론 성능을 향상시킨다.

기술적 접근법

주요 결과

의의 및 한계

MemOnce는 기존 Transformer와 linear-time 아키텍처의 한계를 극복한 **표준 메모리 아키텍처**로서, 메모리 점유율과 계산 복잡도를 동시에 줄이며, **continual inference 환경에서의 확장성**을 높인다. 특히, **메모리 캐시 단일 저장 및 디코딩** 방식은 기존 메모리 모델의 레이어 별 검색 오버헤드 문제를 해결하며, **catastrophic forgetting**을 방지하는 데 기여.

하지만, **압축 비율 $r=8$**을 사용할 때 약 0.3% 이하의 정확도 손실이 발생하며, **압축된 메모리 표현의 세부 정보 손실** 가능성은 남아 있다. 또한, **압축된 표현의 전이 성능**은 특화된 모델 대비 경쟁력은 있으나, **최적화된 fine-tuning 없이도 최고 성능을 보장**하지는 않는다.

실용적 활용

MemOnce는 대규모 언어 모델의 **장기 컨텍스트 유지 및 실시간 추론**이 필요한 대화형 AI, 에이전트 시스템, 대규모 텍스트 분석 플랫폼 등에 적용 가능하다. 특히, **GPU 메모리 절감과 추론 속도 향상**을 요구하는 클라우드 기반 서비스 및 모바일 환경에서 유용하게 활용될 수 있다.