TL;DR
When multiple users run complex LLM agents on shared GPUs, existing schedulers force an awkward choice: either optimize for speed and starve heavy users, or split resources evenly at every millisecond and make everyone wait longer. Justitia resolves this by introducing "selective pampering"—giving one agent the entire GPU at a time, ordered by when they would have finished under a strict fair-share system. The result is a massive speedup in average completion time without unfairly delaying anyone.
What Problem Does This Paper Address?
Modern LLM workloads aren't just single prompts anymore; they are often task-parallel LLM agents—swarms of parallel inference requests summarizing chunks of a massive book, verifying facts, or exploring different math reasoning paths simultaneously. Crucially, the user doesn't get their final answer until all parallel branches finish.
When serving these agents on shared GPUs, schedulers hit a classic tug-of-war between efficiency (low average completion time) and fairness (protecting users from noisy neighbors):
- First-Come-First-Serve (FCFS) (used in vLLM and Parrot) suffers from head-of-line blocking—one giant agent stalls everyone behind it.
- Shortest-Job-First (SJF) is great for average speed, but a steady stream of small jobs can starve a large job indefinitely.
- Instantaneous Fair-Sharing (like Virtual Token Counter, or VTC) splits GPU resources equally at every moment. While "fair," forcing parallel agents to run at a fraction of GPU capacity drags out their end-to-end completion times.
Methods
The authors build Justitia atop vLLM using three core components—combining a classic networking algorithm with new LLM-specific modeling:
- Memory-Centric Cost Modeling (New): Previous fair schedulers measured cost by counting compute tokens linearly. However, in concurrent LLM serving, KV-cache memory—not compute—is the true bottleneck. Because an LLM's memory footprint grows with every generated token, Justitia models an inference's cost as KV token-time (space $\times$ time). For a prompt of length $p$ and output length $d$, the cost scales quadratically: $pd + \frac{d^2}{2}$.
- Lightweight MLP Cost Prediction (New): Because output length $d$ isn't known ahead of time, Justitia predicts an agent's total KV token-time upon arrival. Instead of using slow, parameter-heavy transformers like DistilBERT, it uses TF-IDF vectorization fed into a tiny, 4-layer Multi-Layer Perceptron (MLP) trained specifically for each agent type (requiring just 100 samples).
- Virtual-Time Fair Queuing (Adapted): To decide which agent to "pamper" with full GPU access, Justitia adapts Generalized Processor Sharing (GPS) from classic network packet scheduling. Using a mathematical clock called virtual time, Justitia calculates in one shot at arrival time the exact order in which agents would finish under an idealized, infinitely divisible fair-share system. It then serves agents sequentially in that priority order (without preempting already-running inferences, keeping the system work-conserving).
Datasets
- Workload Suite: The authors constructed a mixed benchmark of 300 LLM agents spanning 9 agent classes (including summarization, document merging, fact verification, reasoning, and coding), reusing example prompts from their original repositories. Agents are sampled by duration: 72% small (<1 min), 26% medium (1–10 mins), and 2% large (>10 mins).
- Arrival Traces: Request arrival timestamps are driven by real-world production traces released by Mooncake, scaled to $1\times$, $2\times$, and $3\times$ workload intensities.
Key Insights and Ideas
- Long-term fairness beats instantaneous fairness: Users don't actually care if they get exactly 50% of the GPU every millisecond; they care about when their job finishes. If two identical 3-minute jobs share a GPU 50/50, both finish at minute 6 (average: 6 mins). If you "pamper" one first and run the second right after, they finish at minute 3 and minute 6—dropping the average completion time to 4.5 minutes while delaying neither job past its fair-share finish time!
- LLM serving cost is quadratic in output length: Treating input and output tokens as simple linear weights misses how GPUs actually choke. Because KV-cache blocks sit in memory across every decoding iteration, generating $d$ tokens occupies memory cumulatively, creating a $\frac{d^2}{2}$ cost curve.
- Agent-specific MLPs crush one-size-fits-all LMs for cost prediction: Because a specific agent workflow (e.g., Fact Verification) has relatively stable structural demands, a tiny dedicated MLP trained in ~1 minute predicts resource cost far more accurately—and $25\times$ faster—than a 66M-parameter DistilBERT model trained across heterogeneous tasks.
Key Results
Evaluated across LLaMA-7B (A100), LLaMA-13B (4$\times$V100), and Qwen2.5-32B (H800):
- Massive Speedups: Justitia reduces average Job Completion Time (JCT) by 57.5% compared to VTC (state-of-the-art fair scheduler) and 61.1% compared to Parrot (agent-level FCFS), nearly matching the raw efficiency of Shortest-Remaining-Job-First (SRJF).
- Preserved Fairness & Zero Starvation: 92% of agents finish faster or equal to their VTC fair-share time. For the 8% delayed, the average delay is under 10% (worst-case 26%). In micro-benchmarks flooded with 500 small "mice" jobs, SRJF starved a large "elephant" job to over 800 seconds, while Justitia strictly bounded its delay.
- Ablations & Overhead: Swapping Justitia's quadratic memory model back to a linear compute model degraded JCT by up to 42.3%. Furthermore, the MLP predictor takes just 2.16 ms per agent (with 53% relative error vs. DistilBERT's 452% error and 55.7 ms latency), keeping total scheduling overhead under 10 ms.
Limitations and Future Work
While the authors do not include a dedicated section proposing future research directions, two practical boundaries are apparent from their design and experiments:
- Per-Agent Profiling: The MLP demand predictor relies on knowing the agent type in advance as prior knowledge and training a dedicated model per agent type (using ~100 samples), rather than generalizing zero-shot to arbitrary, unseen agent architectures.
- Extreme Prediction Errors: While Justitia is robust to $3\times$ cost prediction errors (only a 9.5% JCT hit), injecting $4\times$ random scaling errors caused a noticeable jump in JCT by reversing the execution order of agent types that have a $10\times$ true cost disparity.
Summary updated