arXiv:2603.04759cs.CLcs.AI2026-03

用双层模型压缩长文本,让大模型处理超长上下文更高效。

Stacked from One: Multi-Scale Self-Injection for Context Window Extension

  • 两层共享参数的模型:下层压缩输入,上层解码理解。
  • 仅用8K训练数据,可处理超128K长度文本,性能超越同类方法。
  • 减少内存占用和推理时间,适合实时长文本应用。

当前大型语言模型(LLMs)的上下文窗口受限,严重制约其在多领域应用。尽管持续预训练长文本数据可缓解此问题,但面临高昂的数据获取与计算成本。为此,我们提出~ extit{SharedLLM},一种基于多粒度上下文压缩与查询感知信息获取的新框架。该框架由两个堆叠的短上下文LLM构成:底层作为压缩器,将长输入转化为紧凑的多粒度表征;上层作为解码器,进行上下文感知处理。信息传递仅发生在底层,避免冗余前向传播与交叉注意力操作,实现高效计算。整个过程利用同一基础模型层实现~ extit{自注入}。为支持该结构,设计了专用树形数据结构,实现上下文信息的高效编码与查询感知检索。尽管仅在8K令牌序列上训练, extit{SharedLLM}仍能有效泛化至超过128K的输入。在一系列长上下文建模与理解基准测试中,其性能优于或媲美强基线,在效率与准确性间取得良好平衡。此外,该设计显著降低内存占用,并带来显著推理加速(流式架构下提速2倍,编码器-解码器架构下提速3倍)。

原文摘要 · Abstract (English)

The limited context window of contemporary large language models (LLMs) remains a primary bottleneck for their broader application across diverse domains. Although continual pre-training on long-context data offers a straightforward solution, it incurs prohibitive data acquisition and computational costs. To address this challenge, we propose~\modelname, a novel framework based on multi-grained context compression and query-aware information acquisition. SharedLLM comprises two stacked short-context LLMs: a lower model serving as a compressor and an upper model acting as a decoder. The lower model compresses long inputs into compact, multi-grained representations, which are then forwarded to the upper model for context-aware processing. To maximize efficiency, this information transfer occurs exclusively at the lowest layers, bypassing lengthy forward passes and redundant cross-attention operations. This entire process, wherein the upper and lower models are derived from the same underlying LLM layers, is termed~\textit{self-injection}. To support this architecture, a specialized tree-based data structure enables the efficient encoding and query-aware retrieval of contextual information. Despite being trained on sequences of only 8K tokens, \modelname~effectively generalizes to inputs exceeding 128K tokens. Across a comprehensive suite of long-context modeling and understanding benchmarks, \modelname~achieves performance superior or comparable to strong baselines, striking an optimal balance between efficiency and accuracy. Furthermore, these design choices allow \modelname~to substantially reduce the memory footprint and yield notable inference speedups ($2\times$ over streaming and $3\times$ over encoder-decoder architectures).

长上下文模型压缩自注入推理加速

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