跳转至

注意力头的自主性:利用冻结的查询-键几何实现免数据的稀疏注意力机制

文章背景与核心概要

长文本大语言模型(LLM)的推理长期面临两大性能瓶颈:平方级复杂度的注意力计算以及急剧膨胀的键-值(KV)缓存内存开销。传统的稀疏注意力和KV压缩方法通常高度依赖于运行时的注意力分数、校准提示词(calibration prompts)或学习型门控机制,这导致注意力头的诊断过程不仅依赖输入数据,而且成本高昂。

为了克服这些局限性,本文作者推出了注意力头的自主性(Autonomy-of-Heads, AoH)方法。这是一种免数据(data-free)的技术,它直接从查询-键投影(query-key projections)的谱几何结构中识别出检索头(retrieval heads)和流式头(streaming heads),完全无需运行时数据或校准过程。实验表明,AoH在保持极高精度的同时,显著降低了推理延迟并节省了内存开销。


核心方法:查询-键投影的谱几何

AoH 利用从核注意力算子(kernel attention operator)推导出的权重空间度量来评估注意力头的功能:

Autonomy-of-Heads: Data-Free Sparse Attention from Frozen Query-Key Geometry

arXiv: 2608.06849 [cs.CL]
Subjects: Computation and Language (cs.CL); Artificial Intelligence (cs.AI)
Authors: Yehan Yang, Junyuan Shang, Yang Li, Guanqun Zhao, Shuohuan Wang, Dianhai Yu
Submitted: August 7, 2026


执行摘要

Long-context Large Language Model (LLM) inference faces significant performance bottlenecks due to quadratic attention computation complexity and rapidly growing Key-Value (KV) cache memory costs. Traditional sparse attention and KV-compression methods rely heavily on runtime attention scores, calibration prompts, or learned gates, making head diagnosis input-dependent and costly.

To overcome these limitations, the authors introduce Autonomy-of-Heads (AoH), a data-free approach that identifies retrieval and streaming heads directly from the spectral geometry of query-key projections without requiring runtime data or calibration.


核心方法:查询-键投影的谱几何

AoH evaluates attention head functionality using a weight-space measure derived from the kernel attention operator:

\[M_h = W_K^{h\top}W_Q^h\]
  • 集中式谱(Concentrated Spectra): 表明存在少量占主导地位的查询-键匹配方向,对应于检索头(retrieval heads)
  • 弥散式谱(Diffuse Spectra): 表明缺乏占主导地位的全局匹配方向,对应于流式头(streaming heads)
  • Concentrated Spectra: Indicate a small number of dominant query-key matching directions, corresponding to retrieval heads.
  • Diffuse Spectra: Indicate the absence of a dominant global matching direction, corresponding to streaming heads.

为了使该方法具有实用性,算法计算了一个高效的 \(d_\text{head}\) 维计算过程,完全避免了构建完整的 \(d_\text{model} \times d_\text{model}\) 矩阵的需求。

To make this practical, the method computes an efficient \(d_\text{head}\)-dimensional calculation, completely avoiding the need to construct the full \(d_\text{model} \times d_\text{model}\) matrix.


实验结果

在多个模型上进行的广泛评估表明,在 50% 稀疏度下的 AoH 实现了以下性能指标:

Extensive evaluations across multiple models demonstrate that AoH at 50% sparsity achieves the following performance metrics:

  • 精度保持率: 平均保留了全注意力(Full Attention)性能的 96.5%
  • 延迟降低:
  • 预填充(Prefill)延迟最高降低了 41.4%
  • 解码(Decode)延迟最高降低了 66.0%
  • 内存节省: 在上下文长度为 256K tokens 时,KV 缓存的内存占用减少了 50.0%
  • Accuracy Retention: Retains 96.5% of Full Attention performance on average.
  • Latency Reduction:
  • Prefill latency reduced by up to 41.4%.
  • Decode latency reduced by up to 66.0%.
  • Memory Savings: Reduces KV-cache memory footprint by 50.0% at a context length of 256K tokens.

链接与资源