Awesome Testing

Lesson 08 · Generation repeats

What can the model reuse when the chosen token extends the sequence?

Training target revealed

The animal did not cross the street because it was too tired

01 · Smallest useful mechanism

Reuse the past instead of recomputing it

Generation has two phases. During prefill, the model processes the prompt and creates attention keys and values for every prompt position and layer. During decode, it produces one token at a time. A new token still needs to attend to earlier context, but those earlier keys and values do not need to be recalculated. The KV cache keeps them available and appends one new pair after each generated token. This speeds up repeated generation, but the cache grows with active context and consumes memory for every request. It is a temporary working shelf, not learned knowledge. Some serving systems can reuse a compatible cached prefix across requests, but that is an additional optimization—not the model permanently remembering a conversation.

The KV cache stores temporary attention projections for the active sequence.

02 · Experiment

Test the prediction

Calculate by hand · architecture calculator

Cache shapes and byte counts are calculated from declared architecture parameters; no hidden runtime tensors are invented.

Loading the experiment…

03 · Production-minded practice

Prove cache reuse is correct

Commit to a written claim and evidence plan. The Lab stores the draft locally and never sends it to a server.

Your learning artifact

Write the argument you would defend

Stored only in this browser. No account required; course reset does not delete it.

04 · Check your understanding

Why are old keys and values cached?

Optional referenceDeep dive / reference chapterOpen the complete essay, diagrams, mathematics, exercises, glossary, and sources when you want more depth.

Next: Inference now makes sense end to end. The remaining question is how training made “tired” receive a high score.