LLM KV cache memory estimate
Estimate key-value cache storage for a transformer workload from batch size, sequence length, layers, hidden size, and bytes per value.
Method and scope
KV bytes ≈ batch × sequence length × 2 × layers × hidden size × bytes per value.
Use llm kv cache memory estimate for educational calculation or a clearly scoped arithmetic estimate. Intended for Learners, General educational use.
Inputs- Batch size — 1
- Sequence length — 1
- Transformer layers — 1
- Key/value hidden size — 1
- Bytes per cached value — 1
Assumptions: The architecture stores one key and one value vector per layer, token, and batch item. Hidden size represents the relevant key/value width and the same precision is used throughout.
Limitations: Grouped-query, multi-query, sliding-window, quantized, and hybrid architectures can use materially different memory.
Method version 1.0.0 · Unit registry and result provenance are shown after calculation. This tool is limited to the documented scope.Explore related fields
See the other currently released formula calculators tagged for these research fields.