RebaseKV: Hiding Prefill Latency in Multi-Agent LLMs via Optimistic Cache Alignment

Jiayu Qin, Ankith M S, Harpreet Kaur, Kevin Zhai, Sumit Negi, Changyou ChenarXiv 2026

TL;DR

In multi-agent LLM workflows, swapping out the initial "role" instruction at each agent handoff breaks standard memory caching, forcing the GPU to painfully re-read the entire shared conversation before speaking. RebaseKV hides this delay by letting the new agent immediately start drafting a few words using the previous agent’s memory cache while simultaneously building its own fresh, accurate cache in the background. Once ready, it seamlessly swaps the fresh memory underneath the conversation—cutting first-token wait times nearly in half or better, without sacrificing final accuracy.

What Problem Does This Paper Address?

Imagine a relay race of AI agents solving a math problem: an Analyst proposes a plan, a Coder writes a script, an Inspector checks it, and a Decision Maker gives the final answer. Under the hood, LLMs avoid re-reading text by saving internal attention states in a KV (Key–Value) cache. Standard inference engines rely on exact prefix caching—if a new prompt starts with the exact same text as the last one, the cache is reused.

Here’s the catch: in multi-agent setups, each agent starts with a different system prompt at the very beginning (e.g., "You are an Analyst..." vs. "You are a Python Expert..."), followed by the massive, identical shared history. Because the very beginning changes, every subsequent token shifts position and context. Exact prefix caching completely misses, forcing a compute-heavy "prefill" phase where the GPU re-processes the entire prompt before emitting the first word—ballooning the Time-To-First-Token (TTFT).

If you try to cheat by permanently reusing the previous agent’s "stale" cache anyway, the new agent suffers an identity crisis. For instance, when a Programming-Expert agent inherits an Analyst’s cache, the rate at which it actually writes code plummets from 100% down to 3%!

Methods

Instead of trying to "fix" an old cache so it works forever, the authors introduce Optimistic Cache Alignment—a training-free serving method inspired by version control (git rebase). Rather than choosing between slow accuracy and fast amnesia, RebaseKV overlaps both on a single GPU:

Figure 1: Optimistic Cache Alignment. (A) Consecutive agents share most of their prompt but differ in role prefixes, so exact prefix caching misses: recomputation blocks on prefill, and stale reuse keeps the previous role. (B) RebaseKV drafts K tokens from the inherited cache while the exact KV(sm) is built in the background, replays the draft on the fresh cache, and continues on exact KV. (C) The exact prefill leaves the first-token critical path (measured medians from Table 3).
  1. Bootstrap: An $n$-gram matcher spots shared text spans from the previous agent, reuses those cached states, and applies a quick mathematical rotation (RoPE adjustment) to account for shifted token positions.
  2. Concurrent Draft & Prefill: On a high-priority CUDA stream, the model immediately starts generating a short "optimistic" prefix ($K$ tokens, usually 3–7 words) using that temporary inherited cache. Simultaneously, on a background stream, the GPU computes the exact, fresh KV cache for the new role prompt.
  3. Replay & Continue: Once the fresh cache finishes building, the $K$ drafted tokens are replayed onto it in a single forward pass. From token $K+1$ onward, the agent generates text from a 100% exact, role-aligned state.
  4. Smart Agent Routing: Because those first $K$ tokens dictate how a response starts, agents requiring strict opening formats (like a JSON header or a single-number final answer) bypass optimistic drafting and take the exact path, while free-form reasoning agents get rebased.

Datasets

Because RebaseKV is a training-free serving optimization, no training datasets are used. The authors evaluate multi-agent pipelines across three standard public benchmarks (no new benchmarks are introduced):

  • GSM8K: Grade-school math word problems (1,319 questions; 5-agent pipeline).
  • MMLU: Multitask multiple-choice reasoning (153 questions; 6-agent pipeline).
  • HumanEval: Python code generation (161 problems; 6-agent pipeline).

Key Insights and Ideas

  • Stale caches ruin format, not reasoning: Why did an all-optimistic GSM8K pipeline initially dip slightly in accuracy? The authors discovered that when the final "Decision Maker" (meant to output a terse 7-token answer) inherited the chatty Inspector’s cache, its first few drafted words launched into a step-by-step essay. Once started, even the fresh cache faithfully continued the essay until hitting the 400-token cutoff! Routing just that single format-sensitive agent to the exact path completely erased the accuracy gap.
  • CUDA stream priority is make-or-break: Running prefill and decoding concurrently on one GPU causes resource contention. Giving the foreground draft high stream priority forces the background prefill to absorb the slowdown—dropping speedup from 2.95x down to 1.49x if omitted.
  • Errors stop at the replay boundary: Both theoretical KL-divergence bounds and empirical measurements prove that context mismatch stops accumulating the moment the replay finishes, unlike permanent stale reuse where divergence snowballs at every step.

Key Results

Tested on Qwen2.5-7B (Instruct/Coder) and Qwen3-8B across NVIDIA A100 and RTX A6000 GPUs:

Figure 2: Measured handoff timeline (medians over the rebased agents, serving-style, Qwen2.5-7B, A6000). The first token arrives 2.95x earlier; the draft window outlasts the slowed exact prefill, so there is no stall; after replay both paths have emitted about the same number of tokens, so the first-token gain comes at no end-to-end cost.
  • Massive TTFT Speedups: With real two-stream concurrency on one GPU, RebaseKV delivers the first token 2.95x faster on GSM8K with Qwen2.5-7B (46 ms vs. 135 ms) and 2.54x faster with Qwen3-8B (63 ms vs. 159 ms), with 0 ms stalls and under 1% end-to-end overhead.
  • Accuracy Parity: With the Decision Maker routed to the exact path on GSM8K, RebaseKV matches full recomputation (avg@4 of 91.8% vs. 91.8% on Qwen2.5-7B). In harness tests, it hits 73.5% on MMLU (vs. 72.9% recompute, 3.9x faster TTFT) and 81.9% on HumanEval (vs. 82.8% recompute, 2.0x faster TTFT).
  • Restored Role Adherence: Programming-Expert code emission rebounds from 3% (stale reuse) back to 98%.

Limitations and Future Work

  • Scale and Load: Concurrent single-GPU experiments were run at batch size 1 on 7B–8B parameter Qwen models. Evaluating massive models, alternative positional encodings, batched requests, and multi-tenant production traffic remains open.
  • Workflow Assumptions: RebaseKV shines when consecutive agents run the same model and share most of their prompt text; workflows with minimal text overlap or heavy tool-calling need further study.
  • Adaptive Routing: Agent routing is currently configured statically by role type; future systems could dynamically toggle routing online using the zero-cost token-agreement monitor derived in the paper.

Summary updated

BibTeX
@misc{qin2026rebasekv,
  author = {Jiayu Qin and Ankith M S and Harpreet Kaur and Kevin Zhai and Sumit Negi and Changyou Chen},
  title = {{RebaseKV: Hiding Prefill Latency in Multi-Agent LLMs via Optimistic Cache Alignment}},
  year = {2026},
  eprint = {2611.35764},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.35764},
}
Figure