2026-11-23 · 专家 · 自然语言处理 · 机器学习

MemOnce: A Scalable Memory Architecture for Large Language Models

MemOnce提出了一种可扩展的内存架构,用于大型语言模型,通过内存编码器-解码器和内存稀疏注意力设计,实现了高效的在线内存加载和解码,显著降低了GPU内存占用并提高了性能。

更新于 2026-11-29。作者:Chang Nie、Chaoyou Fu、Songlin Liu、Yiqing Hu、Caifeng Shan。

中文摘要

部署长周期和持续交互的大型语言模型(LLMs)需要维护可重用的内存状态以供未来的推理,这对现有架构提出了挑战。标准Transformer会逐层、逐词地累积KV缓存,随着上下文的扩展,导致GPU内存线性增长和二次计算复杂度。相比之下,线性时间架构将历史压缩成固定大小的状态,但难以保留细粒度细节。我们引入了MemOnce,这是一种学习可扩展内存状态的基础架构。MemOnce基于两个核心设计:(a) 内存编码器-解码器:它仅缓存一小部分最终层隐藏状态作为紧凑的内存表示,并动态地将它们解码回KV缓存以供注意力层使用;(b) 内存稀疏注意力:对于每个持续输入,MemOnce自适应地检索相关的内存表示,稀疏索引仅在层间计算一次。结合这两个设计,使得内存加载和KV缓存解码高效灵活,大幅减少GPU内存占用,实现线性时间复杂度。我们进行了广泛的实验,表明MemOnce在各种模型大小、上下文长度和训练范式(预训练和后训练适应)上优于Transformer和其他架构。特别是,使用MemOnce对Qwen3.5-4B进行适配,在1M上下文中将内存状态缓存减少了1313倍,预填充延迟降低了6.9倍,吞吐量提高了3.5倍,整体内存性能提升了+5.77%。最后,MemOnce将零样本泛化到下游表示任务中,在针对专用模型的竞争中取得了具有竞争力的结果。

英文摘要

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提出了一种可扩展的内存架构,用于大型语言模型,通过内存编码器-解码器和内存稀疏注意力设计,实现了高效的在线内存加载和解码,显著降低了GPU内存占用并提高了性能。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源

机器可读索引:llms.txt