MiniCPM-SALA: Hybridizing Sparse and Linear Attention for Efficient Long-Context Modeling
MiniCPM-SALA通过结合稀疏和线性注意力机制,实现了高效的长上下文建模,显著降低了计算和内存成本。
更新于 2026-11-20。作者:MiniCPM Team、Wenhao An、Yingfa Chen、Yewei Fang、Jiayi Li、Xin Li、Yaohui Li、Yishan Li、Yuxuan Li、Biyuan Lin、Chuan Liu、Hezi Liu、Siyuan Liu、Hongya Lyu、Yinxu Pan、Shixin Ren、Xingyu Shen、Zhou Su、Haojun Sun、Yangang Sun、Zhen Leng Thai、Xin Tian、Rui Wang、Xiaorong Wang、Yudong Wang、Bo Wu、Xiaoyue Xu、Dong Xu、Shuaikang Xue、Jiawei Yang、Bowen Zhang、Jinqian Zhang、Letian Zhang、Shengnan Zhang、Xinyu Zhang、Xinyuan Zhang、Zhu Zhang、Hengyu Zhao、Jiacheng Zhao、Jie Zhou、Zihan Zhou、Shuo Wang、Chaojun Xiao、Xu Han、Zhiyuan Liu、Maosong Sun。
中文摘要
大型语言模型(LLMs)向超长上下文应用的发展面临着由Transformer架构的高计算和内存成本带来的挑战。尽管现有的稀疏和线性注意力机制试图缓解这些问题,但它们通常需要在内存效率和模型性能之间做出权衡。本文介绍了一种名为MiniCPM-SALA的9B参数混合架构,该架构将稀疏注意力的高保真长上下文建模(InfLLM-V2)与线性注意力的全局效率(Lightning Attention)相结合。通过采用层选择算法以1:3的比例集成这些机制,并利用混合位置编码(HyPE),该模型在长上下文任务中保持了效率和性能。此外,我们引入了一种成本效益高的持续训练框架,该框架将预训练的基于Transformer的模型转换为混合模型,与从头开始训练相比,可降低约75%的训练成本。广泛的实验表明,MiniCPM-SALA在保持与全注意力模型相当的一般能力的同时,提供了更高的效率。在单个NVIDIA A6000D GPU上,该模型在256K个token的序列长度下,推理速度达到了全注意力模型的3.5倍,并支持长达1M个token的上下文长度,这是一个传统全注意力8B模型由于内存限制而无法达到的规模。
英文摘要
The evolution of large language models (LLMs) towards applications with ultra-long contexts faces challenges posed by the high computational and memory costs of the Transformer architecture. While existing sparse and linear attention mechanisms attempt to mitigate these issues, they typically involve a trade-off between memory efficiency and model performance. This paper introduces MiniCPM-SALA, a 9B-parameter hybrid architecture that integrates the high-fidelity long-context modeling of sparse attention (InfLLM-V2) with the global efficiency of linear attention (Lightning Attention). By employing a layer selection algorithm to integrate these mechanisms in a 1:3 ratio and utilizing a hybrid positional encoding (HyPE), the model maintains efficiency and performance for long-context tasks. Furthermore, we introduce a cost-effective continual training framework that transforms pre-trained Transformer-based models into hybrid models, which reduces training costs by approximately 75% compared to training from scratch. Extensive experiments show that MiniCPM-SALA maintains general capabilities comparable to full-attention models while offering improved efficiency. On a single NVIDIA A6000D GPU, the model achieves up to 3.5x the inference speed of the full-attention model at the sequence length of 256K tokens and supports context lengths of up to 1M tokens, a scale where traditional full-attention 8B models fail because of memory constraints.
解读
一句话总结
MiniCPM-SALA通过结合稀疏和线性注意力机制,实现了高效的长上下文建模,显著降低了计算和内存成本。
问题1:这篇论文想要解决什么具体问题?
- 问题背景:大型语言模型(LLM)在处理超长上下文时,由于Transformer架构的高计算和内存成本,面临着挑战。
- 现有方案不足:稀疏和线性注意力机制虽然试图缓解这些问题,但通常需要在内存效率和模型性能之间做出权衡。
- 研究目标:提出MiniCPM-SALA,一种9B参数的混合架构,结合稀疏注意力(InfLLM-V2)的高保真长上下文建模能力和线性注意力(Lightning Attention)的全局效率。
问题2:论文的核心创新点是什么?
- 技术创新:引入了稀疏-线性混合注意力机制,结合25%的InfLLM-V2和75%的Lightning Attention。
- 方法改进:采用层选择算法以1:3的比例整合这两种机制,并使用混合位置编码(HyPE)。
- 优势:在保持效率的同时,MiniCPM-SALA在长上下文任务中保持了高性能。
问题3:实验结果如何验证了方法的有效性?
- 关键实验:在多个基准测试中进行评估,包括知识密集型任务、编码基准、数学推理集和其他代表性基准。
- 性能提升:MiniCPM-SALA在标准基准测试中取得了与全注意力模型相当的平均分数,在长上下文基准测试中表现出色。
- 对比结果:与Qwen3-8B等全注意力模型相比,MiniCPM-SALA在NVIDIA A6000D GPU上实现了高达3.5倍的推理速度,并支持长达1M个token的上下文长度。
问题4:这个研究的实际应用价值是什么?
- 应用场景:适用于需要处理超长上下文的应用,如技术手册、代码工程和复杂任务的长期代理。
- 实施建议:利用Transformer到混合模型的转换范式,减少模型开发成本。
- 局限与展望:MiniCPM-SALA在边缘计算场景中表现出色,但在处理超长上下文时,仍可能存在内存限制。未来研究方向包括进一步优化内存效率和扩展模型规模。
来源
机器可读索引:llms.txt