vram-budget -- where the GPU memory goes
The size on a model's download page is not what it needs in order to run. Four things share the graphics card's memory: the weights themselves, fixed once you choose the model size and how many bits each number uses; the notes the model keeps on every word of the current conversation, which grow steadily as that conversation gets longer; scratch space for the work in progress; and a fixed slice the driver takes for itself. The middle one is why a model that loads happily still runs out of memory tens of thousands of words in — past some length the conversation's notes outweigh the model itself, and the limit you are hitting is the length rather than the model.
Interactive page: live VRAM math for LLM inference -- the four things that consume GPU memory, to scale against a chosen GPU, and why a long prompt runs out of memory. Anchor: G (quantization / deployment); Family G.
What it shows
A stacked bar (vs the GPU's capacity, red when it OOMs) of:
- weights =
params × bytes/weight-- fixed once you pick the model size the weight quant (fp16 = 2 B, int8 = 1, int4 = 0.5). - KV cache =
2 · L · (d/H · n_kv_heads) · seq · batch · kv_bytes-- caches every past token's keys & values, so it grows linearly with context length and batch. GQA (n_kv_heads ≪ n_heads, e.g. Llama-70B) and a low KV dtype shrink it. - activations -- transient forward-pass buffers: tiny during decode (one token), larger during a big prefill.
- overhead -- the fixed CUDA context + fragmentation.
The KV-cache-vs-context curve plots the KV block as the sequence length grows and marks where it crosses the weights line -- past that point you are context-bound, not model-bound, which is the usual reason a long prompt OOMs.
Try int4 weights (shrinks the blue block), Llama-70B (GQA) (shrinks the orange KV block despite being a bigger model), or drag the context marker out to 128k and watch the KV cache explode past the GPU.
Drag the marker on the curve to set the context length; selects for model, weight quant, KV dtype, phase, and GPU; sliders for context and batch; the OOM border pulses, a ghost dot sweeps the KV curve; hover a bar segment for its formula.
Render tier
T1 (Canvas2D: the stacked VRAM bar + capacity line + the KV-vs-context curve breakdown panel).
Wiring
layout.mount + controls (model, wq, kvq, context, batch, mode, gpu) + animate (the OOM pulse + KV ghost sweep) + onPointer drag-the-context + hover. ?model / ?wq / ?kvq / ?context / ?batch / ?mode / ?gpu / ?hover hooks. Source: page.js.