一句话:提出 FlashGen,用多级 KV cache 与请求重排序消除多轮对话中的 KV 重算和队头阻塞,大幅提升 LLM 服务吞吐。
论文指出现有 LLM 服务框架在处理用户与助手多轮对话时存在两点不足:一是必须为理解多轮上下文而重复计算注意力的 key/value(KV),带来可观的算力开销;二是随着轮次累积提示变长,先来先服务(FCFS)调度常引发队头阻塞,使 GPU 资源利用不足。为此作者提出 FlashGen,构建由 GPU、CPU、SSD 组成的多级 KV cache,保留历史轮次的注意力 KV,并通过低成本缓存恢复技术替代重计算;同时提出请求重排序调度,在不损害公平性的前提下调整请求执行顺序以更好利用 GPU 显存。在 ShareGPT 数据集上,对 OPT 30B 与 Llama-2 70B,FlashGen 在延迟相近的前提下相比 vLLM 分别取得 1.63 倍与 2.85 倍的吞吐提升。
Although there have been significant efforts to make LLM serving efficient, we observe two limitations of current state-of-the-art serving frameworks in handling multi-turn dialogues between users and assistants, particularly in chat scenarios. First, existing LLM frameworks incur substantial computational overhead in recomputing attention keys and values (KVs) for understanding context across multiple turns of user queries. Second, as the prompt length of user queries is amplified due to multi-turns, a first-come-first-served (FCFS) scheduling policy often causes head-of-line blocking issues, leading to underutilization of GPU resources. To address these limitations, we present FlashGen to rapidly complete multi-turn queries by efficiently utilizing the compute and memory resources of GPUs as well as the host hardware (e.g., DRAM and SSD). We introduce a multi-level KV cache comprised of GPU, CPU, and SSD, to efficiently retain attention KVs from prior turns. Our approach employs low-cost cache restoration techniques to avoid the recomputation burden. Further, we propose a request reordering technique to effectively utilize GPU memory. This scheduling technique carefully adjusts the request order without compromising fairness. Our proposed techniques outperform the vLLM framework in terms of both latency and throughput. For OPT 30B and Llama-2 70B models with the ShareGPT dataset, we achieve 1.63x and 2.85x better throughput, respectively while in a similar latency boundary.