基于HCache的LLM服务中的快速状态恢复
Fast State Restoration in LLM Serving with HCache
AI总结:
针对LLM服务中KV缓存恢复存在高计算或I/O开销的问题,提出HCache方法,通过中间激活值恢复状态,并结合无气泡调度器和分块存储管理器优化,显著降低首token生成时延并减少存储开销。
摘要:
如今大语言模型(LLM)的使用场景日益复杂,例如多轮对话和检索增强生成(RAG),这使得上下文状态(即KV缓存)可在不同用户请求间复用。受GPU显存容量限制,仅有有限数量的上下文能被缓存在GPU上以供复用。现有推理系统通常会淘汰部分KV缓存,并通过从原始token重新计算或卸载到主机存储以供后续检索的方式恢复缓存,这两种方式都会带来显著的计算或I/O开销。我们提出了HCache,一种新颖的LLM状态恢复方法。其核心思路是从中间激活值恢复LLM状态,从而以低开销利用计算和I/O资源。我们通过两项技术增强HCache的性能:一是无气泡恢复调度器,它整合了资源互补的方法,以优化计算任务与IO任务之间的平衡;二是基于分块的存储管理器,用于解决布局不匹配问题(即按层优先于token的存储方式与按token优先于层的恢复方式之间的矛盾)。我们使用真实世界任务开展的评估表明,与KV卸载相比,HCache将首token生成时延(TTFT)降低了最高1.93倍,同时存储空间消耗减少了1.92-2.40倍;与token重计算相比,HCache的TTFT最高降低了5.73倍。
英文摘要:
The growing complexity of LLM usage today, e.g., multi-round conversation and retrieval-augmented generation (RAG), makes contextual states (i.e., KV cache) reusable across user requests. Given the capacity constraints of GPU memory, only a limited number of contexts can be cached on GPU for reusing. Existing inference systems typically evict part of the KV cache and restore it by recomputing it from the original tokens or offloading it to host storage for later retrieval, both of which introduce substantial computational or I/O overheads. We propose HCache, a novel LLM state restoration method. Its key idea is to restore LLM states from intermediate activations and thus utilize computational and I/O resources with low overhead. We enhance HCache with two techniques, including i) a bubble-free restoration scheduler that integrates resource-complementary methods to optimize the balance between computation and IO tasks; and ii) a chunk-based storage manager to address the layout mismatch issue (i.e., layer-before-token saving versus token-before-layer restoration). Our evaluations, conducted using real-world tasks, show that HCache reduces the TTFT by up to 1.93X compared to KV offload while consuming 1.92-2.40X less storage space; compared to token recomputation, HCache achieves up to 5.73X reduction in TTFT.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。