Fast Inference for Augmented Large Language Models

Rana Shahout, Cong Liang, Shiji Xin, Qianru Lao, Yong Cui, Minlan Yu, Michael Mitzenmacher

TL;DR: MARS (Memory- and API-Rooted Scheduler) is a novel inference framework designed for "augmented" LLMs that call external tools and APIs. By predicting API wait times and memory requirements upfront, MARS optimizes request scheduling to reduce end-to-end latency by up to 85% and Time-To-First-Token (TTFT) by up to 96% compared to current state-of-the-art systems.

The Challenge of Augmented LLMs

Standard Large Language Models (LLMs) are "monolithic"—they generate text based solely on internal weights. However, modern "Compound AI" systems (like ChatGPT with plugins or LangChain agents) are augmented: they pause text generation to call external APIs for web searches, calculations, or image generation.

This introduces two massive headaches for system architects:

  1. The "Size vs. Time" Paradox: In standard LLMs, more tokens usually mean more execution time. In augmented LLMs, a request with a tiny 5-token output might wait 10 seconds for a slow API response. Traditional "Shortest Job First" (SJF) scheduling breaks down here because request size no longer correlates proportionally with execution time.
  2. The Memory Waste Problem: LLMs use a "KV Cache" to store intermediate data in GPU memory. When a request is waiting for an API, that memory is either sitting idle (wasted), swapped to the CPU (slow), or discarded (requiring expensive recomputation).
First-Come-First-Serve (FCFS) scheduling often leads to Head-of-Line blocking when dealing with long API calls.

Existing systems like INFERCEPT decide how to handle this memory only when the API call is actually triggered. This "reactive" approach leads to Head-of-Line (HoL) blocking, where long-running API calls prevent shorter, simpler requests from ever starting.

Methods: The MARS Approach

To solve these inefficiencies, the authors introduce MARS, which shifts from a reactive to a proactive scheduling strategy. It operates in two main steps:

1. Predictive Strategy Assignment

Before a request even enters the queue, MARS uses a lightweight "predictor" model (specifically a fine-tuned OPT-125M) to estimate the pre-API output size and the expected duration of the API call based on the prompt. Based on these predictions, it assigns one of three memory handling strategies:

  • Preserve: Keep the KV cache in the GPU.
  • Swap: Move the cache to the CPU.
  • Discard: Free the memory and recompute later.

2. Memory-Aware Ranking

Instead of ranking by token count, MARS ranks requests by their predicted total memory footprint (the integral of memory usage over the request's lifecycle). By prioritizing requests that "waste" the least amount of memory over time, the system can pack more jobs into the GPU simultaneously.

The preferred scheduling approach (MARS) reorders requests to optimize memory usage and minimize wait times.

To ensure fairness, MARS includes a Starvation Prevention mechanism: a counter tracks how long a request has been waiting, and once it hits a threshold, the request is bumped to the front of the line.

Key Insights

  • Memory is the Real Metric: In the decoding phase of LLM inference, the system is memory-bound, not compute-bound. MARS treats memory-time (the "area under the curve" of memory usage) as the primary resource to optimize, which naturally leads to higher throughput.
  • Proactive > Reactive: The "aha moment" is that knowing a request will call a slow API allows you to schedule it after a request that will finish quickly. Waiting until the API call happens is too late to prevent a bottleneck.
  • Robustness to "Noise": Surprisingly, the system doesn't need perfect predictions. Even with simulated Gaussian errors in API duration estimates, MARS significantly outperformed baselines, suggesting that even a "rough guess" at a request's behavior is better than no guess at all.

Evaluation and Results

The researchers evaluated MARS across three distinct scenarios using datasets derived from the INFERCEPT benchmark and ToolBench (a real-world instruction-tuning dataset featuring over 16,000 APIs). Testing was performed on a range of models, including GPT-J 6B, Vicuna 13B, and Llama 70B on multi-GPU setups.

MARS was implemented on top of the popular vLLM engine and compared against both vanilla vLLM and the specialized INFERCEPT system. The results were striking:

  • Latency Reduction: MARS improved end-to-end latency by 27% to 85% over INFERCEPT.
  • TTFT Gains: It reduced Time-To-First-Token by 4% to 96%, drastically improving the "snappiness" of the user experience.
  • Throughput: In mixed workloads (API and non-API requests), MARS consistently maintained higher throughput by preventing "memory-heavy" API requests from clogging the system.

Limitations and Future Work

While highly effective, MARS has areas for future refinement:

  • Prediction Variance: MARS uses averages for API response times, but real-world APIs can be highly volatile. Future versions could use "1-bit predictors" (classifying a response simply as "short" or "long") to handle this variance more gracefully.
  • Multi-API Complexity: The current model treats multi-API requests as a sequence of segments. A more holistic approach that predicts the total number of API calls in a complex agentic loop remains a challenge.
  • Predictor Overhead: While the OPT-125M predictor is lightweight, it still adds a few milliseconds of overhead per request.

Paper Citation: Rana Shahout et al. "Fast Inference for Augmented Large Language Models." 39th Conference on Neural Information Processing Systems (NeurIPS 2025).

Summary updated

BibTeX
@inproceedings{shahout2025fast,
  author = {Rana Shahout and Cong Liang and Shiji Xin and Qianru Lao and Yong Cui and Minlan Yu and Michael Mitzenmacher},
  title = {{Fast Inference for Augmented Large Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=uNqTxj5brQ},
}
Figure