Why this matters to Windows and developer readers
GitHub Copilot's agent mode runs in Visual Studio Code and Visual Studio on a lot of Windows machines. It also sits behind many enterprise developer subscriptions. Anyone who has watched an agent bounce between models after an error or rate limit has paid this cost, whether or not they noticed.
The same logic applies if your team runs a gateway or proxy in front of several model providers. That includes enterprise setups built on Azure and Foundry.
What the Copilot study found
Microsoft Research and UIUC authors Banruo Liu, Haoran Qiu, Íñigo Goiri, Rodrigo Fonseca, Ricardo Bianchini and Esha Choukse analysed sampled GitHub Copilot traces from June 2026, comprising 3.2M users, 13M sessions, 761M LLM calls, and 95T tokens. They describe it as the first production-scale look at this kind of workload.
The headline cache findings:
- KV cache hit rates average 90% within a turn, but fall to 55% across turn boundaries. The cache is also drastically invalidated by events such as model switches or context compaction.
- A table in the paper's full text reports only 8% cached after a model switch. It also says same-model boundaries cause a 26% average drop, while model-switch boundaries cause near-complete invalidation (a 67% drop).
- Secondary write-ups of the paper say model switches affect 6.4% of sessions and often follow errors. I only have those summaries for the 6.4% and error-trigger figures, so treat them as reported rather than confirmed from the paper itself.
- The paper's recommendation is that since each model switch effectively cold-starts the cache, pinning sessions to a single model would preserve cache continuity.
Context compaction, where an agent rewrites its history to fit the window, has a similar effect. One summary of the paper says it shares little prefix with what came before, so the cache resets as thoroughly as it would on a model switch.
These are sampled Copilot traces. They don't prove every agent, provider or cache implementation behaves the same way.
The mechanism, briefly
An agent sends the whole growing transcript on every call. That transcript includes the system prompt, tool definitions, earlier messages and tool results. Prefix caching lets the server skip recomputing a prefix it has already processed. vLLM's documentation explains that each KV block is identified by the tokens inside it plus the tokens before it. The cache therefore depends on an exact prefix match.
A different model has different weights, so it can't use another model's cached state. It starts cold. Cache behaviour also varies by provider. Anthropic's documentation, for example, says the default cache lifetime is five minutes. That means a long pause can make even a same-model request cold.
The author's experiments: attributed, not independently verified
The Towards Data Science author replayed one scripted 20-turn session through a local vLLM server with prefix caching enabled. The session had a roughly 1,000-token system prompt and about 475 tokens added per turn. It was tested under three policies: sticky (one model throughout), alternating, and phase-boundary switching.
Two "models" were simulated by changing the opening tag of the system prompt. That isolates the caches exactly, but it is not a test across two real architectures or providers. The test model was only 0.9B parameters, so the latency figures are not representative of hosted frontier models.
The reported results:
| Policy | Tokens recomputed | Cache-hit rate |
|---|---|---|
| Sticky | 10,191 | 90.9% |
| Phase (2 switches) | 17,455 | 84.4% |
| Alternate (19 switches) | 19,855 | 82.2% |
- Single-switch cost: at turn 8, the incoming model had zero cached tokens and recomputed 4,395. At turn 9 it was warm again.
- Latency: at around 12,000 tokens, time to first token was 287 ms cold versus 60–95 ms warm.
- Priced input cost: the author priced the measured token flows with Claude rates they cite. The reported cost vs. the cache-aware frontier baseline:
- Cache-blind frontier: 4.88×.
- Alternating: 0.87×, a 13% saving against about 40% expected from the price gap.
- Phase routing: 0.71×, a 29% saving.
- Efficient model sticky: 0.20×.
- Live quality test: 30 self-authored Python tasks with hidden tests.
- Sticky Opus 5 passed 30 of 30. Sticky Haiku 4.5 passed 29 of 30. Phase routing passed 30 of 30.
- Only two tasks escalated, so this is thin evidence of quality parity, as the author admits.
- On the first escalation, 10,963 tokens were reprocessed with no cache hits.
Check the pricing before you reuse the numbers
The author's dollar figures use rates that appear to be a snapshot. Anthropic's current pricing page lists a range of models with different cache multipliers. Cache hits are 0.1× the base input price for most models, but 0.05× for Opus 5.5 and Sonnet 5.5 and 0.025× for Fable 5.1 and Mythos 5.1. It also lists a one-hour cache write option at 2× base. Your own ratio of cache read to write cost will change the size of the switch penalty, so recompute with the rates you actually pay.
What this means in practice
This is analysis on my part, drawn from the sources above and general industry reasoning:
- Default to sticky sessions. Per-request alternation pays the catch-up cost continuously.
- Switch at real boundaries. Planning versus implementation, or repeated failing tests, are better triggers than how hard a single prompt looks.
- Estimate before switching. The cost is roughly the uncached tokens times the input price. It is much larger late in a long session.
- Consider a fresh subagent or a clean handoff. A stronger model can work on a small summarised context while the parent session's cache stays warm. This is a design option, not a guarantee.
- Gateways still fit stateless traffic. Classification, one-shot extraction and independent queries have no accumulated context to lose.
- Validate quality yourself. The cost effect is measurable. The quality trade-off depends on your workload.
Caveats
Serving systems can keep caches warm across replicas and across idle time. One research approach, DroidSpeak, can share KV state between fine-tuned variants of the same base model. None of these carry a warm session between unrelated model families. The practical answer is to avoid unnecessary switches and to plan the necessary ones.
The numbers differ in how far you can trust them. The Copilot figures come from production telemetry published by Microsoft Research. The routing savings come from a small controlled experiment with modelled pricing. The point that holds across both is that routing is a state decision as well as a price decision.
References
- The Hidden Cost of LLM Routing: Why Switching Models Costs More Towards Data Science · 2026-10-20T12:30:00+00:00
- Prompt caching docs.anthropic.com
- 87% Agent, 13% Human: What 13.5M GitHub Copilot Sessions Reveal About Running Coding Agents at Scale codex.danielvaughan.com