01 / THE WHOLE JOB
Two people ask the same thing. Must we start over?
Ari asks an assistant, “Help me plan a trip.” A moment later, Bea sends the same beginning. The model still has to write Bea's answer. But does the server really need to prepare that entire beginning again?
plan a trip”
keep useful working memory
THEN WRITE AN ANSWER
The model weights are learned numbers shared by requests using that model. The working memory records what a particular request has processed. Reusing the latter is not saving and replaying an old answer.
Three separate questions hide inside “remember”: Where did we put the data? Does this request begin the same way? Do we have everything needed to continue? Each needs a different picture.
Carry this forward: reuse preparation, not necessarily the answer. First we need to see what “preparation” means.
02 / OPEN THE READING BOX
What does the server actually remember?
The model reads tokens: numbered pieces of text, which may be words, word fragments or punctuation. For arithmetic we pretend our five words are five tokens. A real tokenizer may split them differently.
process the 5 prompt positions
from the final prompt's scores
process “Try”, then sample “Rome”
Prefill is processing the prompt's not-yet-reused positions. Decode feeds generated tokens back through the model to continue the answer. These are phases of the same model, not two different models. The model's output scores are often called logits.
In an attention layer, a new position makes a query (“what should I look for?”). Earlier positions provide numerical keys (“what can be found here?”) and values (“what information can I contribute?”). Attention mixes values using query–key scores. The KV cache keeps these earlier keys and values so they need not be rebuilt at every step.
One tiny numerical attention example, before the full equation
Suppose two earlier values are 10 and 20, and their attention weights are ¾ and ¼. Their contribution is ¾ × 10 + ¼ × 20 = 12.5. Where those values sit in memory must not change 12.5. Real keys/values are vectors at many layers; the preserved arithmetic lab computes actual scores, softmax weights and weighted vectors across scattered pages.
A sampled word is not automatically in this cache yet: it enters the model's processed state when it is fed back. Keep “tokens emitted” separate from “tokens processed.”
Carry this forward: the KV cache saves intermediate model work. Now find one saved item without assuming everything is adjacent.
03 / A MAP OF ADDRESSES
Where is the memory for “trip”?
Imagine reserving one enormous continuous stretch of memory for every conversation, just in case it grows. Much of it could sit empty. Instead, put token positions into small blocks and keep a table mapping their logical order to physical storage.
Our block size is 2 token positions. “trip” is position 4. Divide 4 by 2: it belongs to logical block 2, at offset 0. If table[2] is 33, the address is physical block 33, offset 0. No hunting through every block.
Predict: move logical block 2 from physical block 33 to physical block 5, with its contents intact. Should the model's answer change?
Follow one address
PagedAttention, introduced by vLLM, connects this paged layout to attention reads. It changes how saved keys/values are found, not the mathematical attention result. The little labels above stand in for their numerical KV vectors.
Answer: the address changes; the data and answer must not. Five positions need six slots here, not a maximum-length reservation. Paging is about placement; it does not by itself prove a second request can reuse a prefix.
05 / A TIMELINE OF COMPLETE STATE
What if KV is only half of “remembering”?
Now change one thing: use a hybrid model with attention layers and recurrent layers. A recurrent layer updates a running numerical summary as each token is processed. Continuing correctly needs both the saved KV and that recurrent summary, plus any extra model-specific state needed to continue (auxiliary state), from the same processed endpoint.
Keep our five-token prompt. Suppose the model has already processed all 5 positions, and we later append 2 more. A coarse checkpoint exists after 4 positions. If no complete checkpoint exists after 5, replay position 5 before processing the 2 new positions: 1 + 2 = 3. A complete endpoint-5 checkpoint reduces that to 0 + 2 = 2.
Here “2 new” means appended input positions in a later request, not the two output tokens in our ribbon. This experiment counts prompt recovery work only. Endpoint 5 means five positions processed (indices 0–4).
Predict: is “KV through 5, recurrent state through 4” enough? Can a host-memory toggle repair a checkpoint that was never captured?
Choose what actually survived
FlashStates is research built on a vLLM fork. Its contribution includes capturing and managing complete hybrid recovery units at exact processed endpoints, under supported capture/export conditions. It is not a third independent general serving engine, and it does not remove attention's need for KV.
Notice this: on the left, compare the outlined ideal endpoint markers with the filled actual recovery arrows. Red segments are old positions replayed to bridge the gap—our “1 old + 2 new” example, at research scale.
Takeaway: checkpoint placement and memory pressure determine recoverable work. This figure's right-hand numbers are the authors' historical, configuration-specific reported experiment, not measured by this lesson and not a universal ranking of today's engines. Open the full-size figure to read its labels.
FutureMLS-Lab / FlashStates authors · Apache-2.0 · pinned original · authors' benchmark scope · license, notice & hash.
Answer: neither mismatched endpoints nor empty host capacity can restore missing state. Host storage can move a previously captured complete unit; it cannot invent one.
06 / A WORK LEDGER, NOT A MEMORY MAP
Who gets the next turn?
Even perfect reuse does not decide which waiting request runs next. A scheduler chooses work under limits. Continuous batching lets requests join or leave between iterations; chunked prefill breaks prompt work into smaller pieces.
For this separate concurrency example, requests A, B and C have different lengths. We switch from our five-token trip to show why a short request can finish first. There are 2 active slots and a budget of 4 token positions per tick. Visit each active request once, in order: process up to 2 prompt tokens, or decode 1 output token. Release finished slots after the tick; admit replacements at the next tick.
Predict: B arrives after A. Must it finish after A? Step the ledger: the result is B, then A, then C.
Spend the next token budget
This teaching scheduler deliberately counts output-generation actions separately from prefill; it does not model first-token logit fusion, GPU kernel time or a production scheduling policy. Its ticks have no millisecond conversion. Real serving can combine/cache/chunk work in version- and configuration-dependent ways.
Carry this forward: memory management answers “what can run?” Scheduling answers “what runs now?” Neither a token count nor a tick count alone establishes latency.
07 / REASSEMBLE THE SERVER
What changed—and what should we compare?
Return to Bea's “Help me plan a trip”. We can now tell a complete story without giving every mechanism the same picture.
- 1Read token IDs. Tokenization decides the pieces; the same-looking sentence is not sufficient cache identity.
- 2Find a reusable beginning. An index, such as a radix tree or prefix hashes, locates compatible saved work.
- 3Check completeness. A hybrid model also needs recurrent/auxiliary state at the same endpoint.
- 4Schedule and address the rest. A work ledger selects positions; block tables locate their KV while the model runs.
- 5Sample, stream, continue. Reuse can avoid old prompt work; the model still has to produce the answer. Release references safely when done.
Compare the same request under the same policy
A real comparison fixes the model and precision, hardware, software revisions, prompt/output lengths, arrival pattern, cache warmth, concurrency and memory budget. It reports both speed and quality constraints. “More cached tokens” alone is not a benchmark.
Time to first token (TTFT) measures from a stated arrival boundary until the first output; it can include waiting, lookup, transfer and prompt work. Inter-token latency measures gaps between outputs. Throughput measures tokens or requests per time under a specified workload. Improving one does not automatically improve the others.
The whole idea: place memory efficiently, reuse only compatible beginnings, recover complete state, and schedule fairly. vLLM and SGLang have overlapping capabilities; FlashStates studies hybrid recovery on vLLM. Choose with a controlled workload, not three feature mascots or our toy counts.
Ready to inspect the details? The next tier keeps the complete mechanisms with six concept-specific walkthroughs: an event trace, responsibility matrix, address map, growing prefix tree, aligned state timelines and measurement protocol. Actual attention arithmetic, ownership and eviction, and all four original labs are here too.

