TL;DR
Serving Large Language Models (LLMs) gets much faster when you split the workload into two specialized GPU pools: one for reading prompts ("prefill") and one for generating answers ("decode"). However, dynamically scaling these two coupled pools as live user traffic fluctuates is a tightrope walk—spin up too few GPUs and user latency spikes; spin up too many and you burn money on idle silicon. This paper introduces a reinforcement learning (RL) controller—trained safely inside a high-fidelity, physics-calibrated simulator—that learns to autoscale both pools simultaneously, slashing real-world GPU usage by up to 26% compared to heavily tuned production heuristics without missing latency targets.
What Problem Does This Paper Address?
Every LLM interaction has two distinct phases with completely different hardware appetites. First is prefill, which processes your input prompt all at once; it’s heavy on math (compute-bound) and dictates your Time-To-First-Token (TTFT). Second is decode, which spits out the response word-by-word; it’s bottlenecked by reading memory (memory-bound) and determines Time-Per-Output-Token (TPOT).
Modern serving architectures use Prefill-Decode (PD) disaggregation—separating these two phases onto dedicated GPU pools so they don't step on each other's toes. While great for hardware efficiency, this creates a tough control problem. Traffic arrives in waves, prompt lengths vary wildly, and the two GPU pools are coupled (prefill GPUs must hand off memory caches to decode GPUs).
Existing production autoscalers rely on simple rule-based thresholds (e.g., "add a GPU if queue length > 5"). Because spinning up a new GPU pod takes ~90 seconds, reacting after latency spikes is already too late. Consequently, threshold heuristics require tedious manual tuning and still chronically over-provision GPUs just to play it safe on P99 tail latencies.
Methods
Training an RL agent via trial-and-error on a live production GPU cluster is prohibitively expensive and disastrous for users. Instead, the authors build two things: a lifecycle-aware discrete-event simulator and a constrained Recurrent PPO (Proximal Policy Optimization) agent.
First, they profile single-GPU execution and network transfers on real hardware to build a fast simulator that accurately models chunked prefills, KV-cache network congestion, continuous batching, and—crucially—the full pod lifecycle (pending, ready, draining, and terminating states).
Inside this simulator, they train an Actor-Critic RL policy with several smart design choices tailored for systems control:
- Recurrent Memory & Lifecycle Awareness: Separate LSTMs ingest 58 monitoring signals, tracking short- and long-term traffic trends alongside pods currently in flight (e.g., booting up or draining). An auxiliary critic head explicitly predicts next-step pod readiness so the agent learns to anticipate incoming capacity.
- Hard Action Masks & Cooldowns: Before the agent even samples an action, illegal moves (exceeding cluster bounds) and rapid oscillations (scaling down immediately after scaling up) are masked out of the probability distribution. Feasibility is guaranteed by construction.
- SLO-Gated Reward: The reward function heavily penalizes tail-latency breaches in tiers, ensuring the agent prioritizes meeting TTFT and TPOT Service-Level Objectives (SLOs) before trying to shave down GPU occupancy costs (which bill for every non-terminated pod, including booting ones).
Datasets
Rather than introducing new benchmarks, the authors train and evaluate their system using two established, real-world LLM request traces:
- ShareGPT: An open-source corpus of multi-turn user conversations.
- Azure Conversational: Production request logs from Microsoft Azure’s conversational services.
During evaluation, requests are fed via a dynamic 20-minute Poisson arrival stream with shifting traffic phases (jumping between 1, 2, and 4 requests/second) to stress-test how controllers handle sudden bursts and drops.
Key Insights and Ideas
- "Free" GPUs aren't free during transitions: A major "aha" moment comes from the ablation studies. When the authors hid pod lifecycle states (pending/draining/terminating) from the agent's observations, pass rates collapsed from 6/6 down to 1/6. Because booting pods eat into GPU budgets for 90 seconds before serving a single token, an autoscaler must see capacity in flight to avoid panic-buying or premature scaling.
- Pre-sampling masks beat post-hoc clipping: If an RL agent asks for +4 GPUs when only +1 is available, simply clipping the action in the environment confuses credit assignment. Masking the logits before sampling was essential; without it, the agent got confused, settled at minimum capacity, and violated latency targets.
- Lightweight profiling captures cluster dynamics: You don't need full hardware emulation to train a real-world systems controller. Fitting simple polynomial latency kernels from single-GPU profiling—combined with congestion-aware KV-transfer math—reproduced real cluster P99 latencies and pod scaling timelines closely enough for zero-shot sim-to-real transfer.
Key Results
- Simulator Fidelity: Validated against a physical 6× NVIDIA RTX 4090 cluster running
Meta-Llama-3-8B-Instruct(via vLLM and AIBrix), 35 out of 36 simulated latency statistics fell within $\pm 10\%$ of physical hardware (max deviation 12.3%), and pod-scaling duration errors stayed under 3.8%. - Beating Tuned Baselines (Sim & Real): The authors gave two production autoscalers—AIBrix Pod Autoscaler (APA) and Knative Pod Autoscaler (KPA)—a generous advantage by grid-searching 64 threshold configurations per workload and picking the cheapest one that met SLOs ($\text{TTFT P99} \le 2\text{ s}$, $\text{TPOT P99} \le 50\text{ ms}$).
- In Simulation: The single learned policy met all SLOs while cutting average GPU occupancy by 12.7% (vs. APA) and 8.9% (vs. KPA) on ShareGPT, and 5.9% on Azure.
- On the Real Cluster: Deployed zero-shot onto physical GPUs, the RL policy satisfied all latency constraints while reducing average GPU usage on ShareGPT by 8.3% over APA (4.270 vs. 4.654 GPUs) and 10.3% over KPA. On Azure Conversational, it slashed GPU occupancy by 26.4% compared to APA (3.255 vs. 4.421 GPUs) while edging out KPA (3.314 GPUs) with much tighter tail latency.
Limitations and Future Work
The authors note a few clean boundaries around this study:
- Homogeneous Hardware & Single Models: The main experiments isolate the autoscaling problem using homogeneous GPU pools serving a single LLM across two public trace families. Extending this to heterogeneous GPU mixes (e.g., pairing compute-heavy GPUs for prefill with memory-heavy GPUs for decode) and multi-model routing is left for future work.
- Offline Calibration: The simulator relies on offline profiling prior to training; adapting it via online calibration in live clusters is a natural next step.
- Fixed Batching Limits: Currently, the RL agent only controls replica counts ($N_p, N_d$), leaving per-pod batching limits static. Jointly optimizing batch sizes alongside replica scaling could unlock even tighter cost-latency trade-offs.
Summary updated