Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

KV cache

Storing each token's already-computed key and value vectors so generating the next token doesn't recompute attention over the whole sequence from scratch.

The KV cache stores the key and value vectors computed for every token already processed, so that generating the next token only requires computing that one new token's query, key, and value and attending against the cached keys/values -- turning what would be a full recomputation at every step into an incremental one.

Examples

  • Generating token 500 of a response with a KV cache means computing just that one new token's query against the 499 already-cached keys and values, not recomputing attention over all 500 tokens from scratch.

Read the full section →
Graph settings

Calculator