SparDA:面向高效长上下文大语言模型推理的稀疏解耦注意力 SparDA: Sparse Decoupled Attention for Efficient Long-Context LLM Inference 预印本

⚠️ 本文为 预印本(arXiv 公开版本),尚未经过正式同行评审。作者自发公开,结论未经期刊审稿验证,阅读时请知悉。
发布时间:2026-06-03
⬇️ 1 次下载
👁️ 预览文献
💡 AI 中文简介
长上下文大模型推理时,稀疏注意力虽能省算力,但KV缓存仍随长度增长,卸载到CPU又受PCIe带宽拖累,且稀疏选择本身是O(T²)开销。作者提出SparDA,在每层Query/Key/Value之外增加一个Forecast投影,提前预测下一层需要的KV块,实现预取与当前层计算重叠,并用每组一个Forecast头降低选择开销。仅增加不到0.5%参数,在8B模型上精度持平或略升,预填充提速最高1.25倍、解码提速1.7倍,单卡解码吞吐最高提升5.3倍。
领域大语言模型推理优化/高效注意力机制
适合谁读需要一定专业背景(熟悉Transformer、KV缓存与注意力机制)
核心贡献1. 提出解耦的Forecast投影,提前预测下一层所需KV块,使CPU到GPU预取与当前层计算重叠,缓解PCIe瓶颈;2. 将Forecast与注意力查询解耦,在GQA中每组仅用一个Forecast头,降低稀疏选择开销,且仅训练Forecast即可匹配原选择器的注意力分布。
关键数据参数量增加<0.5%;两个8B稀疏预训练模型上精度持平或略升;预填充最高1.25倍加速,解码最高1.7倍加速;单GPU更大可行批大小下,解码吞吐比非卸载稀疏基线最高5.3倍。
推荐理由如果你被长上下文推理的显存和PCIe带宽卡住,这篇用不到0.5%参数换来最高5.3倍解码吞吐的工作值得一读。
关键词["稀疏注意力", "长上下文推理", "KV缓存卸载", "大语言模型", "预取与计算重叠"]

原文摘要

查看英文原文摘要

Sparse attention reduces compute and memory bandwidth for long-context LLM inference. However, two key challenges remain: (1) KV cache capacity still grows with sequence length, and offloading to CPU memory introduces a PCIe transfer bottleneck; (2) the sparse selection step itself retains $O(T^2)$ complexity and can dominate attention cost at long contexts. We propose SparDA, a decoupled sparse attention architecture that introduces a fourth per-layer projection, the Forecast, alongside Query, Key, and Value. The Forecast predicts the KV blocks needed by the next layer, enabling lookahead selection that overlaps CPU-to-GPU prefetch with current-layer execution. Because Forecast is decoupled from the attention query, our GQA implementation uses one Forecast head per GQA group, reducing selection overhead versus the original multi-head selector. SparDA adds $<$0.5% parameters and trains only the Forecast projections by matching the original selector's attention distribution. On two sparse-pretrained 8B models, SparDA matches or slightly improves accuracy and delivers up to 1.25$\times$ prefill speedup and 1.7$\times$ decode speedup over the sparse-attention offload baseline. By enabling larger feasible batch sizes on a single GPU, SparDA further reaches up to 5.3$\times$ higher decode throughput than the non-offload sparse baseline. Our source code is available at https://github.com/NVlabs/SparDA.