Abstract
Large Language Model (LLM) inference is primarily constrained by GPU memory, specifically the dynamic growth of the Key-Value (KV) cache. Traditional "greedy" scheduling policies often lead to memory exhaustion and cascading evictions, significantly degrading throughput. This paper presents WAIT and Nested WAIT, two scheduling algorithms derived from a fluid dynamics framework. By maintaining the system at a load-balanced equilibrium, these algorithms prevent evictions and achieve near-optimal throughput. Evaluations on real-world datasets like LMSYS Chatbot Arena demonstrate that these methods outperform industry standards like vLLM and Sarathi.
1. Introduction: The Memory Bottleneck in LLM Inference
The primary bottleneck in LLM inference is not raw compute, but the memory required for the Key-Value (KV) cache. This cache stores intermediate data to accelerate token generation, but its footprint grows dynamically as text is generated.
When a system reaches its memory limit (an Out-of-Memory or OOM event), it must evict an active prompt, forcing it to restart later. This creates a "vicious cycle" of cascading failures: evictions provide temporary relief but increase future demand, leading to system-wide instability. Current "greedy" schedulers, such as First-Come-First-Served, fail to account for this dynamic growth, resulting in 12–25% throughput loss even when theoretical capacity is sufficient.
2. Methodology: Fluid-Guided Scheduling
To address these inefficiencies, the authors formulate inference as a multi-stage online scheduling problem using a fluid dynamics approximation. This model identifies the system's equilibrium state ($M^*$), where prompt arrivals and completions are perfectly balanced.
2.1 The WAIT and Nested WAIT Algorithms
- WAIT Algorithm: Designed for scenarios with known output lengths, WAIT uses threshold-based batching. It holds prompts in a queue until a sufficient batch size is reached to maintain the system near its fluid equilibrium.
- Nested WAIT Algorithm: For real-world applications where output lengths are unknown, Nested WAIT allows prompts to classify themselves on-the-fly. The decoding process is organized into "nested segments"; shorter prompts exit early, while longer prompts advance to later segments.
- Logarithmic Safety Buffer: To mitigate the stochastic nature of unknown lengths, a safety buffer provides high-probability protection against OOM events with minimal memory overhead.
3. Experimental Evaluation
The researchers evaluated their approach using both synthetic and real-world data:
- Synthetic Workloads: Tested algorithms under extreme demand scenarios with controlled token lengths.
- LMSYS Chatbot Arena Dataset: Utilized over 210,000 real-world prompts from Vicuna and Chatbot Arena.
- Hardware Benchmarks: Experiments were conducted on NVIDIA A100 and L20 GPUs using Llama-7B and Llama-13B models.
4. Key Results and Insights
- Superior Throughput: WAIT and Nested WAIT consistently outperformed industry-leading engines like vLLM and Sarathi on Llama-7B benchmarks.
- Stability Over Greed: Intentionally making prompts wait to form optimal batches ensures system stability, which paradoxically reduces average latency by preventing recomputation delays caused by evictions.
- Asymptotic Optimality: The algorithms mathematically approach the theoretical maximum throughput defined by the fluid model as the system scales.
- Robustness: Grouping hundreds of prompt types into just 10 segments was sufficient to capture nearly all performance gains, proving the efficiency of the segment-wise design.
5. Limitations and Future Work
While effective, the current study focuses on single-GPU setups. Future research is needed to explore the communication overheads associated with multi-GPU tensor or pipeline parallelism. Additionally, while the framework handles time-varying workloads, extremely volatile "bursty" traffic remains a challenge. Finally, integrating these algorithms with newer architectures like Multi-Head Latent Attention (MLA) could further optimize the KV cache equilibrium.
Summary updated