TL;DR
Optimizing Large Language Model (LLM) inference scheduling is notoriously difficult because a response's final token length is unknown until generation finishes, risking severe GPU memory overflows or under-utilization. This paper introduces $\mathcal{A}_{\min}$, an adaptive scheduling algorithm that strategically underestimates response lengths using predicted lower bounds and dynamically refines them during execution. The authors prove that $\mathcal{A}_{\min}$ achieves a highly robust, logarithmic competitive ratio and demonstrates near-optimal latency in real-world simulations—all without needing notoriously hard-to-predict upper bounds.
What Problem Does This Paper Address?
LLM inference is a multi-task, resource-intensive process split into two phases: the prefill phase (processing the input prompt) and the decode phase (generating output tokens autoregressively). While the input prompt length is known upfront, the final output length is completely unknown until the model finishes generating text.
This uncertainty creates a massive operational challenge for scheduling requests to minimize latency. GPU memory allocation relies heavily on the Key-Value (KV) cache, which grows linearly with every generated token. Traditional scheduling algorithms (like Shortest-Job-First) work beautifully if output lengths are known, but real-world machine learning predictions are imperfect.
- If a scheduler is too optimistic and underestimates memory demands, the system faces memory overflows, forcing request cancellations.
- If a scheduler is too pessimistic (like the paper's baseline algorithm $\mathcal{A}_{\max}$, which provisions memory based on the worst-case upper bound), it suffers from memory under-utilization, drastically reducing batch concurrency and spiking queue latencies.
The authors tackle this gap by designing a robust scheduling framework that handles prediction uncertainty gracefully without sacrificing hardware efficiency.
Methods
The paper frames the problem by assuming an auxiliary machine learning model provides a prediction interval $[\ell, u]$ (a min-max range) for each request's output length. They analyze two main algorithmic approaches:
- $\mathcal{A}_{\max}$ (Naive Conservative Baseline): This algorithm treats the upper bound $u$ of the prediction interval as the true length. It guarantees zero memory overflows but severely limits how many requests can be batched together when prediction intervals are wide.
- $\mathcal{A}_{\min}$ (Adaptive Robust Algorithm): Instead of playing it safe, $\mathcal{A}_{\min}$ approaches the problem from the opposite perspective using two key mechanisms:
- Strategic Underestimation & Batching: It initially assumes every request will only hit its lower bound $\ell$. It sorts requests in ascending order of these bounds and greedily packs as many requests into the batch as the KV cache limit allows.
- Ordered Eviction: If requests keep generating tokens past their estimates and threaten a memory overflow, $\mathcal{A}_{\min}$ dynamically evicts active jobs. Crucially, it evicts jobs with the smallest accumulated lower bounds first (as they are the cheapest to restart). Upon eviction, the algorithm updates that request's lower bound to the number of tokens it managed to generate, ensuring better placement in the next scheduling cycle.
The authors also introduce a specialized Promote-$\ell$ policy ($\mathcal{A}_\ell$) tailored specifically for workloads that follow extreme two-point distributions.
Datasets
- LMSYS-Chat-1M: A large-scale, real-world dataset containing crowd-sourced LLM conversations from the Vicuna demo and Chatbot Arena. The authors randomly sampled a subset of 2,000 conversations for evaluation.
- Simulation Setup: The algorithms were evaluated using the Vidur simulator, modeling the execution environment of a LLaMA2-70B model deployed on two linked NVIDIA A100 GPUs.
Key Insights and Ideas
- The Power of Asymmetric Prediction: In text generation, predicting a tight upper bound is incredibly hard because a model might unexpectedly generate a long response. Predicting a lower bound is much easier. $\mathcal{A}_{\min}$ completely discards the need for an upper bound, making it highly practical for real-world deployment.
- Eviction as Information Gain: In $\mathcal{A}_{\min}$, evicting a job isn't just wasted compute; it's a mechanism for progressive refinement. Every time a job is canceled, the system gains a certified, larger lower bound for that request, allowing the scheduler to make smarter batching decisions in subsequent iterations.
- Logarithmic vs. Quadratic Scaling: The theoretical analysis reveals that as prediction uncertainty grows, the latency overhead of the conservative $\mathcal{A}_{\max}$ blows up quadratically. In contrast, $\mathcal{A}_{\min}$ keeps the latency overhead tightly bounded to a logarithmic scale.
Key Results
- Theoretical Optimality: The authors proved that $\mathcal{A}_{\min}$ achieves an asymptotic competitive ratio of $\mathcal{O}(\log(\alpha^{-1}))$, where $\alpha = \ell/u$. They also proved that $\mathcal{A}_{\min}$ is asymptotically optimal—no algorithm lacking full future knowledge can achieve a better competitive ratio as memory capacity approaches infinity.
- Distributional Boundedness: Under specific common text-length distributions (two-point, geometric, and linearly weighted geometric), $\mathcal{A}_{\min}$ maintains uniformly bounded competitive ratios of 1.5, 1.7, and 1.56, respectively.
- Empirical Latency Reduction: In simulations with highly uncertain "rough" predictions (intervals spanning [1, 1000] tokens), $\mathcal{A}_{\min}$ achieved an average end-to-end latency that nearly matched the hindsight optimal scheduler (which has perfect future knowledge). Meanwhile, $\mathcal{A}_{\max}$ suffered from massive latency penalties due to over-provisioning memory.
Averaged Latency Performance (Rough Prediction Interval [1, 1000])
| Number of Requests | Hindsight (Optimal) | A_min (Proposed) | A_max (Conservative) |
|--------------------|---------------------|------------------|----------------------|
| 500 | ~25 | ~25 | ~100 |
| 1000 | ~35 | ~45 | ~170 |
| 2000 | ~60 | ~85 | ~340 |
Limitations and Future Work
- Homogeneous Prompt Assumptions: The theoretical proofs assume that input prompt lengths are roughly identical across requests assigned to a worker. While real-world systems often route similar prompt lengths to the same worker to achieve this, extending the proofs to highly heterogeneous prompt sizes is an open challenge.
- Strict Eviction Penalties: The current model assumes that an evicted request discards all generated tokens and restarts from scratch. In practice, modern systems utilizing smart KV-cache retention or chunked prefills might preserve partial states, which could be leveraged to make $\mathcal{A}_{\min}$ even faster.
- Single-Worker Focus: The study focuses primarily on optimizing a single computational worker node. Scaling these robust scheduling policies to distributed, multi-node cluster load balancers remains a promising direction for future research.
Summary updated