How it works
VRAMwise adds up the GPU memory an LLM needs to serve your workload with vLLM, then checks it against each cloud GPU instance. These are estimates: test on the real instance before you rely on them.
The formulas
1. Weights
W = parameters x bytes per weight
Every parameter is stored once. Bytes per parameter: BF16 / FP16 2 bytes, FP8 1 byte, INT8 1 byte, INT4 (AWQ / GPTQ) 0.5 bytes. The worked example below shows the size for an 8B model.
2. KV cache
KV per token = 2 x layers x KV heads x head dim x bytes; KV = KV per token x tokens x users
For every token in a conversation the model keeps a Key and a Value per layer, so it does not compute them again. The cache grows with the context length and with the number of users served at the same time. When a model is split over more GPUs than KV heads, each KV head is copied to several GPUs, so the cache takes GPUs / KV heads times the memory.
3. Overhead
O = 0.1 x W + 1.40 GiB per GPUSizes are in GiB (1 GiB = 1.074 GB). Hugging Face file sizes and some price pages use GB.
Activations (temporary values while the model runs) plus the CUDA context and framework buffers on each GPU.
4. Required VRAM and headroom
R = W + KV + O; with headroom: R x (1 + h)
The total the workload needs. Headroom is a safety margin on top. If R fits but not with headroom, the instance is marked Tight.
5. Max users
Room for the cache = usable VRAM - W - O; max tokens = room / KV per token; max users = max tokens / average tokens
Usable VRAM is the GPU memory times the vLLM memory utilization (for example 0.9). What is left after the weights and overhead holds the KV cache, and that decides how many requests of the average length can run at once.
6. Full-context rule
max tokens >= context length
vLLM refuses to start when one request at the full context length does not fit in the KV cache. So an instance is only "Fits" when a single full-length request fits, even with one user.
7. Speed estimate
upper = bandwidth per GPU x GPUs / (active parameters x bytes per weight); realistic = upper x 0.6
Generating a token reads all active weights from GPU memory once, so memory bandwidth sets the upper bound. Real servers reach about 60% of it. This is a rough estimate; test on the real instance.
Worked example
Llama 3.1 8B, BF16 / FP16 weights and KV cache, on 1 x NVIDIA L40S (48 GiB spec memory). Context length 8,192 tokens, 8,192 tokens per request, 8 users, GPU memory utilization 0.9.
| Weights (W) | 14.96 GiB |
|---|---|
| KV cache per token | 131,072 bytes |
| KV cache for one full request | 1 GiB |
| KV cache for 8 users | 8 GiB |
| Overhead (O) | 2.89 GiB |
| Required VRAM (R) | 25.85 GiB |
| With 20% headroom | 31.02 GiB |
| Usable VRAM (48 GiB x 0.9) | 43.20 GiB |
| Room for the KV cache | 25.35 GiB |
| Max tokens in the cache | 207,669 |
| Max users (at 8,192 tokens each) | 25 |
| Speed per user (estimate) | 32.3 tokens/sec |
| Status | Fits |
The planner uses the memory the cloud reports when it is smaller than the spec value, so it can show slightly fewer users for the same instance.