DON’T STOP ME NOW: EMBEDDING BASED SCHEDULING FOR LLMS

Rana Shahout, eran malach, Chunwei Liu, Weifan Jiang, Minlan Yu, Michael Mitzenmacher

Efficient scheduling is the backbone of interactive Large Language Model (LLM) applications, where low request completion time directly dictates user engagement. Yet, most current serving systems—such as vLLM or Orca—rely on a rudimentary First-Come, First-Served (FCFS) scheduling policy. This creates a classic computing bottleneck: head-of-line blocking. Imagine standing in line at a cafe behind someone ordering fifty complex lattes when you just want a single black coffee. In LLM terms, a massive document summarization request blocks a tiny "Hello!" query, ruining the user experience for the latter.

The theoretical solution to this is Shortest Remaining Process Time (SRPT) scheduling, which prioritizes the shortest jobs. However, applying SRPT to LLMs presents two unique hurdles:

  1. Unknown Lengths: We do not know how many tokens an LLM will generate until it actually finishes. Predicting this from the input prompt alone is notoriously inaccurate and resource-intensive.
  2. Memory Overhead: To pause (preempt) a running request and start another, the system must store the KV Cache (the model's "memory" of that specific conversation). If the system preempts too many long requests, the GPU runs out of memory, causing crashes or severe slowdowns.

To tackle these challenges, researchers have proposed TRAIL (Token Response and Embedding Adaptive Inference Layer), a system that significantly boosts LLM serving efficiency by "recycling" internal model embeddings to predict output lengths in real-time.

The TRAIL Approach: Recycling Embeddings

TRAIL overcomes the unknown length and memory overhead hurdles through two primary innovations: embedding recycling and a novel limited preemption policy.

TRAIL System Architecture
  • Embedding Recycling & Probing: Instead of relying on a separate, heavy model to guess the output length from the prompt, TRAIL recycles the internal hidden states (embeddings) from the target LLM itself. As the model generates each token, a tiny, lightweight Multi-Layer Perceptron (MLP) "probes" these intermediate embeddings to refine its prediction of how many tokens remain. Because predictions can fluctuate, TRAIL uses Bayesian inference to smooth the estimates over time, ensuring the scheduler isn't constantly switching tasks due to noisy signals.
  • SRPT with Limited Preemption: To solve the KV cache memory issue, TRAIL introduces a prediction-based SRPT variant that allows preemption only during the early stages of a request. Once a request has been processed past a certain threshold (determined by a tunable constant $c$), it becomes "non-preemptable." This ensures the system doesn't waste precious GPU memory holding onto the massive KV caches of nearly-finished requests.

Key Insights and Performance Gains

The researchers evaluated TRAIL primarily on Llama3-8b-instruct using the Alpaca dataset (52,000 instructions simulating diverse user interactions), with additional validation on Vicuna 13B and Ministral-3b-instruct.

One of the most striking insights from the study is that the LLM "knows" its future. The model's internal layers provide a vastly superior signal for output length than the input prompt alone. Furthermore, not all layers are equal: the authors discovered a "sweet spot" in the intermediate layers (e.g., layers 10-15 in a 32-layer model) that are the most informative for length prediction. Earlier layers are too focused on the input, while later layers are too focused on the immediate next token.

Prediction Error Comparison

By leveraging these intermediate layers, TRAIL achieves remarkable performance improvements:

  • Superior Prediction Accuracy: TRAIL’s embedding-based predictions achieved a 2.66x lower Mean Absolute Error (MAE) compared to standard BERT-based prompt-only predictions.
  • Massive Latency Reductions: On the Alpaca dataset, TRAIL achieved 1.66x to 2.01x lower mean latency than standard FCFS systems.
  • Instant Responses: The Time to First Token (TTFT)—a critical metric for perceived "snappiness"—improved by a staggering 1.76x to 24.07x.
  • Negligible Overhead: The prediction MLP is tiny (roughly 2.1 million parameters) compared to an 8-billion parameter LLM, adding only about 0.03% to the total computational cost per token.

Limitations and Future Work

While TRAIL represents a significant leap forward in LLM serving, the authors note several areas for future growth. Currently, the optimal layer for probing is found through manual profiling; automating this selection or using a weighted average of multiple layers could improve system robustness. Additionally, while the current study focused heavily on the Alpaca dataset, future work must explore how these internal signals adapt across different domains like coding, creative writing, or mathematics. Finally, to handle "data drift" as user prompts evolve over time, the system may eventually require mechanisms to dynamically retrain the lightweight linear classifier on the fly.

Summary updated

BibTeX
@inproceedings{shahout2025dont,
  author = {Rana Shahout and eran malach and Chunwei Liu and Weifan Jiang and Minlan Yu and Michael Mitzenmacher},
  title = {{DON’T STOP ME NOW: EMBEDDING BASED SCHEDULING FOR LLMS}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=7JhGdZvW4T},
}
Figure