‹ Field Guide

Letter 19 · The warm window

Michi is making two café orders for an agent that reads a menu and answers a guest. Both orders include the café’s instructions, kitchen rules and menu. Only the guest ticket changes. Koko asks whether the second guest could skip some of the wait.

Twelve beads the press can reuse

Our classroom tokenizer gives each order sixteen tokens. The press groups them into blocks of four. With the changing question at the end, twelve tokens form a reusable prefix. Michi processes sixteen prompt tokens for the first guest and four for the second. She saves twelve of thirty-two prompt-token computations. She still generates all seven output tokens across the two answers.

An attention layer keeps key and value vectors for earlier tokens. Prefix caching reuses that intermediate state when the tokens and cache identity match. Returning a previously written answer would require a separate response cache. The V1 vLLM design documented for this example indexes complete blocks using their tokens and preceding block identity. A change near the start affects every later block. vLLM prefix cache design · vLLM automatic prefix caching

A branch in the tea garden

The recipes “Miko serves tea mint warm” and “Miko serves tea peach iced” share three tokens. A third recipe, “Miko serves cake berry”, shares the first two. Individually those recipes contain fourteen tokens. Their tree stores nine distinct token positions. When a guest asks for “Miko serves tea peach tart”, Michi follows four existing positions and adds one. The number of token positions differs from the number of compressed edges drawn on the trellis. SGLang paper · The authors’ illustrated RadixAttention walkthrough

One page to copy

Michi and Koko fork two samples from a six-token prompt. Both point at P0, a full four-token page, and P1, a two-token tail. Koko wants to append mint where Michi will append plum. She copies the tail into P2. Both can still read P0. Three physical pages now hold two different continuations. This example starts with an explicitly forked sample and a shared partial page. PagedAttention paper · vLLM authors on parallel sampling

Which window will finish first?

Michi can prefill a warm order in 4 ms. Koko needs 22 ms for a cold one. Both need 10 ms to decode. When Michi’s queue is 14 ms, she finishes in 28 ms and Koko in 32. At an 18 ms queue the two windows tie. At 25 ms, Koko wins by 7 ms. Each time is an invented café measurement. Ray Serve documents a production approach that balances cache affinity with replica load. Ray Serve routing

Provider caching has its own eligibility, accounting and configuration. The OpenAI guide describes cache-hit reporting for supported models. Anthropic documents automatic caching and explicit breakpoints. These are good places to check the rules before turning a café idea into an API integration. OpenAI prompt caching · Anthropic prompt caching

The conference recording shows how the PagedAttention authors describe physical blocks. Anthropic’s August 2024 post records the original Claude prompt-caching beta announcement. Watch the SOSP presentation · Read Anthropic’s announcement on X

Play Mochi Cache Café · Take the Cache barista course