InferCept: Efficient Intercept Support for Augmented Large Language Model Inference

Reyna Abhyankar, Zijian He, Vikranth Srivatsa, Hao Zhang, Yiying Zhang

TL;DR

InferCept is the first LLM inference framework specifically designed to handle "augmented" LLMs—models that frequently pause to call external tools, APIs, or wait for human input. By dynamically choosing whether to discard, preserve, or swap a model's context (KV cache) during these interruptions, InferCept eliminates massive recomputation overhead. This approach boosts serving throughput by up to 2x compared to state-of-the-art systems like vLLM.

The Problem: The Cost of "Augmented" Interceptions

Modern Large Language Models (LLMs) are rarely standalone; they are increasingly augmented with external tools (like calculators or search engines) and agents (like ChatGPT plugins). However, current inference engines are designed for continuous generation and treat every external interaction as a "request termination."

When a model pauses to call a tool, the system typically discards the request's KV cache (the intermediate memory of the conversation so far). When the tool returns its result, the engine must re-initiate the request and recompute all previous tokens from scratch. The authors found that this redundant recomputation accounts for a staggering 37-40% of total model forwarding time.

Existing systems face a trilemma during these "interceptions":

  1. Discard: Saves memory but wastes compute on recomputation.
  2. Preserve: Saves compute but hogs precious GPU memory, preventing other requests from running.
  3. Swap: Moving data to CPU memory avoids recomputation and saves GPU space, but often bottlenecks the system due to limited PCIe bandwidth.
Overview of InferCept's architecture and its handling of Discard, Swap, and Preserve strategies compared to traditional inference.

Methods: A "Min-Waste" Approach

InferCept introduces a dynamic "min-waste" approach to manage these interruptions through three core technical contributions:

  • Waste-Calculation Equations: The authors developed formal equations to quantify the GPU memory waste for the Discard, Preserve, and Swap strategies. This allows the system to make mathematically grounded decisions for every request.
  • Swap Pipelining and Chunking: To make the Swap strategy viable, InferCept overlaps data movement with model computation. It breaks the context into chunks and moves them to/from the CPU in the background, ensuring the GPU never sits idle waiting for memory transfers.
  • Recomputation Chunking: When a request must be recomputed (the Discard strategy), InferCept doesn't do it all at once. It exploits the fact that LLM decoding is often memory-bound, leaving "spare" compute cycles on the GPU. It "piggybacks" small chunks of recomputation onto normal decoding steps, effectively getting the recomputation for "free" without increasing latency.
  • Dynamic Scheduling: The system uses a heuristic to estimate how long an interception will last (e.g., a fast API call vs. a slow human response) and chooses the strategy that minimizes total resource waste.

Key Insights

  • Interception Heterogeneity: Not all pauses are equal. A calculator returns in 0.2ms, while a human might take 30 seconds. A one-size-fits-all memory strategy is fundamentally inefficient.
  • The "Free" Compute Window: During the "decoding" phase of LLM inference, the GPU's compute cores are often underutilized because the bottleneck is memory bandwidth. InferCept cleverly uses this idle "compute headroom" to re-process old tokens.
  • Predictive Estimation: Since the system doesn't know exactly when a tool or human will respond, it uses a dynamic estimation ($T_{INT} = t_{now} - t_{call}$). The longer a request has been paused, the more likely the system is to swap it out to save space.

Key Results

InferCept was tested against vLLM using GPT-J (6B), Vicuna (13B), and Llama-3 (70B) models on NVIDIA A100 GPUs across six diverse augmentation types (Math, QA, Virtual Environments, Chatbots, Image Generation, and TTS).

Performance comparison showing normalized latency, throughput, and time to first token across various model sizes (6B, 13B, 70B).
  • Throughput: Achieved 1.6x to 2x higher throughput than vLLM under the same latency constraints.
  • Efficiency: Completed 2x more requests per second.
  • Waste Reduction: Eliminated over 60% of GPU waste caused by recomputation and 96% of waste caused by inefficient swapping.
  • Scalability: The benefits became even more pronounced as model size increased (e.g., the 70B model), as the cost of recomputing large KV caches is significantly higher.

Limitations and Future Work

  • Interception Prediction: The current system uses a simple time-elapsed heuristic. Using more sophisticated machine learning models to predict tool/human response times could further optimize scheduling.
  • Scheduling Policies: The evaluation primarily used First-Come-First-Served (FCFS). Integrating more complex policies like Multi-Level Feedback Queues (MLFQ) remains an open area for exploration.
  • Integration: While built on vLLM, the modular nature of InferCept means it could potentially be integrated into other frameworks like TensorRT-LLM or DeepSpeed-Inference.

Summary updated

BibTeX
@inproceedings{abhyankar2024infercept,
  author = {Reyna Abhyankar and Zijian He and Vikranth Srivatsa and Hao Zhang and Yiying Zhang},
  title = {{InferCept: Efficient Intercept Support for Augmented Large Language Model Inference}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=wDDGQabYPQ},
}
Figure