Web tool · LLM inference memory
KV cache compression explorer
A calculator for the KV-cache memory of LLM inference under cross-layer low-rank (SVD) compression with mixed-precision factors. Start from a proposed method, then change any parameter to see where the bytes go.
compression method custom
model & sequence
D = KV heads × head dimension: the per-token width of K (and of V) in one layer.
Decode buffers are preallocated for C tokens per layer; T is how many are filled.
low-rank factorization
G consecutive layers share one token factor A per group; each layer keeps its own coefficient block B.
quantization
16 keeps a matrix in the model dtype. Values are packed per row, e.g. two 4-bit values per byte.
compression ratios
Prompt cache α_prefill
—
—
Used (T tokens)
—
—
Reserved (capacity C)
—
—
Ranks r_k / r_v
—
—
where the compressed bytes go
—
ratio as generation proceeds
—
compare methods on this model
Same model, prompt length and generated tokens; each method uses its own ranks, bits and format. Click a row to apply it.
byte breakdown
Per group
formulas
Memory only: the ratios count every stored byte (packed values, scales, zero points) but say nothing about accuracy, which depends on the model and the task. Generated tokens stay in the model dtype unless decode-buffer bits are lowered.