- The paper introduces a regime-aware routing algorithm that dynamically separates large, prompt-heavy, and response-heavy jobs, achieving a 996-competitive total-completion-time guarantee without knowing response lengths.
- The framework combines geometric-cap rectangle scheduling for large and prompt-heavy jobs with geometric slicing for response-heavy jobs, delivering sub-ratios of 36 and approximately 78.67, respectively.
- The results show that no single priority rule can balance memory utilization and area-order completion, while specialized routing also extends constant-competitive guarantees to makespan and online arrivals.
Problem setting and motivation
The paper studies replica-level scheduling for batched LLM inference under a hard Key-Value (KV) cache memory budget M. Each request (job) has a known prompt length si and an unknown response length oi; its memory footprint is si+ui,t+1 while active, where ui,t is the number of tokens decoded in the current uninterrupted attempt. Time proceeds in discrete decoding rounds; at each round the scheduler picks a feasible batch, and killing a job discards all accumulated KV state. The objective is total completion time against an optimal clairvoyant schedule that knows all response lengths. The model captures continuous batching and block-based cache management as deployed in modern serving stacks, and inherits from classical non-clairvoyant scheduling the crucial twist that resource demand grows during execution: uncertainty in response length is directly uncertainty in future memory demand.
Prior theoretical work had established guarantees only under restrictions—clairvoyance (2607.09248), identical prompts, or large-memory regimes (si+oi=o(M)). This paper removes all such restrictions and proves the first constant-competitive non-clairvoyant algorithm for arbitrary prompt lengths and arbitrary response lengths, with no additional assumptions.
Main result
The central theorem states that for every feasible batch instance there exists a fully non-clairvoyant algorithm whose total completion time satisfies ALG(J)=O(1)⋅OPT(J); the explicit instantiation via the routing meta-scheduler with cutoff τ=M/4 yields a competitive ratio of 996. The algorithm runs in polynomial time (an event-driven implementation has poly(n,logM) events), and the same framework gives constant-competitive guarantees for makespan and for total completion time under online arrivals.
The analysis rests on a memory-time area lower bound: defining A(s,o)=s⋅o+o(o+1)/2, the optimum is at least si0 when jobs are ordered by nondecreasing area. Two sufficient conditions follow—high memory utilization and area-order completion—and the entire algorithmic design targets these simultaneously.
Impossibility of a single priority rule
A key structural finding is that no single global priority rule achieves a constant approximation, even clairvoyantly. With job types si1 of area si2 and si3 of area si4 on budget si5: prioritizing si6 leaves memory utilization at si7 (ratio si8), while prioritizing si9 inverts the area order and blocks many small-area jobs (also ratio oi0). These two failure modes impose opposite pressures, so high utilization and area-consistent ordering cannot be reconciled by one ordering criterion. This impossibility motivates the regime decomposition that structures the whole algorithm.
Three geometric regimes
Jobs are partitioned by a prompt cutoff oi1 into:
- Large jobs (oi2): each nearly fills memory alone.
- Small prompt-heavy jobs (oi3, oi4): footprint stays within a constant factor of the prompt.
- Small response-heavy jobs (oi5, oi6): footprint grows well beyond the prompt; here oi7, so response-length order approximates area order.
Each regime admits a constant-competitive sub-scheduler in isolation, but the partition itself is unknown to a non-clairvoyant scheduler—the prompt-heavy/response-heavy distinction depends on the unobserved response length.
Rectangle strip scheduling for large and prompt-heavy jobs
For the first two regimes, memory growth is within a constant factor of the prompt length, reducing the problem to non-clairvoyant rectangle strip scheduling: fixed width oi8, unknown processing time oi9, restarts lose progress. The authors note this variant appears not to have been studied before and may be of independent interest.
The scheduler maintains attempts with geometrically increasing length caps si+ui,t+10 and area budgets si+ui,t+11, greedily admitting the minimum-budget pending attempt that fits. The analysis hinges on a queue monotonicity lemma: the minimum pending budget is nondecreasing over time, and every active attempt's budget is bounded by every pending attempt's. The proof exploits that replacement attempts have the same width as their expired predecessors, so released memory immediately accommodates them before older, larger-budget attempts can claim it. Combined with a width-range utilization bound si+ui,t+12, this yields per-job bounds si+ui,t+13 and hence a constant guarantee whenever widths lie in a bounded range. Applied with si+ui,t+14, both the large branch and the prompt-heavy branch achieve a 36-competitive ratio.
The paper is explicit that this guarantee is fragile: even a few response-heavy jobs break it, because queue monotonicity fails once effective widths grow, allowing large-area jobs to finish before small-area ones.
Geometric slicing for response-heavy jobs
For response-heavy jobs, the scheduler extends the geometric-slicing approach of prior identical-prompt work to heterogeneous prompts. Phases use doubling response caps si+ui,t+15; in phase si+ui,t+16, all jobs with si+ui,t+17 are eligible and are scheduled by the Staggered Pipeline Scheduling (SPS) subroutine using a common proxy prompt si+ui,t+18. Feasibility holds because real memory never exceeds proxy memory within a phase, and each job completes in the first phase whose cap reaches si+ui,t+19, preserving approximate area order. For ui,t0 the competitive ratio is 236/3 ≈ 78.67, proved by charging phase durations to processing and class-area lower bounds. Symmetrically, even a few prompt-heavy jobs make this scheduler's ratio unbounded, since SPS then underutilizes memory and response order diverges from area order.
Two meta-schedulers combine the branches. The black-box version assumes a known partition and round-robin time-shares sub-schedulers over doubling stages of length ui,t1, completing completed jobs as dummies; it loses at most a factor ui,t2 for ui,t3 branches. The routing version resolves the unknown partition online: small jobs start in the prompt-heavy branch, which either completes them or certifies ui,t4 upon reaching ui,t5 tokens, at which point they move to the response-heavy branch. A routing-loss lemma shows certification and completion both fit within constant factors (ui,t6 per job), because a job certified in stage ui,t7 is available to the response branch in the same stage. Combining branch guarantees (36, 36, 236/3) with the meta-scheduler overheads yields the final 996-competitive bound.
Extensions
The framework yields several complementary results. In the clairvoyant setting, a direct rectangle-packing algorithm (using Steinberg's 2-approximation strip packing as a black box) achieves a 16-approximation for general instances, improving the analogous ui,t8 bound from capacitated scheduling; area-order greedy gives ui,t9 in the large-memory regime, matching concurrent work. The same routing algorithm is constant-competitive for makespan. For online arrivals, an online variant remains si+oi=o(M)0-competitive for total completion time, with arrival delays charged against the lower bound si+oi=o(M)1. The paper notes that for flow time under adversarial arrivals, an si+oi=o(M)2 lower bound precludes constant competitiveness, making total completion time the natural latency objective here.
Limitations and open questions
Several caveats bear directly on the results. The constant factors are large—the main theorem's 996 and the response-heavy branch's ≈78.67 are far from practical—and the analysis does not attempt to tighten them. The competitive guarantee is against a clairvoyant benchmark on the offline batch model; the online result covers total completion time but not flow time, where strong lower bounds apply. The regime decomposition depends on the specific cutoff structure (si+oi=o(M)3, geometric caps with si+oi=o(M)4); whether smaller constants or alternative decompositions improve the bounds is not addressed. The systems recommendation—routing regimes to dedicated replicas—implicitly relies on three-fold resource augmentation relative to the single-replica theory, and the paper does not evaluate empirical performance on real traces or trained models. Whether the non-clairvoyant rectangle strip problem admits better constants than the black-box combination given here remains open, as does closing the gap between the clairvoyant 16-approximation and the si+oi=o(M)5 large-memory bound for general instances.
Conclusion
This paper establishes the first constant-competitive non-clairvoyant scheduling guarantee for batched LLM inference with arbitrary prompt and response lengths, via a regime-aware routing framework that decomposes jobs by memory-growth geometry, solves each regime with a specialized sub-scheduler, and routes jobs dynamically as execution reveals their class. Beyond the worst-case guarantee, the decomposition formalizes why separating global routing from local scheduling—a pattern already present in production serving stacks—is algorithmically sound: simple local rules, routed by geometric class, suffice for robust performance.