# SHADOWPREFILL: Keeping Your Next Model Warm for Per-Step Model Routing in Agentic LLM Serving

DevFeed: [SHADOWPREFILL: Keeping Your Next Model Warm for Per-Step Model Routing in Agentic LLM Serving](<https://devfeed.tech/articles/shadowprefill-keeping-your-next-model-warm-for-per-step-model-routing-in-agentic-llm-serving-127799.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.13176>)

Author: Haoran Qiu, Rohan Mahapatra, Rodrigo Fonseca, Mark Russinovich

Published: 2026-11-11T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Distributed Computing](<https://devfeed.tech/sources/arxiv-distributed-computing.md>)

Topics: [LLM optimization](<https://devfeed.tech/topics/llm-optimization.md>), [Model Routing](<https://devfeed.tech/topics/model-routing.md>), [Large Language Model](<https://devfeed.tech/topics/llm.md>), [Multi-step AI processes](<https://devfeed.tech/topics/multi-step-ai-processes.md>)

Tags: [agentic](<https://devfeed.tech/tags/agentic.md>), [agentic-benchmark](<https://devfeed.tech/tags/agentic-benchmark.md>), [agentic-workloads](<https://devfeed.tech/tags/agentic-workloads.md>), [benchmark](<https://devfeed.tech/tags/benchmark.md>), [cache](<https://devfeed.tech/tags/cache.md>), [capacity](<https://devfeed.tech/tags/capacity.md>), [coding-agent](<https://devfeed.tech/tags/coding-agent.md>), [context](<https://devfeed.tech/tags/context.md>), [cost](<https://devfeed.tech/tags/cost.md>), [cs-dc](<https://devfeed.tech/tags/cs-dc.md>), [energy](<https://devfeed.tech/tags/energy.md>), [host-memory](<https://devfeed.tech/tags/host-memory.md>), [iteration](<https://devfeed.tech/tags/iteration.md>), [latency](<https://devfeed.tech/tags/latency.md>), [llm](<https://devfeed.tech/tags/llm.md>), [llm-serving](<https://devfeed.tech/tags/llm-serving.md>), [memory](<https://devfeed.tech/tags/memory.md>), [model](<https://devfeed.tech/tags/model.md>), [model-routing](<https://devfeed.tech/tags/model-routing.md>), [routing](<https://devfeed.tech/tags/routing.md>), [serving](<https://devfeed.tech/tags/serving.md>)

## AI overview

Model switches in per-step LLM routing lose prefix-cache reuse because KV caches are model-specific, lowering prefix hit rates from 80-89% on same-model calls to 44-65% after a switch and making switch calls 1.5-3.2x slower. SHADOWPREFILL uses otherwise idle capacity to prefill the session context on the unselected model, exploiting in-flight requests' SLO slack, spilling shadow KV to host memory, and reverting to a cold switch if the shadow is incomplete. In evaluations routing 24 model pairs across five agentic benchmark suites, it reduced switch-call latency by 8.5-21.4%, LLM-call latency by 3.7-17.7%, and routed token cost by 22.5-46.1%; normal traffic retained its SLO, while energy per request rose 0.4%.

## Source excerpt

arXiv:2611.13176v1 Announce Type: new Abstract: Per-step model routers send each LLM call of an agent to the cost-optimal model dynamically within each session. However, every model switch discards prefix-cache reuse: KV caches are per model, so the new model must prefill the relevant context before it emits a token. Across representative agentic workloads, including a production coding-agent trace with a mean context of 63K tokens, the prefix hit rate falls from 80-89% on same model calls to 44-65% after a switch, and a switch call takes 1.5-3.2x as long. We present SHADOWPREFILL, which prefills the session's context on the model the router has not chosen, in capacity that instances serving normal traffic leave idle, so the next switch finds its prefix cached. SHADOWPREFILL harvests the per-iteration SLO slack of requests in flight, protects routed calls, spills shadow KV to host memory, and falls back to a cold switch whenever the shadow is incomplete. With LLMRouter routing 24 model pairs over five agentic benchmark suites, SHADOWPREFILL cuts switch-call latency by 8.5-21.4%, LLM-call latency by 3.7-17.7%, and routed token cost by 22.5-46.1%, while normal traffic keeps its SLO and energy per request rises by 0.4%.