arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2403.17312cs.AIcs.LGcs.PF
收藏

ALISA:通过稀疏感知的 KV 缓存加速大语言模型推理

ALISA: Accelerating Large Language Model Inference via Sparsity-Aware KV Caching

University of Central Florida(中佛罗里达大学)

Youpeng Zhao, Di Wu, Jun Wang

AI总结:

本文提出 ALISA 算法-系统协同设计方案,通过稀疏窗口注意力算法与三阶段动态调度优化 KV 缓存,在资源受限系统中以可忽略精度损失显著提升大语言模型推理吞吐量。

摘要:

Transformer 架构显著推进了自然语言处理(NLP)的发展,并在开发如 LLaMA 和 OPT 等大语言模型(LLM)中发挥了基础性作用,这些模型已在广泛的 NLP 任务中占据主导地位。尽管准确率极高,LLM 在实际推理中因计算和内存密集的特性而面临独特挑战。得益于 LLM 推理的自回归特性,Transformer 中注意力层的 KV 缓存通过用线性复杂度的内存访问替代二次复杂度的计算,能有效加速 LLM 推理。然而,随着处理更长序列的需求增加,该方法需要更多内存。这种开销会导致因 I/O 瓶颈降低吞吐量,甚至出现内存溢出错误,在资源受限系统(如单个商用 GPU)上尤为明显。本文提出 ALISA,一种新颖的算法-系统协同设计方案,以应对 KV 缓存带来的挑战。在算法层面,ALISA 通过稀疏窗口注意力(SWA)算法,优先处理对生成新 Token 最重要的 Token。SWA 在注意力层引入高稀疏性,以可忽略的精度损失减少 KV 缓存的内存占用。在系统层面,ALISA 采用三阶段 Token 级动态调度,优化缓存与重计算之间的权衡,从而在资源受限系统中最大化整体性能。在单 GPU-CPU 系统中,我们证明在不同工作负载下,ALISA 分别将 FlexGen 和 vLLM 等基线系统的吞吐量提升了最高 3 倍和 1.9 倍。

英文摘要:

The Transformer architecture has significantly advanced natural language processing (NLP) and has been foundational in developing large language models (LLMs) such as LLaMA and OPT, which have come to dominate a broad range of NLP tasks. Despite their superior accuracy, LLMs present unique challenges in practical inference, concerning the compute and memory-intensive nature. Thanks to the autoregressive characteristic of LLM inference, KV caching for the attention layers in Transformers can effectively accelerate LLM inference by substituting quadratic-complexity computation with linear-complexity memory accesses. Yet, this approach requires increasing memory as demand grows for processing longer sequences. The overhead leads to reduced throughput due to I/O bottlenecks and even out-of-memory errors, particularly on resource-constrained systems like a single commodity GPU. In this paper, we propose ALISA, a novel algorithm-system co-design solution to address the challenges imposed by KV caching. On the algorithm level, ALISA prioritizes tokens that are most important in generating a new token via a Sparse Window Attention (SWA) algorithm. SWA introduces high sparsity in attention layers and reduces the memory footprint of KV caching at negligible accuracy loss. On the system level, ALISA employs three-phase token-level dynamical scheduling and optimizes the trade-off between caching and recomputation, thus maximizing the overall performance in resource-constrained systems. In a single GPU-CPU system, we demonstrate that under varying workloads, ALISA improves the throughput of baseline systems such as FlexGen and vLLM by up to 3X and 1.9X, respectively.

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

↑