KV Cache

Stored key/value representations of prior tokens used during autoregressive transformer decoding so each new token can attend to the previous context without recomputing every prior layer from scratch.

Key points

  • During decode, the new token runs through the model weights and attends to internal representations of previous tokens; those stored representations are the KV cache [src-042].
  • KV-cache access is mostly a memory-bandwidth problem rather than a matrix-multiply problem [src-042].
  • Unlike model weights, KV cache is unique to each sequence, so it cannot be amortized across a larger batch in the same way [src-042].
  • Long context raises serving cost because every decode step may need to fetch more KV-cache bytes from memory [src-042].
  • Keeping KV cache in memory saves compute, while deleting and rematerializing it saves storage at the cost of another forward pass [src-042].

Related concepts

Source references

  • [src-042] Dwarkesh Patel — “How GPT, Claude, and Gemini are actually trained and served – Reiner Pope” (2026-04-29)

Robin Cartier perspective

This page is part of Robin Cartier's working AI knowledge graph: a practical research layer for production AI, recommendation systems, experimentation, GEO, and agentic web readiness.

The useful next step is to connect this concept back to applied product leadership and operating models.

Recommended next

Keep reading from this thread

From 491 indexed pages and articles.

  1. Wiki concept LLM Inference Economics The cost and latency structure of serving large language models, driven by compute throughput, memory bandwidth, batch size, context length, KV-cache storage, and Related by cache
  2. Wiki concept Scale-Up vs Scale-Out Networking Distinction between fast intra-rack accelerator communication and slower inter-rack or data-center communication in AI clusters. Readers have engaged with this next
  3. Insight AI Measurement and Experimentation How to measure AI product impact with evals, adoption metrics, online experiments, guardrails, and cost tracking Related by value