Efficient Interactive LLM Serving with Proxy Model-based Sequence Length Prediction

Haoran Qiu, Weichao Mao, Archit Patke, Shengkun Cui, Saurabh Jha, Chen Wang, Hubertus Franke, Zbigniew T. Kalbarczyk, Tamer Basar, Ravishankar K. IyerarXiv 2024 · DOI

Abstract

Serving Large Language Models (LLMs) efficiently is a significant challenge due to the non-deterministic execution time inherent in autoregressive generation. Standard First-Come-First-Serve (FCFS) scheduling often suffers from head-of-line blocking, where long-running requests delay shorter, interactive ones. We introduce Speculative Shortest-Job-First (SSJF), a scheduling framework that employs a lightweight proxy model to predict the output length of incoming requests. By prioritizing shorter tasks based on these predictions, SSJF achieves up to a 40% reduction in average job completion time and a 3.6x increase in system throughput.

Introduction

The primary bottleneck in current LLM serving infrastructures is the autoregressive nature of token generation. Because LLMs generate text token-by-token, the final execution time of a request is unknown until the "end-of-sequence" token is produced. This uncertainty makes efficient scheduling difficult. Most state-of-the-art serving systems, such as vLLM or Orca, default to a First-Come-First-Serve (FCFS) policy.

FCFS leads to a classic "head-of-line blocking" problem: a massive request, such as a request to summarize a long document, can occupy the front of the queue, forcing dozens of quick, interactive requests (e.g., simple chat queries) to wait. In interactive applications, this translates to frustratingly high latency for users who expect near-instantaneous responses.

Speculative Shortest-Job-First (SSJF)

To address these inefficiencies, we propose the SSJF scheduler. SSJF shifts from FCFS to a Shortest-Job-First (SJF) paradigm, a well-known scheduling algorithm that minimizes average wait time. Since the true job length is unknown a priori in the context of LLMs, the system "speculates" on the length using a secondary, lightweight proxy model.

System Architecture

The SSJF framework integrates a proxy model between the request pool and the GPU execution cluster. When a request arrives, it is first processed by the predictor to estimate its output length. The scheduler then reorders the request queue to prioritize those with the shortest predicted lengths. This design is specifically engineered to be "plug-and-play," working seamlessly with modern serving techniques like continuous batching—where new requests can join a running batch as soon as an old one finishes—without requiring complex changes to memory management or KV-cache handling.

The SSJF system architecture illustrates the integration of the proxy model and the speculative scheduler within the LLM serving pipeline.

Proxy Model for Length Prediction

The core of the speculation is a fine-tuned BERT-base model. This proxy model analyzes the input prompt to predict the number of output tokens. We explored two primary architectures for this predictor:

  1. Regression: Predicting a continuous value for the number of tokens.
  2. Multi-class Classification: Categorizing requests into discrete length buckets.

Empirical results showed that a regression model trained with L1 loss provides the most effective balance of accuracy and scheduling utility. The system also supports multi-round conversations by concatenating dialogue history (up to the 512-token limit of BERT), ensuring prediction accuracy remains high throughout extended interactions.

The single-query prediction architecture uses a BERT-base model to extract semantic features from the input query, followed by a predictor head for regression or classification.

Evaluation and Results

We evaluated SSJF using the LMSYS-Chat-1M dataset, which contains one million real-world conversations with 25 different state-of-the-art LLMs. This provided a diverse set of queries to train and test the proxy model. Additionally, we used Microsoft Azure Function Traces to simulate realistic, "bursty" request arrival patterns typical of production environments. The system was tested across a variety of models, including OPT (1.3b to 2.7b), GPT2, CodeGen, Bloom, and Switch Transformers.

Key Performance Metrics

  • Latency Reduction: SSJF reduced average Job Completion Time (JCT) by 30.5% to 39.6% compared to FCFS across various batching settings.
  • Throughput Gains: The system demonstrated a 2.2x to 3.6x increase in throughput. By clearing out short jobs quickly, the system keeps the GPUs busy more effectively and reduces the overall time requests spend in the queue.
  • Low Overhead: The BERT-base predictor is highly efficient, adding negligible latency that averages only 7.6 ms per request—less than 0.02% of the typical LLM execution time.

Discussion and Key Insights

A significant finding of this work is that verbosity is highly predictable from the input query alone. A tiny model like BERT-base can effectively predict the verbosity of a much larger model (like a 13B Llama) just by looking at the input query. Furthermore, we found that imperfect predictions are sufficient; even with a classification accuracy of approximately 61.5%, the relative ordering of requests provided by the proxy model is enough to significantly outperform FCFS.

Limitations and Future Work

While SSJF offers substantial improvements, it faces the standard challenges of SJF algorithms, such as potential request starvation. A very long request could theoretically stay at the back of the line indefinitely if new short requests keep arriving. Future work will explore "aging" mechanisms to increase a job's priority over time. Additionally, we are investigating preemption strategies—pausing a long job to let a new, shorter one through—and the use of semantic caching to bypass the predictor for frequent, identical requests.

Summary updated

BibTeX
@misc{qiu2024efficient,
  author = {Haoran Qiu and Weichao Mao and Archit Patke and Shengkun Cui and Saurabh Jha and Chen Wang and Hubertus Franke and Zbigniew T. Kalbarczyk and Tamer Basar and Ravishankar K. Iyer},
  title = {{Efficient Interactive LLM Serving with Proxy Model-based Sequence Length Prediction}},
  year = {2024},
  eprint = {2404.08509},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2404.08509},
}
Figure