arXiv:2410.03065cs.LG2024-10ICML被引 37

Cake系统并行利用计算与加载资源,显著降低长文本推理延迟。

Compute Or Load KV Cache? Why Not Both?

  • 通过双向调度动态平衡计算与加载,优化资源使用
  • 平均缩短2.6倍首令牌生成时间(TTFT)
  • 适合大规模在线服务中长上下文推理场景

大型语言模型在大规模在线服务中日益普及,但预填充阶段生成键值(KV)缓存的计算开销成为主要瓶颈,尤其在长上下文输入时更为明显。前缀缓存通过存储可复用的KV缓存减少冗余计算,但受限于存储设备的有限I/O带宽,仍存在高延迟问题。为此,我们提出Cake——一种新型的KV缓存加载系统,能够并行利用计算与I/O资源。Cake采用双向调度策略,动态平衡KV缓存的计算与加载过程,确保资源高效利用。此外,其自适应调度机制可无缝集成非前缀缓存请求,提升系统吞吐量并适应资源波动。在多种硬件配置、数据集和存储条件下进行的广泛评估显示,Cake相较于仅计算或仅加载的方法,平均将首令牌生成时间(TTFT)降低2.6倍。结果表明,Cake是优化长上下文LLM推理的有效且实用方案,弥合了大规模AI部署中计算与I/O效率之间的差距。

原文摘要 · Abstract (English)

Large Language Models (LLMs) are increasingly deployed in large-scale online services, enabling sophisticated applications. However, the computational overhead of generating key-value (KV) caches in the prefill stage presents a major bottleneck, particularly for long-context inputs. Prefix caching mitigates this issue by storing KV caches for reuse, reducing redundant computation. Despite its advantages, prefix caching suffers from high latency due to the limited I/O bandwidth of storage devices, constraining inference efficiency. To address this challenge, we introduce Cake, a novel KV cache loading system that optimally utilizes both computational and I/O resources in parallel. Cake employs a bidirectional scheduling strategy that dynamically balances KV cache computation and loading, ensuring efficient resource utilization. Additionally, Cake incorporates an adaptive scheduling mechanism that seamlessly integrates with non-prefix caching requests, improving system throughput and adapting to fluctuating resource availabilty. Through extensive evaluations across various hardware configurations, datasets, and storage conditions, Cake achieves on average 2.6x reduction in Time to First Token (TTFT) compared to compute-only and I/O-only methods. Our findings highlight Cake as an effective and practical solution for optimizing long-context LLM inference, bridging the gap between computation and I/O efficiency in large-scale AI deployments.

大模型推理缓存优化延迟降低

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。