arXiv:2509.11155cs.LGcs.AI2025-09被引 1

AQUA通过查询幅度动态稀疏化,让大模型推理更快更省内存。

AQUA: Attention via QUery mAgnitudes for Memory and Compute Efficient Inference in LLMs

  • 基于查询向量大小动态选择关键维度,减少注意力计算量。
  • 在Llama-3.1-8B上实现25%的计算量下降,性能几乎无损。
  • 兼容现有优化方法,适合追求高效推理的部署场景。

注意力机制的二次复杂度是大型语言模型扩展长上下文时的主要障碍,造成计算与内存瓶颈。为此,我们提出AQUA(Attention via QUery mAgnitudes),一种新颖且通用的近似策略,显著降低注意力开销并保持可接受的性能。该方法分两阶段进行:离线阶段通过在校准数据集上对奇异值分解(SVD)计算一个通用、语言无关的投影矩阵;在线推理阶段,对查询和键向量进行投影,并根据查询幅度动态选择稀疏维度子集。我们提供了AQUA的形式化理论分析,确定其在何种条件下比标准注意力更高效。在Llama-3.1-8B等先进模型上的实证评估表明,注意力点积计算量可减少25%,且在多种基准测试中性能影响统计不显著。此外,AQUA还可与现有令牌淘汰方法(如H2O)协同加速,并直接减小KV缓存内存占用。通过提供效率与精度间的可控权衡,AQUA为大规模大模型推理的可访问性与可持续性提供了实用工具。

原文摘要 · Abstract (English)

The quadratic complexity of the attention mechanism remains a fundamental barrier to scaling Large Language Models (LLMs) to longer contexts, creating a critical bottleneck in both computation and memory. To address this, we introduce AQUA (Attention via QUery mAgnitudes) a novel and versatile approximation strategy that significantly reduces the cost of attention with a graceful performance trade-off. Our method operates in two phases: an efficient offline step where we compute a universal, language agnostic projection matrix via SVD on a calibration dataset, and an online inference step where we project query and key vectors and dynamically select a sparse subset of dimensions based on the query's magnitude. We provide a formal theoretical analysis of AQUA, establishing the break-even point at which it becomes more computationally efficient than standard attention. Our empirical evaluations on state-of-the-art models like Llama-3.1-8B demonstrate that a 25% reduction in the attention dot-product computation can be achieved with a statistically insignificant impact on performance across a wide range of benchmarks. We further showcase the versatility of AQUA by demonstrating its ability to synergistically accelerate existing token eviction methods like H2O and to directly reduce KV-cache memory size. By offering a controllable knob to balance efficiency and accuracy, AQUA provides a practical and powerful tool for making large-scale LLM inference more accessible and sustainable.

大模型推理注意力优化内存效率稀疏化

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