Serving long-context LLMs is costly because attention computation grows linearly with context length. Dynamic sparse attention algorithms (DSAs) mitigate this by attending only to the key-value (KV) cache of critical tokens. However, with DSAs, the main performance bottleneck shifts from HBM bandwidth to HBM capacity: KV caches for unselected tokens must remain in HBM for low-latency decoding, constraining parallel batch size and stalling further throughput gains. Offloading these underutilized KV caches to DRAM could free HBM capacity, allowing larger parallel batch sizes. Yet, achieving such hierarchical HBM-DRAM storage raises new challenges, including fragmented KV cache access, HBM cache contention, and high HBM demands of hybrid batching, that remain unresolved in prior work. This paper proposes SparseServe, an LLM serving system that unlocks the parallel potential of DSAs through efficient hierarchical HBM-DRAM management. SparseServe introduces three key innovations to address the challenges mentioned above: (1) fragmentation-aware KV cache transfer, which accelerates HBM-DRAM data movement through GPU-direct loading (FlashH2D) and CPU-assisted saving (FlashD2H); (2) working-set-aware batch size control that adjusts batch sizes based on real-time working set estimation to minimize HBM cache thrashing; (3) layer-segmented prefill that bounds HBM use during prefill to a single layer, enabling efficient execution even for long prompts. Extensive experimental results demonstrate that SparseServe achieves up to 9.26x lower mean time-to-first-token (TTFT) latency and up to 3.14x higher token generation throughput compared to state-of-the-art LLM serving systems.


翻译:服务长上下文大语言模型(LLM)的成本高昂,因为注意力计算随上下文长度线性增长。动态稀疏注意力算法(DSA)通过仅关注关键令牌的键值(KV)缓存来缓解此问题。然而,采用DSA后,主要性能瓶颈从高带宽内存(HBM)带宽转移到了HBM容量:未选中令牌的KV缓存必须保留在HBM中以实现低延迟解码,这限制了并行批处理大小并阻碍了吞吐量的进一步提升。将这些未充分利用的KV缓存卸载到动态随机存取存储器(DRAM)可以释放HBM容量,从而允许更大的并行批处理规模。然而,实现这种分层的HBM-DRAM存储带来了新的挑战,包括碎片化的KV缓存访问、HBM缓存争用以及混合批处理的高HBM需求,这些在先前工作中仍未得到解决。本文提出了SparseServe,一个通过高效的分层HBM-DRAM管理来解锁DSA并行潜力的LLM服务系统。SparseServe引入了三项关键创新来解决上述挑战:(1)碎片感知的KV缓存传输,通过GPU直接加载(FlashH2D)和CPU辅助保存(FlashD2H)加速HBM-DRAM间的数据移动;(2)工作集感知的批处理大小控制,基于实时工作集估计调整批处理大小,以最小化HBM缓存抖动;(3)层分段预填充,将预填充阶段的HBM使用限制在单个层内,即使对于长提示也能实现高效执行。大量实验结果表明,与最先进的LLM服务系统相比,SparseServe实现了高达9.26倍的首令牌平均时间(TTFT)延迟降低和高达3.14倍的令牌生成吞吐量提升。

0
下载
关闭预览

相关内容

FlowQA: Grasping Flow in History for Conversational Machine Comprehension
专知会员服务
34+阅读 · 2019年10月18日
Keras François Chollet 《Deep Learning with Python 》, 386页pdf
专知会员服务
163+阅读 · 2019年10月12日
Transferring Knowledge across Learning Processes
CreateAMind
29+阅读 · 2019年5月18日
Unsupervised Learning via Meta-Learning
CreateAMind
44+阅读 · 2019年1月3日
STRCF for Visual Object Tracking
统计学习与视觉计算组
15+阅读 · 2018年5月29日
Focal Loss for Dense Object Detection
统计学习与视觉计算组
12+阅读 · 2018年3月15日
IJCAI | Cascade Dynamics Modeling with Attention-based RNN
KingsGarden
13+阅读 · 2017年7月16日
国家自然科学基金
13+阅读 · 2017年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Anomalous Instance Detection in Deep Learning: A Survey
VIP会员
相关资讯
Transferring Knowledge across Learning Processes
CreateAMind
29+阅读 · 2019年5月18日
Unsupervised Learning via Meta-Learning
CreateAMind
44+阅读 · 2019年1月3日
STRCF for Visual Object Tracking
统计学习与视觉计算组
15+阅读 · 2018年5月29日
Focal Loss for Dense Object Detection
统计学习与视觉计算组
12+阅读 · 2018年3月15日
IJCAI | Cascade Dynamics Modeling with Attention-based RNN
KingsGarden
13+阅读 · 2017年7月16日
相关基金
国家自然科学基金
13+阅读 · 2017年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员