TL;DR
This paper introduces FastServe, a novel distributed inference serving system for Large Language Models (LLMs) that significantly reduces latency. By exploiting LLMs' autoregressive nature, FastServe enables preemptive scheduling at the token level, overcoming the head-of-line blocking issue prevalent in existing systems. This, combined with efficient GPU memory management, leads to substantial improvements in throughput and latency.
What Problem Does This Paper Address?
Interactive AI applications powered by Large Language Models (LLMs), like ChatGPT, demand very low latency for a smooth user experience. Current LLM serving systems typically process inference jobs sequentially until completion (run-to-completion). This approach suffers from "head-of-line blocking," where a long-running job can significantly delay shorter jobs that arrive later, leading to high overall latency, especially in real-world workloads with varying job lengths. Existing solutions, while improving efficiency, often still rely on first-come-first-served (FCFS) scheduling, failing to adequately address this latency challenge.
Methods
FastServe introduces two key innovations:
- Skip-Join Multi-Level Feedback Queue (MLFQ) Scheduler: This scheduler addresses head-of-line blocking by enabling preemptive scheduling at the granularity of each output token. Unlike traditional MLFQ, FastServe's scheduler uses information about the job's initial token generation time (which is predictable based on input length) to intelligently assign incoming jobs to an appropriate priority queue, skipping higher-priority queues if unnecessary. This reduces demotions and improves scheduling efficiency. It also incorporates a starvation prevention mechanism to ensure long jobs are eventually processed.
- Proactive Key-Value Cache Management: Preemptive scheduling requires storing intermediate states (key-value caches) for multiple jobs simultaneously, which can quickly exhaust limited GPU memory. FastServe tackles this by proactively offloading these intermediate states from GPU memory to host memory when GPU memory is scarce and uploading them back when needed. This swapping is designed to overlap with computation, minimizing its impact on latency.
Datasets
The paper uses real-world LLM inference workloads derived from:
- ShareGPT: A dataset of user-shared conversations with ChatGPT.
- Alpaca: A dataset generated by GPT-3.5 with self-instruct.
The arrival times for requests are generated following a Poisson process, parameterized by the arrival rate, to simulate realistic traffic patterns.
Key Insights and Ideas
- Head-of-line blocking is a major bottleneck: The paper quantifies how much of the total latency in LLM inference is due to queuing delays, highlighting the critical need to address this.
- LLM inference is "semi information-agnostic": While the total number of output tokens (and thus iterations) is unknown, the execution time for the first token generation is predictable based on input length. This predictability is key to the skip-join MLFQ scheduler.
- GPU memory is a critical constraint for preemption: The need to store intermediate states for preempted jobs significantly increases memory pressure, necessitating sophisticated memory management.
- Proactive swapping is crucial for performance: Simply swapping key-value caches reactively introduces significant overhead. Overlapping swapping with computation is essential to maintain low latency.
Key Results
FastServe demonstrates significant performance improvements:
- Throughput: Up to 31.4x improvement in throughput compared to vLLM under the same average latency requirements.
- Latency: Up to 17.9x improvement in throughput under the same tail latency requirements compared to vLLM.
- End-to-End Performance: Outperforms vLLM by 2.3-18.3x in terms of throughput due to reduced queuing delay.
- Tail Latency: Significantly improves tail latency, with FastServe achieving up to 17.9x and 59.8x performance improvement compared to vLLM and FasterTransformer, respectively, for OPT-175B.
- Goodput: Consistently achieves the highest P95 goodput across different SLOs, outperforming vLLM by 4.1x to 4.7x.
Limitations and Future Work
- GPU Memory Overhead: While FastServe's proactive swapping mechanism is effective, the inherent memory demands of LLMs and their intermediate states remain a challenge, especially for extremely large models.
- Starvation Prevention Tuning: The effectiveness of the starvation prevention mechanism relies on tuning parameters like the SLO, which may require careful configuration for different workloads.
The paper implicitly suggests that further research into more efficient memory compression techniques for key-value caches, or novel hardware architectures optimized for LLM serving, could further enhance performance. The focus on distributed serving also opens avenues for scaling to even larger models and higher throughput demands.
Summary updated