THR862 · Theater

Prompt caching at scale: Build faster, more efficient AI applications

  • Friday 20 November
  • 24 min
  • Catalogue level: (200) Intermediate
  • Our depth rating: 300
  • Worth watching: 2/3

Speakers: Saloni Sonpal, Taylor Wrobel

Watch on Microsoft’s site from 02:33

Microsoft’s player cannot open a video at a given time: once it plays, skip to the time shown.

What the session covers

Saloni Sonpal (Microsoft Foundry) and Taylor Wrobel (GitHub) explain how prompt caching of the prefill (KV) phase cuts cost and latency and increases throughput for Azure OpenAI workloads. GitHub Copilot raised its average cache hit rate to over 90%, and users now pay 68% less for the same requests than in June; Meta reaches about 98% and ByteDance about 90%. Saloni describes platform changes in Foundry: smart affinity routing, load-aware balancing, an internal cache advisor and a tiered KV cache that offloads to CPU memory and SSD. The session covers the caching modes (implicit, extended for 24 h, explicit with breakpoints, configurable TTL) and best practices such as a stable prefix, prompt cache keys and the cost of cache writes versus reads.

Best for: Developers and architects who build agentic or long-context applications on Azure OpenAI in Microsoft Foundry and want to tune cost and latency through caching.

Session timeline by chapter

New material starts at 02:33. The intro on prefill vs. decode and cached-token pricing ends at 02:33, where GitHub's production data on cache hit rates, latency and the 68% cost reduction begins.

Where to skip: Start at 02:33 for GitHub's numbers. The core is 11:55–21:27: Foundry platform internals, the caching modes and the best practices, including breakpoints and read/write pricing. 21:27 adds how GitHub tunes caching across workloads. You can skip the ByteDance/Meta part (07:43), the general part on why KV caching is hard (09:36) and the closing.

Chapters (9)

  1. 00:00 Recap Depth 200 · Novelty 0/3

    Introduction: prefill vs. decode and the economics of prompt caching

    Saloni Sonpal (Microsoft Foundry) and Taylor Wrobel (GitHub) present prompt caching as a way to improve speed, throughput and cost together instead of trading them off. Saloni explains the prefill phase, which computes the KV (key-value) state and stores it in GPU memory, and the decode phase, which generates output. Long prompts make prefill expensive. Cached input tokens cost about one tenth, and with newer models about 5%, of the full input price. Agentic workloads with stable system prompts and tool definitions benefit the most.

  2. 02:33 Customer story Depth 300 · Novelty 2/3

    GitHub Copilot: over 90% cache hit rate, lower latency and 68% cost reduction

    Taylor explains that since GitHub Copilot moved to usage-based billing in June, GitHub has been responsible for efficiency on its customers' behalf, and it has raised the average cache hit rate to over 90% across all clients. Cache hit rates vary by workload: Copilot Chat on github.com stays low, while agentic sessions with hundreds of requests are highly cacheable. Production data for MAI code 1.1 flash shows that latency drops for every context-size cohort as the cache hit rate rises, and the cohorts converge at 95-97%. Because uncached tokens cost about 10x more, savings grow hyperbolically near 100%. For the same requests, users now pay 68% less than in June.

  3. 07:43 Customer story Depth 200 · Novelty 1/3

    ByteDance and Meta: sustaining 90% and reaching 98% cache hit rates

    Saloni describes two external customers. ByteDance (TikTok) has kept its cache hit rate at around 90% as its systems scale, through better prompt engineering. Meta worked with the Foundry platform team to fix its prompts and add prompt cache keys so that its requests are routed repeatedly to the same backend engine, while Microsoft improved its routing. Meta now reaches a cache hit rate of about 98%.

  4. 09:36 Deep dive Depth 300 · Novelty 1/3

    Why KV caching is hard: GPU memory, utilisation hotspots and cache evictions

    Taylor explains why traditional caching such as Redis does not fit this problem. The KV cache holds intermediate model activations that must be back in GPU memory before they can be used. Ideally every request in a session lands on the same GPU, but GPUs are limited in compute and memory. Running them at more than 90% utilisation makes them sensitive to traffic shifts that cause throttling and request queuing, and mixed workloads raise cache evictions. Neither shared-everything nor shared-nothing architecture works, and the right balance depends on the use case.

  5. 11:55 Deep dive Depth 300 · Novelty 2/3

    Foundry platform: smart affinity routing, load-aware balancing, cache advisor, tiered cache

    Saloni describes the improvements Microsoft made in the Foundry platform layer. A continuously running runner monitors and optimises cache behaviour. A smart affinity layer keeps requests from the same session on the same backend engine replica. Load-aware balancing moves requests away from hotspots, even though the first moved request has a worse TTFT. An internal advisor compares actual and attainable cache hit rates and attributes the gap to cross-deployment or cross-replica routing or to missing prompt cache keys; Saloni asks the audience whether it should become a product. The cache is also being made tiered, offloading from GPU memory to CPU memory and to local SSDs, and Microsoft is exploring the use of SSDs on other, less-utilised machines.

  6. 15:34 Deep dive Depth 300 · Novelty 2/3

    Caching modes: implicit, extended (24 h), explicit with breakpoints, configurable TTL

    Saloni walks through the caching levers available to customers. Implicit caching is the automatic default, with a best-effort lifetime of 10-15 minutes in memory, and suits short chats. Extended caching lasts up to 24 hours on a best-effort basis, uses SSD and is supported only on older models. Explicit caching, available with GPT-5.6 and newer models and used extensively by GitHub, lets developers set breakpoints to control exactly what is cached. A configurable TTL, recently introduced by OpenAI and by Microsoft, allows for example 30 minutes for fast multi-turn chats or 10 hours for long-running agents.

  7. 17:54 Deep dive Depth 300 · Novelty 2/3

    Best practices: stable prefix, prompt cache keys, five breakpoints, write-cost trade-offs

    Saloni lists best practices from customer support cases. A timestamp at the start of a prompt is a common mistake that destroys caching, so stable content such as system prompts, tool definitions and instructions should go at the top. A prompt cache key keeps routing sticky to the same backend engine and instance. Explicit mode allows up to five breakpoints, while implicit mode places the breakpoint at the end of the prompt. Short chats should use implicit caching, and long-context or long-running agentic workloads should use extended or explicit caching. Cache reads cost 10% down to 5% of input, while writes cost 1.25x of input for a 30-minute TTL and 2.5x for 12 hours. Saloni stresses that customers must measure hit rate, latency and throughput.

  8. 21:27 Customer story Depth 300 · Novelty 1/3

    How GitHub measures and tunes caching across heterogeneous workloads

    Taylor explains that GitHub's client services behave very differently. Asynchronous agentic jobs do not need a fast time to first token, so they can be delayed and interleaved with other traffic. GitHub runs all workloads on one large pool of shared models rather than dedicated pools for chat and agents, because GPUs are too scarce. With other cloud providers, a 24-hour cache can cost much more than a 5-minute cache, so the crossover point has to be measured because the levers affect each other. Saloni adds that the first jump in GitHub's hit rate, from about 60% to 85%, came from Foundry's smart affinity routing, and the rest came from GitHub's own work on prompts, stickiness keys and TTLs.

  9. 23:24 Closing Depth 100 · Novelty 0/3

    Closing: caching efficiency as a shared responsibility

    Saloni's main takeaway is that prompt caching is a shared responsibility. Microsoft optimises the platform, and customers should follow the best practices and keep monitoring to improve over time. The speakers offer to take questions after the session.

Announcements (7)

  • 12:27 not stated Microsoft Foundry

    Smart affinity routing

    Routes requests from the same session to the same backend engine replica and keeps later turns there.

    Speaker’s quote (at 12:27)
    „we've also built a smart affinity layer. So essentially making sure that all of your requests that are coming from the same either session are getting routed to the same backend engine replica“
  • 13:07 not stated Microsoft Foundry

    Load-aware load balancing

    Moves requests from congested engines to other available backend engines so they do not wait in a queue.

    Speaker’s quote (at 13:07)
    „So what we're trying to do is also make sure that if there are hotspots, we balance out to other engines in the backend that are available to process your request.“
  • 13:42 not stated Microsoft Foundry

    Cache advisor (internal)

    An internal tool that compares actual and attainable cache hit rates and attributes the gap to routing or to missing prompt cache keys; Microsoft is asking whether to expose it as a product.

    Speaker’s quote (at 13:42)
    „there's an advisor that we built internally where we're seeing what is the difference between your actual cache rate and your attainable cache rate.“
  • 14:38 not stated Microsoft Foundry

    Tiered KV cache with CPU memory and SSD offload

    Offloads KV cache from GPU memory to CPU memory and to the SSDs on the GPU machine, which is slower than GPU memory but faster than recomputing.

    Speaker’s quote (at 14:38)
    „So how can we then offload to the CPU memory as well? Both of these are still scarce resources. So what we're also trying to do is leverage the SSDs“
  • 15:05 not stated Microsoft Foundry

    Cross-machine SSD cache

    Microsoft is exploring using the SSDs on other, less-utilised GPU machines for cached state when there is a hotspot.

    Speaker’s quote (at 15:05)
    „The other thing that we are exploring is also how can not just the SSD on the same machine is getting used“
  • 16:37 not stated Microsoft Foundry

    Explicit caching with breakpoints

    Lets developers set breakpoints that define exactly which part of the prompt is cached for the next request, on GPT-5.6 and newer models.

    Speaker’s quote (at 16:37)
    „Lastly, the explicit caching. This is something that is available with the newer models, GPD 5.6 and plus.“
  • 17:03 not stated Microsoft Foundry

    Configurable cache TTL

    Lets customers set how long cached content stays in cache, for example 30 minutes for multi-turn chats or 10 hours for long-running agents.

    Speaker’s quote (at 17:03)
    „The other thing that recently OpenAI has introduced and we've also introduced is that TTL. You can configure the TTL of how long you want that to stay in cache.“

Demos (0)

No demos.

Watch on Microsoft’s site: THR862