KV Cache › Key Parameters
Michael BrenndoerferJanuary 6, 20261 min read
Language AI HandbookAll chapters Part 42 of 67Inference Optimization
KV Cache › Key ParametersOne section · Sections in this chapter11 / 14 ↓
Sections in this chapter14
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Understanding each parameter's role helps you reason about deployment decisions when configuring inference servers:
- d_model: The dimensionality of the model's hidden states. This appears directly in the memory formula and in the projection computation cost.
- num_heads: The number of attention heads. Along with head_dim, it determines how the model dimension is partitioned. More heads mean more granular attention patterns but the same total cache size (since ).
- head_dim: The dimension of each attention head, equal to . Smaller head dimensions mean more heads for the same model width.
- max_seq_len: The maximum sequence length the cache can store. This determines the upper bound on context length and the maximum cache memory for a given model.
- batch_size: The number of sequences processed simultaneously. Larger batches improve GPU utilization and throughput but multiply cache memory linearly.