LLM GPU Memory (VRAM) and Inference Speed Calculator
Enter the model size, weight precision, layers, KV heads and head size, context and batch, GPU memory and bandwidth, and see VRAM needed and tokens per second.
Berjalan di browser Anda. File Anda tidak pernah keluar dari perangkat. Lihat cara memeriksa
…
Cara melakukannya
- 1Enter model size
Billions of parameters.
- 2Choose precision
Weights and cache.
- 3Enter architecture
Layers, KV heads, head size.
- 4Set context and batch
For your use.
- 5Enter your GPU
Memory and bandwidth.
Tentang alat ini
Running an open-weights language model locally starts with one question: will it fit on my graphics card? GPU memory holds the model weights, whose size depends on the number of parameters and the precision (32-bit, 16-bit, 8-bit or 4-bit), and the key-value (KV) cache, which grows with the context length and the number of requests processed together. On top of that, frameworks need some working memory. This calculator estimates the total, shows which precisions fit your GPU and gives an upper bound on generation speed from memory bandwidth.
Who this is for
Developers, researchers and hobbyists running models on their own hardware, and teams choosing GPUs for inference servers.
Weights
Weight memory = parameters × bytes per parameter: 4 bytes for FP32, 2 for FP16 or BF16, 1 for FP8 or INT8 and about 0.5 for 4-bit quantisation. An 8-billion-parameter model needs about 16 GB at BF16 but about 4 GB at 4 bits.
KV cache
During generation the model stores keys and values for every previous token in every layer. KV cache = 2 × layers × KV heads × head dimension × tokens × batch × bytes. Models with grouped-query attention use fewer KV heads than attention heads, which shrinks the cache a lot. Long contexts and large batches can make the KV cache larger than the weights.
Overhead
Activations, the CUDA context and framework buffers typically add about 10% or more; the calculator adds 10%.
Speed
Generating each token for a single request requires reading all the weights from memory, so tokens per second ≤ memory bandwidth / bytes read per token. A GPU with 1,000 GB/s and a 4 GB model can reach at most about 200 tokens per second for one user; real speeds are lower. Batching many requests raises total throughput.
A worked example
An 8-billion-parameter model with 32 layers, 8 KV heads and 128-dimensional heads, at 4-bit with a BF16 cache for 8,192 tokens, needs about 4 GB of weights, 1.1 GB of KV cache and about 5.6 GB in total. It fits a 24 GB card comfortably; at BF16 it would need about 18.8 GB.
Quantisation trade-offs
Lower precision saves memory and often speeds generation, but very aggressive quantisation can reduce quality. 8-bit is usually close to full quality; 4-bit methods are widely used with modest losses.
## Choosing a GPU Pick a card with at least 20% free memory beyond the estimate so longer prompts and framework updates do not cause out-of-memory errors. If the model only just fits, shorten the context, use a smaller batch, quantise the KV cache to 8 bits or move to a smaller model.
Limits
Real memory use depends on the framework and settings. These are estimates, not guarantees from any vendor.
Contoh perhitungan
An 8 B model at 4-bit with an 8k context needs about 5.6 GB of VRAM.
Fakta singkat
- Kategori: Pengembang & data
- Berfungsi di browser Anda, tanpa daftar, tanpa unggah.
- Masukan Anda tetap di perangkat Anda.
- Tersedia dalam bahasa Inggris.
- Konten terakhir ditinjau:
- Sumber resmi: Memory = weights + KV cache + overhead; decoding speed bounded by memory bandwidth (standard inference engineering estimates)
Pertanyaan yang sering diajukan
How much VRAM does a 7-8 B model need?
About 16 GB at 16-bit, 8 GB at 8-bit and 4 to 5 GB at 4-bit, plus cache.
What is the KV cache?
Stored keys and values for previous tokens, which grows with context and batch.
Why does context length matter?
The KV cache grows linearly with the number of tokens.
How fast will it generate?
At most memory bandwidth divided by the bytes read per token.
Does 4-bit lose quality?
Usually a little; 8-bit is close to full quality.
Is my data stored?
No. It stays in your browser.
