arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2604.20819cs.LGcs.DC
收藏

Stream-CQSA:通过灵活的工作负载调度避免注意力计算中的内存不足

Stream-CQSA: Exact Out-of-Memory Recovery for Attention

Lewis-Sigler Institute of Integrative Genomics(刘易斯-西格勒整合基因组学研究所);Princeton University(普林斯顿大学)

Yiming Bian, Joshua M. Akey

AI总结:

本文提出Stream-CQSA框架,通过分解注意力计算为可调度的子任务,实现内存适应性调度,使单GPU可处理十亿token序列的精确注意力计算。

摘要:

长上下文大语言模型的可扩展性从根本上受限于精确自注意力的二次内存成本,常导致现代硬件中的内存不足故障。现有方法通过提高内存效率至近线性复杂度,但假设完整查询、键和值张量能容纳在设备内存中。本文通过引入CQS Divide操作,该操作源自循环准群(CQS)理论,将注意力分解为一组独立的子序列计算,其重新组合可精确得到完整序列注意力的结果。利用此分解,我们引入Stream-CQSA,一种内存适应性调度框架,将注意力分解为可容纳任意内存预算的子问题。这将注意力从逻辑上单一的操作转化为可调度的任务集合,使在不同设备间无需通信即可灵活执行。实验显示可预测的内存扩展,并证明通过流式处理,单GPU可执行十亿token序列的精确注意力计算,而无需改变注意力的底层数学定义或引入近似误差。

英文摘要:

Long-context large language models are limited not only by attention cost but also by out-of-memory (OOM) failures. A selected attention call may not fit in available device memory even when the kernel is optimized. Exact and approximate attention methods reduce memory use, but every fixed implementation still has a device-specific capacity boundary. We introduce Stream-CQSA, an attention-level OOM recovery framework based on CQS decomposition, derived from the theory of cyclic quorum sets (CQS). Stream-CQSA recursively partitions an infeasible attention call into independent subsequence tasks, executes each with a compatible inner kernel, and recomposes the local statistics to recover the full attention output. This recovery is exact relative to the wrapped attention kernel, whether that kernel is exact or approximate. Compared with FlashAttention-2, the major baseline, our native Stream-CQSA kernel improves 16-bit forward-output error relative to a dense float64 reference and matches 16-bit backward-gradient error where FlashAttention-2 fits in the GPU memory. At the longest feasible baseline length, it costs $1.5$--$1.9\times$ the forward runtime and $2.1$--$2.4\times$ the forward--backward runtime. Beyond that sequence length boundary, our method continues to return an output while FlashAttention-2 OOMs. Stream-CQSA is therefore not a faster attention method. Instead, it converts memory-capacity failure into a recoverable execution path by trading extra compute, host-device transfer, and recomposition for completion.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑