Key-value cache

KV cache, Attention cache

Infrastructure

Deployment

Soft glowing orange and yellow light with a gradient blending into black background.
TL;DR
An optimization technique that stores intermediate attention states during transformer-based autoregressive text generation to avoid redundant computation.

In depth

Transformer models generate text sequentially, which normally requires recalculating historical attention vectors at each new token generation step. By keeping the calculated key and value vectors in memory, a key-value cache allows the model to process only the newest token and retrieve the rest of the history. This mechanism drastically reduces computational overhead and inference latency during long-context conversations.

Why this matters for your business

It is the primary engine behind fast real-time chatbot responses and is crucial for scaling up simultaneous user requests and maximizing GPU efficiency.

Ready to Scale AI Across Your Organization?

Talk to an AI expert
Exit cross icon
Exit cross icon