How much VRAM does my language model need?

Kolik VRAM potřebuje můj jazykový model?

How does it work?

The calculator works with the model's own metadata straight from its Hugging Face repository. Everything runs in your browser; nothing is sent anywhere except the public read requests to Hugging Face. (For that reason, gated/private models unfortunately can't be loaded.)

  • Weights: To work out how much the model's weights take, we sum the sizes of the weight files (.safetensors/.gguf) straight from the repo. Because we use the real file sizes, any quantization (AWQ, GPTQ, GGUF, fp8…) is already accounted for.
  • KV cache: Each token is stored as a key and a value in every layer, so per token the cost is 2 × n_kv_heads × head_dim × bytes. We multiply by the number of layers, the context length, and the batch size. Grouped-query attention (fewer n_kv_heads than query heads) shrinks it; the KV cache switch sets the bytes per value (fp16 = 2, fp8 = 1, int4 = 0.5). The rest is read straight from config.json.
  • Hybrid-attention correction: Models with hybrid attention keep the full context only on their few global layers; the other (local) layers store just a fixed window (e.g. 1024 tokens). We split the layers accordingly, so their KV cache is much smaller (most calculators miss this and overestimate at long context).
  • Overhead: A rough flat ~1 GB for the CUDA context and activation buffers. Real usage also depends on the inference engine (vLLM, llama.cpp…) and memory fragmentation. So treat the result as a ballpark only.