arXiv:2602.11761cs.CLcs.AI2026-02被引 4

混合稀疏与线性注意力,让大模型高效处理百万级长文本

MiniCPM-SALA: Hybridizing Sparse and Linear Attention for Efficient Long-Context Modeling

  • 采用1:3比例融合稀疏与线性注意力,结合高精度与低开销优势
  • 在256K token下推理速度达全注意力模型的3.5倍,支持100万token上下文
  • 仅需75%训练成本即可将旧模型升级为混合架构,适合资源受限场景

大型语言模型向超长上下文应用演进时,面临Transformer架构带来的高计算与内存开销。现有稀疏与线性注意力机制虽能缓解此问题,但常在内存效率与模型性能间权衡。本文提出MiniCPM-SALA,一个90亿参数的混合架构,融合稀疏注意力(InfLLM-V2)的高保真长上下文建模能力与线性注意力(Lightning Attention)的全局高效性。通过层选择算法以1:3比例集成两种机制,并引入混合位置编码(HyPE),模型在长上下文任务中保持高效与高性能。此外,我们设计了一种低成本持续训练框架,可将预训练的Transformer模型转化为混合模型,训练成本较从头训练降低约75%。大量实验表明,MiniCPM-SALA在通用能力上与全注意力模型相当,同时显著提升效率。在单张NVIDIA A6000D GPU上,256K token序列下推理速度达全注意力模型的3.5倍,支持最高100万token上下文,而传统80亿参数全注意力模型因内存限制无法处理此类规模。

原文摘要 · Abstract (English)

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.

长文本建模混合注意力高效推理轻量化模型

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。