Skip to main content

Envisioning is a research institute that studies how institutions adapt to technological change.

LinkedInInstagramGitHub

Since 2010

research
  • Observatory
  • Adaptive capacity
  • Newsletter
  • Methodology
  • Origins
  • Vocab
  • RSS feeds
services
  • Signals Session
  • Bespoke Projects
  • Build Sessions
  • Pricing
  • Use cases
  • Signals
  • Signal Scan↗free
impact
  • ANBIMAFuture of Brazilian Capital Markets
  • IEEECharting the Energy Transition
  • Horizon 2045Future of Human and Planetary Security
  • WKOTechnology Scanning for Austria
solutions
  • Innovation
  • Strategy
  • Consultants
  • Foresight
  • Associations
  • Governments
  • L&D
resources
  • Partners
  • Coding for Non-Coders
  • How we work
  • Data visualization
  • Multi-Model Convergence
  • FAQ
  • Security and privacy
  • Public sector
about
  • Manifesto
  • Community
  • Events
  • Support
  • Contact
ResearchCapabilityServicesSignalsAbout
ResearchCapabilityServicesSignalsAbout
  1. Home
  2. Vocab
  3. KV Cache

KV Cache

A memory buffer that stores previously computed key and value vectors from a transformer's attention layers so they can be reused when generating each new token instead of recomputed.

Year: 2019Generality: 650Added: Sep 18, 2026
Back to Vocab

A KV cache (key-value cache) is a memory buffer used during autoregressive generation with transformer language models. In self-attention, each token's key and value vectors depend only on that token and the model's fixed weights, not on later tokens, so once computed they never change. Without caching, generating each new token would require recomputing the keys and values for every earlier token in the sequence, work that grows with the length of everything generated so far. A KV cache stores these vectors as they are produced and reuses them on every later step, so generating a new token only requires computing that token's own query, key, and value and attending over the cached keys and values of everything before it.

This turns the per-token cost of generation from growing with the full sequence length into work that grows only with the newly added token. The tradeoff is memory that scales with sequence length, number of layers, and model size, since each transformer layer keeps its own cache. The technique became a standard part of transformer inference as autoregressive language models scaled up in the years following the original Transformer architecture (Vaswani et al., 2017), and it is documented as a core serving optimization in major inference libraries such as Hugging Face Transformers. The cache grows with every generated token and can dominate GPU memory at long context lengths. Later work on cache compression, quantization, CPU offloading, and fixed-size ("static") caches addresses this memory cost.

The KV cache holds a transformer's running, layer-by-layer representation of everything it has read or generated, and researchers have started treating it as more than an efficiency trick. Some 2025-2026 work manipulates or transfers KV-cache contents directly between different models or components, using it as a channel for passing internal state rather than only a cache, as in Cache-to-Cache communication between large language models.

Sources

  1. Cache strategies

    Hugging Face

  2. Understanding and Coding the KV Cache in LLMs from Scratch

    Sebastian Raschka (Ahead of AI) · Jun 17, 2025

  3. Attention Is All You Need

    arXiv · Jun 12, 2017

Research this in Signals

Scan KV Cache for yourself.

Signals turns a topic into a sourced research record you can inspect and rerun. Your first scan is free, and this one starts with KV Cache already loaded, so edit it or scan as is.