TL;DR
Aladdin is a cluster-level scheduler for Large Language Model (LLM) serving that jointly optimizes how requests are placed on workers and how many GPU resources are scaled up or down. By using precise performance modeling and a multi-dimensional bin-packing approach, Aladdin reduces serving costs by up to 71% while ensuring strict adherence to Service Level Objectives (SLOs).
What Problem Does This Paper Address?
Serving LLMs at scale is incredibly expensive due to their massive memory and compute requirements. While recent innovations like continuous batching (vLLM) and split-phase inference (Splitwise) have optimized performance on a single worker, cluster-level management remains a bottleneck.
Current systems often use naive scheduling algorithms like "Join the Shortest Queue" (JSQ). However, LLM requests are not created equal; they have vastly different input and output lengths. Ignoring these features leads to two major issues:
- SLO Violations: If too many requests with long outputs are sent to the same worker, the KV cache (memory used to store conversation context) can overflow, or generation latency can spike.
- Resource Underutilization: To avoid the above, providers often over-provision GPUs, leading to wasted money.
Aladdin tackles this by asking: What is the minimum number of GPUs needed to serve a stream of queries while meeting every user's latency requirements?
Methods
Aladdin introduces a co-adaptive scheduler that coordinates three main components:
- Continuous Batching Performance Modeling: The authors developed mathematical models to predict iteration-level latency and KV cache usage. They found that while the "prefill" phase (processing the initial prompt) is compute-bound, the "decode" phase (generating tokens) is memory-bound and its latency scales linearly with both batch size and total context length.
- Optimal Worker Configuration: Aladdin determines the best "rank" for tensor parallelism (e.g., how many GPUs per worker) to maximize throughput for a specific model and SLO target.
- Multi-dimensional Bin Packing: Request placement is treated as an online bin-packing problem. Aladdin uses a custom metric called
capacity_normto rank workers and a "best-fit" heuristic to assign incoming requests. This ensures that workers are packed to their limit without exceeding KV cache capacity or latency SLOs. - Prediction Error Handling: Since output lengths are predicted and can be wrong, Aladdin includes a re-balancing algorithm. It monitors ongoing requests and adjusts the placement of new arrivals to compensate for workers that were over- or under-estimated.
Datasets
The researchers evaluated Aladdin using:
- ShareGPT: A real-world dataset of user prompts and conversations used to simulate realistic request streams and input/output length distributions.
- Llama 2 Series (7B, 13B, 70B): Used as the target models for testing on high-end hardware (NVIDIA A100 and V100 GPUs).
Key Insights and Ideas
- The JSQ Trap: Naive scheduling (JSQ) is suboptimal for LLMs. As shown in Figure 3, JSQ can accidentally group requests that finish their generation at the same time, causing a massive spike in KV cache demand that exceeds hardware limits. Aladdin’s "Optimal" placement balances these demands over time.
- Phase Heterogeneity: Prefill and decoding have fundamentally different performance profiles. Prefill latency depends on the total tokens in a batch, whereas decoding latency depends on both the batch size and the average context length.
- Predictability is Power: Despite the seemingly random nature of LLM generation, the authors demonstrate that iteration-level metrics are highly predictable (with <10% error), allowing for robust mathematical optimization.
Key Results
- Massive Cost Savings: In large-scale simulations, Aladdin reduced the number of GPUs required by up to 71% compared to vanilla vLLM and by 40-50% compared to optimized baselines using JSQ.
- Improved User Experience: Aladdin significantly reduced tail latency (P99). For the Llama2-70B model, it reduced the P99 Average Token Generation Time (ATGT) by up to 40% compared to JSQ.
- High SLO Attainment: Even under high request arrival rates where baselines failed to meet SLOs, Aladdin maintained near-100% attainment by intelligently packing and scaling workers.
Limitations and Future Work
- Cold Starts and Switching Costs: The current model focuses on steady-state serving and does not account for the time or cost required to load models onto new GPUs or spin workers up/down.
- Request Migration: Aladdin does not currently support moving a request from one worker to another once it has started, which could further improve load balancing.
- Hardware Homogeneity: The study assumes a cluster of identical GPUs. Future work could explore how Aladdin handles heterogeneous clusters (e.g., a mix of A100s and H100s).
- Output Length Prediction: While Aladdin handles prediction errors well, the authors note that more advanced, low-overhead output length predictors would further boost efficiency.
Summary updated