# KV Cache Quantization

- **Canonical URL:** https://getaimath.com/dictionary/kv-cache-quantization/
- **Topics:** [LLM Inference: Prefill & Decode](https://getaimath.com/dictionary/category/llm-inference-prefill-and-decode/)
- **Last updated:** 2026-11-25

## What is KV Cache Quantization?

**In one sentence:** KV cache quantization stores the KV cache in fewer bits to save memory.

Instead of keeping keys and values in 16-bit, they are compressed to 8 or 4 bits. This lets you fit longer contexts or more users in the same memory, usually with a small quality cost.

![How an AI Replies: 1. Read Your Question → 2. Type the Answer — Simple two-step cartoon: Step 1 (Prefill) shows the AI scanning your entire question in one flash (causing the brief pause before it starts talking); Step 2 (Decode) shows it typing out the reply one word at a time.](https://getaimath.com/diagrams/llm-inference-prefill-and-decode.png)
*Napkin Diagram (LLM Inference: Prefill & Decode): Every AI reply has two halves: gulping down your whole prompt at once, then speaking the answer one word at a time.*

## What is an example of KV Cache Quantization?

Switching the KV cache to 8-bit can roughly double the context you can fit.

## Why does KV Cache Quantization matter?

It is an easy way to run longer contexts on limited hardware.

## Related Concepts

- [KV Cache Size](https://getaimath.com/dictionary/kv-cache-size/): KV cache size is how much memory the KV cache needs, which grows with context length, layers, heads and number of users.
- [PagedAttention](https://getaimath.com/dictionary/pagedattention/): PagedAttention is a way to store the KV cache in small fixed-size blocks, like pages in a book, to avoid wasting memory.
- [Value Cache](https://getaimath.com/dictionary/value-cache/): The value cache is the part of the KV cache that stores the values for all previous tokens.
- [Continuous Batching](https://getaimath.com/dictionary/continuous-batching/): Continuous batching lets a server add new requests to a running batch as soon as others finish, instead of waiting for the whole batch.
- [Key Cache](https://getaimath.com/dictionary/key-cache/): The key cache is the part of the KV cache that stores the keys for all previous tokens.
- [Static Batching](https://getaimath.com/dictionary/static-batching/): Static batching groups requests together and runs them as one fixed batch until all of them are finished.

---
Source: The AI Math Dictionary (https://getaimath.com/dictionary/kv-cache-quantization/)
