FIELD NOTES / HIGH SCHOOL
Memory at work
A cache retains work from the current sequence. It does not retrain the model.
Listen to this reading.
Local Kokoro Heart narration · high school. Covers the essay, worked example, and practice explanations. Quiz choices and source URLs are not read aloud. The text below is the transcript.
A new token reuses cached keys and values; reading that state still costs time and memory.
- Weights: learned settings
- Prompt: prefill
- KV: retained state
- New token: decode
Weights: learned settings
The workshop and the work in progress
A useful way to distinguish model weights from a cache is to imagine a workshop. The tools and their settings are available for many jobs. The current project also occupies space: notes, measurements, and partly completed work. Weights are the learned settings reused across requests. Cached attention state belongs to a particular sequence or reusable prefix. The analogy stops short of literal memory or understanding; it simply separates persistent parameters from temporary computation.
When a decoder processes a prompt, it performs a prefill pass over the input. When it continues the answer, it generates tokens through decoding steps. In ordinary causal attention, earlier token positions cannot attend to later positions. This allows previously computed keys and values to remain useful as the sequence grows. A KV cache stores those representations so the system can reuse them rather than recomputing all earlier projections at every step.
Worked example
Build the cache estimate.
Two layers, two KV heads, four values per head, one hundred tokens, two bytes per value.
Trace the calculation
Keys and values × layers × KV heads × head size × tokens × bytes: 2 × 2 × 2 × 4 × 100 × 2 = 6,400 bytes. This toy formula excludes other memory and does not describe every architecture.
Reusing work is not making it free
A new query still needs to interact with the relevant cached information. Reading the cache takes bandwidth, and a longer sequence can require more attention work. The cache also occupies memory. Caching changes the balance between recomputation and retained state; it does not remove every cost associated with a long conversation. This explains why a model can generate a short answer quickly yet struggle with a very long prompt or many concurrent users.
Suppose a toy model has two layers, two key/value heads per layer, four values per head, and a sequence of one hundred tokens. Storing both keys and values at two bytes per value requires 2 × 2 × 2 × 4 × 100 × 2 = 6,400 bytes. The first factor accounts for keys and values. This deliberately small example ignores allocator overhead and other state. Doubling the sequence length doubles this simple cache estimate; doubling independent sequences does the same.
Architectures change what needs to be retained
Grouped-query attention allows multiple query heads to share fewer key/value heads. That changes the number of cached heads while allowing distinct queries. Latent attention can retain a compact representation and use architecture-specific transformations to recover or compute what attention needs. Sliding windows can limit which recent positions remain relevant to a particular attention layer. These are distinct mechanisms, not interchangeable names for compression.
Do not apply one cache formula to every modern model without checking its architecture. Some systems contain multiple types of attention, shared memory, compressed representations, or other persistent state. A published bytes-per-token figure may cover only one component. Ask whether it includes all layers, scales, local windows, batches, and additional model-specific structures. A precise label such as “global cache component” is more useful than a large unqualified claim about total memory.
Measure the experience, not only a rate
Latency is the time a user waits for an event, such as the first token or the complete answer. Throughput is the amount of work completed over time, often across several requests. Batching can improve aggregate throughput while changing an individual user’s waiting time. Faster arithmetic does not guarantee lower latency when communication, cache reads, or scheduling dominate the workload.
Using the cache calculation above, vary sequence length while keeping other quantities fixed, then vary concurrency. Explain which quantities should change and which should remain constant. Finally, consider an answer that is twice as long. Even if each decoding step has the same cost, more steps take more time. A responsible performance report states the model revision, numerical format, hardware, prompt and output lengths, concurrency, and the metric being measured. Those details turn a speed claim into something another person can interpret and attempt to reproduce.
Reason through the practice.
Use these short explanations alongside the main reading. Each coach question links to the relevant explanation.
Weights
Weights are learned settings; activations and cached sequence state change with the input during ordinary inference.
Cache
The cache retains attention keys and values from processed tokens. It avoids recomputing those projections for the same past positions.
Prefill
Prefill processes the supplied prompt. Decoding then extends the sequence, typically one generated token at a time.
Decode
With a growing cache and fixed other settings, retaining more token positions increases sequence-state memory.
Cost
Caching avoids repeated computation of stored keys and values, but reading that state and using it still costs time and memory bandwidth.
Tokens
The conventional cache estimate is linear in retained token count under fixed dimensions and precision.
Batch
For separate unshared sequences, conventional KV storage scales with batch size. Prefix sharing changes assumptions when supported.
Budget
Weight storage, KV state and temporary working memory are separate costs. File size alone is not a complete runtime budget.
Read · recall · revisit
Make the idea your own.
High school · 8 questions per practice set, drawn from 16 authored questions. Each set covers every concept once. Read the supporting passages whenever you need them.
Progress stays in this browser on this site. It is not sent to a server or shared between devices. High school and college have separate records. Clearing browser data removes it.
8 questions per set. Enable JavaScript for rotating practice; the complete bank is listed below without it.
These checks cover the selected answers, not your overall understanding. A correct answer suggests a review tomorrow; a missed answer suggests reviewing its passage now. This simple reminder is not a validated learning schedule.
Clear this level’s current set and all coach attempts? Lesson progress and the other level will stay unchanged.
Sources and further investigation
Source review: October 28, 2026. Model-release claims are attributed to their publishers.