Medha通过精细调度解决长文本推理中的响应延迟问题。
No Request Left Behind: Tackling Heterogeneity in Long-Context LLM Inference with Medha
- 采用自适应分块与流式流水线并行,实现高效预中断调度。
- 在混合负载下吞吐提升5.7倍,中位延迟降低30倍。
- 适合需要高并发、低延迟的长上下文应用场景。
部署百万词级大语言模型面临挑战,因生产负载高度异构,混合短查询与长文档。这种异构性与注意力机制的二次复杂度共同导致严重阻塞效应,使长请求拖慢短交互请求,降低系统响应性。我们提出Medha,一种服务系统,通过引入细粒度预中断调度消除此类阻塞。Medha通过协同设计的机制——包括自适应分块和流式流水线并行——克服了分块带来的效率损失与扩展难题。此外,提出新的KV缓存并行策略,降低解码延迟,保障极长上下文下的交互性。这些机制由长度感知相对松弛(LARS)调度器统一协调,该调度策略兼顾截止时间与异构性,避免阻塞与饥饿。在异构负载下,Medha相比最先进的非预中断系统,吞吐提升5.7倍,中位延迟降低30倍,99百分位延迟降低174倍。
原文摘要 · Abstract (English)
Deploying million-token Large Language Models (LLMs) is challenging because production workloads are highly heterogeneous, mixing short queries and long documents. This heterogeneity, combined with the quadratic complexity of attention, creates severe convoy effects where long-running requests stall short, interactive ones, degrading system responsiveness. We present Medha, a serving system that eliminates these convoys by introducing fine-grained, preemptive scheduling to LLM inference. Medha makes preemption practical with a co-designed set of mechanisms -- including Adaptive Chunking and Stream Pipeline Parallel that overcome the perceived inefficiencies and scaling challenges of chunking. Additionally, we present a new parallelism strategy KV-Cache Parallelism to reduce the decode latency and afford interactivity despite very long context. These mechanisms are orchestrated by a Length-Aware Relative Slack (LARS) scheduler, a deadline and heterogeneity-aware scheduling policy that prevents both the convoy effect and the starvation that plagues simpler policies. Under a heterogeneous workload, Medha improves throughput by 5.7x while reducing median and 99th percentile latency by 30x and 174x, respectively, compared to state-of-the-art non-preemptive systems.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。