arXiv:2412.03594cs.CLcs.AI2024-12中稿 · MLSys 2026被引 44

针对大批次推理中前缀共享问题,提出全局共享与吞吐优化批处理机制。

BatchLLM: Optimizing Large Batched LLM Inference with Global Prefix Sharing and Throughput-oriented Token Batching

  • 全局识别共享前缀,统一调度相同前缀请求以复用键值缓存
  • 通过重排序与内存感知批处理,提升GPU利用率,吞吐最高提升10.8倍
  • 适合工业级离线批量推理场景,尤其在前缀重复率高的任务中表现优异

大型语言模型(LLMs)在工业界的信息处理与管理任务中日益重要。许多任务以大批量甚至离线方式执行,性能指标为吞吐量。这类任务常具有前缀共享特性,即不同提示输入部分相同。现有LLM推理引擎侧重流式请求优化,难以高效支持具备前缀共享的大批量任务。现有方案采用基于LRU的缓存复用公共前缀的键值(KV)上下文,但可能因隐式缓存管理导致待复用的上下文被提前淘汰。此外,面向流式的设计未利用请求批次信息,无法最优混合解码令牌与预填充块,导致GPU未能充分饱和。本文提出BatchLLM,显式全局识别公共前缀,将共享相同前缀的请求协同调度以最大化复用KV上下文。通过重排序请求,优先处理解码占比高的任务,更好地混合解码与后续预填充块,并采用内存感知的令牌批处理,扩大令牌批次规模,提升GPU利用率。大量评估表明,BatchLLM在多个微基准测试和典型工业负载下,相比vLLM和SGLang,在不同硬件环境下吞吐量提升1.3×至10.8×。代码已开源:https://github.com/microsoft/MixLLM/tree/batchllm_vllm_064。

原文摘要 · Abstract (English)

Large language models (LLMs) increasingly play an important role in a wide range of information processing and management tasks in industry. Many of these tasks are performed in large batches or even offline, and the performance indicator for which is throughput. These tasks usually show the characteristic of prefix sharing, where different prompt input can partially show the common prefix. However, the existing LLM inference engines tend to optimize the streaming requests and show limitations of supporting the large batched tasks with the prefix sharing characteristic. The existing solutions use the LRU-based cache to reuse the KV context of common prefix between requests. The KV context that are about to be reused may be prematurely evicted with the implicit cache management. Besides, the streaming oriented systems do not leverage the request-batch information and can not mix the decoding tokens with the prefill chunks to the best for the batched scenarios, and thus fails to saturate the GPU. We propose BatchLLM to address the above problems. BatchLLM explicitly identifies the common prefixes globally. The requests sharing the same prefix will be scheduled together to reuse the KV context the best. BatchLLM reorders the requests and schedules the requests with larger ratio of decoding first to better mix the decoding tokens with the latter prefill chunks, and applies memory-centric token batching to enlarge the token-batch sizes, which helps to increase the GPU utilization. Extensive evaluation shows that BatchLLM outperforms vLLM and SGLang by $1.3\times$ to $10.8\times$ on a set of microbenchmarks and a typical industry workload under different hardware environments. Code is available at https://github.com/microsoft/MixLLM/tree/batchllm_vllm_064.

大模型推理批量处理前缀共享吞吐优化

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