arXiv:2602.04541cs.CLcs.AI2026-02被引 5

通过细粒度头选择加速长文本大模型推理,兼顾速度与质量。

LycheeDecode: Accelerating Long-Context LLM Inference via Hybrid-Head Sparse Decoding

  • 按功能区分注意力头,动态选关键信息,其余复用提升效率
  • 在128K上下文长度下实现最高2.7倍加速,生成质量接近全注意力基线
  • 适合需要高效长文本处理的部署场景,如智能写作、复杂推理

长上下文大语言模型的普及暴露出解码过程中键值缓存急剧膨胀的关键瓶颈,带来巨大的内存和延迟开销。现有方法尝试通过跨层共享一组关键令牌来缓解,但粗粒度共享忽略了注意力头的功能差异,损害模型性能。为此,我们提出LycheeDecode,一种基于细粒度混合头注意力机制的高效解码方法,采用硬件友好的top-k选择策略。其核心为HardKuma机制,将注意力头分为少量动态识别关键令牌的检索头和多数复用这些令牌的稀疏头,实现高效计算。在Llama3和Qwen3等主流模型上,覆盖LongBench、RULER等长文本理解任务及AIME24、OlympiadBench等复杂推理任务的大量实验表明,LycheeDecode在生成质量上可媲美甚至超越全注意力基线,且在128K上下文长度下实现高达2.7倍的加速。该方法通过保留注意力头的功能多样性,突破了现有方法的性能瓶颈,为高效高质的长上下文大模型推理提供了有效路径。

原文摘要 · Abstract (English)

The proliferation of long-context large language models (LLMs) exposes a key bottleneck: the rapidly expanding key-value cache during decoding, which imposes heavy memory and latency costs. While recent approaches attempt to alleviate this by sharing a single set of crucial tokens across layers, such coarse-grained sharing undermines model performance by neglecting the functional diversity of attention heads. To address this, we propose LycheeDecode, an efficient decoding method centered on a fine-grained hybrid-head attention mechanism that employs a hardware-efficient top-k selection strategy. Specifically, the novel HardKuma-based mechanism partitions attention heads into a small subset of retrieval heads that dynamically identify crucial tokens and a majority of sparse heads that reuse them for efficient computation. Through extensive experiments on leading models like Llama3 and Qwen3 across diverse benchmarks for long-context understanding (e.g., LongBench, RULER) and complex reasoning (e.g., AIME24, OlympiadBench), we demonstrate that LycheeDecode achieves generative quality comparable to, and at times surpassing even the full-attention baseline. Crucially, this is accomplished with up to a 2.7x speedup at a 128K context length. By preserving the functional diversity of attention heads, our fine-grained strategy overcomes the performance bottlenecks of existing methods, providing a powerful and validated pathway to both efficient and high-quality long-context LLM inference.

长文本生成注意力优化推理加速

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