2025-10-16 · 专家 · 自然语言处理 · 机器学习

NOSA: Native and Offloadable Sparse Attention

该论文提出了一种名为NOSA的稀疏注意力机制,通过引入显式局部性约束和KV缓存卸载,显著提高了长上下文处理中LLM的解码吞吐量。

更新于 2025-10-16。作者:Yuxiang Huang、Chaojun Xiao、Xu Han、Zhiyuan Liu。

中文摘要

可训练稀疏注意力已成为解决长上下文处理中LLM解码效率瓶颈的有希望的方法,在显著减少内存访问的同时,对任务性能的影响微乎其微。然而,现有的稀疏注意力方法留下了一个关键的限制尚未解决:键值(KV)缓存的大小没有减少,这限制了GPU上的批量大小并限制了解码吞吐量,尤其是在大规模批量推理中。在这篇论文中,我们表明可训练稀疏注意力在相邻解码步骤中的标记选择上自然表现出很强的局部性,从而使得KV缓存卸载而无需改变底层注意力计算。然而,固有的局部性仍然不足以实现高效的卸载,因为CPU和GPU之间所选KV对的传输继续占据整体解码成本的主导地位。基于这一洞察,我们提出了NOSA,这是一个旨在原生支持KV缓存卸载的可训练稀疏注意力框架。NOSA通过将标记选择分解为查询感知和查询无关组件来引入显式的局部性约束,从而减少KV传输,同时保留与训练期间使用的相同的注意力计算。我们使用NOSA预训练了一个1B参数的模型,并进行了广泛的基准测试,结果表明它保持了几乎无损的性能,同时与标准的可训练稀疏注意力基线(InfLLM-V2)相比,解码吞吐量实现了高达2.3倍的提升。

英文摘要

Trainable sparse attention has emerged as a promising solution to address the decoding efficiency bottleneck of LLMs in long-context processing, significantly saving memory accesses while minimally impacting task performance. However, existing sparse attention methods leave a crucial limitation unresolved: the size of the key-value (KV) cache remains unreduced, which constrains on-GPU batch sizes and throttles decoding throughput, especially in large-scale batched inference. In this paper, we show that trainable sparse attention naturally exhibits strong locality in token selection across adjacent decoding steps, thereby enabling KV cache offloading without altering the underlying attention computation. However, the inherent locality remains insufficient to achieve efficient offloading, as the transfer of selected KV pairs between the CPU and GPU continues to dominate the overall decoding cost. Building on this insight, we present NOSA, a trainable sparse attention framework designed to natively support KV cache offloading. NOSA introduces explicit locality constraints by decomposing token selection into query-aware and query-agnostic components, thereby reducing KV transfers while preserving the same attention computation as used during training. We pretrain a 1B-parameter model with NOSA and conduct extensive benchmarks, showing that it preserves near-lossless performance while achieving up to a 2.3x improvement in decoding throughput compared with the vanilla trainable sparse attention baseline (InfLLM-V2).

解读

一句话总结

该论文提出了一种名为NOSA的稀疏注意力机制,通过引入显式局部性约束和KV缓存卸载,显著提高了长上下文处理中LLM的解码吞吐量。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源