VRAM is the GPU's own high-speed memory. For AI it holds the model weights, the KV cache for active conversations, activations and, in training, gradients and optimiser state. If they don't fit, the model won't run or slows sharply. Weights in GB ≈ billions of parameters × bytes per parameter, plus 10–20% headroom.
- Weights formula
- Parameters (B) × bytes per parameter = GB
- Bytes per parameter
- BF16 2 · FP8 1 · 4-bit ~0.5–0.6
- Llama 3.x 70B KV cache
- ~0.33 MB per token in FP16
- Llama 3.1 8B KV cache
- ~0.13 MB per token in FP16
- Full fine-tune (Adam, mixed precision)
- ~16–20 bytes per parameter
- Cloud GPU VRAM range
- 24 GB (RTX 4090) to 288 GB (B300)
- Headroom to leave
- 10–20% for activations, CUDA and framework
VRAM is the single number that decides whether an AI model will run on a GPU at all. Speed, price and features come after. If the weights, the working memory for conversations and the framework's overhead do not fit, nothing else matters.
This guide explains what VRAM holds, gives you the formulas to calculate it for language models, image models and fine-tuning, and shows how to cut it down when you are just over the line. It is part of our series on GPU cloud computing.
What is GPU VRAM?
GPU VRAM is the dedicated memory physically attached to a graphics processor, separate from the computer's system RAM. The GPU's cores can read and write it far faster than they could reach system memory, so everything a model needs during computation is kept there.
Two families of memory are used on current GPUs:
| Memory type | Where it sits | Bandwidth on current cards | Used on |
|---|---|---|---|
| GDDR6 / GDDR6X | Chips on the board around the GPU | 864 GB/s (L40S), 1,008 GB/s (RTX 4090) | Consumer and pro cards |
| GDDR7 | Chips on the board | 1.8 TB/s (RTX PRO 6000 Blackwell) | Blackwell pro and consumer cards |
| HBM2e | Stacks beside the GPU die on one package | 1,935 GB/s (A100 80GB PCIe), 2.0 TB/s (H100 PCIe) | Data-centre cards |
| HBM3 / HBM3e | Stacks on the package | 3.35 TB/s (H100 SXM), 4.8 TB/s (H200), 8 TB/s (B200, B300) | Latest data-centre cards |
From your code's point of view they behave the same. What changes is capacity and bandwidth, and both matter for AI.
Why does VRAM matter so much for AI?
VRAM matters because it is a hard limit: a model has to be in GPU memory to run at GPU speed. If it does not fit, you get an out-of-memory error, or the framework pushes part of the model into system RAM and performance collapses.
The collapse is easy to quantify. Offloaded layers are read across PCIe, which delivers roughly 64 GB/s in each direction on a Gen5 x16 slot and about half that on Gen4. An H100 PCIe reads its own memory at 2.0 TB/s. Data that crosses PCIe instead is therefore around 30 times slower to fetch (2,000 ÷ 64 ≈ 31). Offloading a third of a model's layers can make generation several times slower overall.
VRAM also sets how many users you can serve. Each active conversation needs its own KV cache. More memory left after the weights means more concurrent users and longer contexts on the same card.
What uses VRAM when you run a model?
When you run a model, VRAM holds five things: the weights, the KV cache, activations, the CUDA context and framework buffers, and, during training, gradients and optimiser state.
| What | Inference | Training | How big |
|---|---|---|---|
| Model weights | Yes | Yes | Parameters × bytes per parameter |
| KV cache | Yes | Small | Grows with tokens × users |
| Activations | Small | Large | Grows with batch size × sequence length |
| CUDA context, framework, kernels | Yes | Yes | ~0.5–2 GB, more with CUDA graphs |
| Gradients | No | Yes | Same size as trainable weights |
| Optimiser state (Adam) | No | Yes | ~8–12 bytes per trainable parameter |
For inference, weights and KV cache dominate. For training, gradients and optimiser state can be several times bigger than the weights.
How do you calculate VRAM for an LLM?
Calculate VRAM for an LLM as weights plus KV cache plus 10–20% headroom. Weights are parameters in billions times bytes per parameter. KV cache per token is 2 × layers × KV heads × head dimension × bytes per value.
Weights:
| Precision | Bytes per parameter | 8B model | 32B model | 70B model |
|---|---|---|---|---|
| FP32 | 4 | 32 GB | 128 GB | 280 GB |
| BF16 / FP16 | 2 | 16 GB | 64 GB | 140 GB |
| FP8 / INT8 | 1 | 8 GB | 32 GB | 70 GB |
| 4-bit (AWQ, GPTQ, GGUF Q4) | ~0.5–0.6 | ~4–5 GB | ~16–19 GB | ~35–42 GB |
KV cache, worked out from published model configurations:
Llama 3.1 8B: 2 × 32 layers × 8 KV heads × 128 head dim × 2 bytes = 131,072 bytes ≈ 0.13 MB per token
Llama 3.x 70B: 2 × 80 layers × 8 KV heads × 128 head dim × 2 bytes = 327,680 bytes ≈ 0.33 MB per tokenMultiply by tokens in flight. For the 70B model, one 32,000-token conversation takes about 10.7 GB. Ten users each with 8,000 tokens of context is 80,000 tokens, about 26 GB. Storing the cache in FP8 halves those figures.
Putting it together:
| Scenario | Weights | KV cache | Headroom | Total | Fits on |
|---|---|---|---|---|---|
| 8B BF16, 1 user, 32k context | 16 GB | 32,768 × 0.13 MB ≈ 4.3 GB | ~3 GB | ~23 GB | 24 GB RTX 4090, just |
| 8B BF16, 8 users × 8k | 16 GB | 65,536 × 0.13 ≈ 8.6 GB | ~4 GB | ~29 GB | 48 GB L40S |
| 70B FP8, 4 users × 4k, FP8 KV | 70 GB | 16,384 × 0.16 ≈ 2.7 GB | tight | ~75–78 GB | 80 GB H100, tight |
| 70B FP8, 10 users × 8k | 70 GB | ~26 GB | ~10 GB | ~106 GB | 141 GB H200 |
| 70B BF16, 1 user, 32k | 140 GB | 10.7 GB | ~20 GB | ~171 GB | 180 GB B200, or 2–4 × 80 GB |
| Qwen3 235B-A22B FP8 | 235 GB | ~10–20 GB | tight | ~260 GB | 288 GB B300 |
Mixture-of-experts models such as Qwen3 235B-A22B need memory for all parameters, even though only about 22B are active per token. Active parameters set speed; total parameters set memory. Our detailed guide to GPU memory for LLMs covers more models and context lengths.
How much VRAM do image and video models need?
Image models need VRAM for the main diffusion model, its text encoders and the VAE, plus activations that grow with resolution and batch size. SDXL-class models run comfortably in 12–16 GB; FLUX.1 [dev] at full precision wants more than 24 GB unless you quantise or offload parts.
| Model | Main model size | Approximate pipeline in 16-bit | Comfortable GPU |
|---|---|---|---|
| Stable Diffusion 1.5 | ~0.9B UNet | ~4–6 GB | Any 24 GB card |
| SDXL | ~2.6B UNet + two text encoders | ~10–14 GB at 1024 px | RTX 4090 |
| FLUX.1 [dev] | 12B transformer (~24 GB in BF16) + T5-XXL encoder (~9–10 GB) | ~33 GB+ | 48 GB L40S, or 24 GB with FP8/offload |
| Video diffusion models | Varies widely | Often 40–80 GB+ | RTX PRO 6000, H100 or larger |
The [FLUX.1 [dev] model card](https://huggingface.co/black-forest-labs/FLUX.1-dev) lists its size and licence. For a model-by-model breakdown, see how much VRAM you need for Stable Diffusion and FLUX.
How much VRAM does fine-tuning need?
Fine-tuning needs far more VRAM than inference because you store gradients and optimiser state as well as weights. Full fine-tuning with Adam in mixed precision takes about 16–20 bytes per parameter before activations; LoRA and QLoRA cut that to roughly the size of the base weights plus a few GB.
| Method | Formula (rule of thumb) | 8B model | 70B model |
|---|---|---|---|
| Full fine-tune, Adam, mixed precision | ~16–20 bytes × params + activations | ~128–160 GB | ~1.1–1.4 TB |
| LoRA on BF16 base | 2 × params + a few GB | ~16 GB + 4–10 GB | ~140 GB + 10–20 GB |
| QLoRA on 4-bit base | ~0.5–0.6 × params + a few GB | ~5 GB + 4–8 GB | ~35–42 GB + 8–15 GB |
So an 8B LoRA fits a 24–48 GB card, a 70B QLoRA fits an 80 GB card, and a full fine-tune of even an 8B model needs a 180 GB B200 or several 80 GB GPUs with sharding. How much VRAM you need to fine-tune an LLM covers batch size and sequence length effects.
How can you reduce VRAM use?
Reduce VRAM by lowering the precision of weights or KV cache, limiting context length and concurrency, and, for training, using LoRA/QLoRA and gradient checkpointing. Each trades a little quality or speed for memory.
- Quantise the weights. FP8 halves BF16; 4-bit roughly quarters it. Quality loss at FP8 is usually small; at 4-bit it depends on the model and method. See quantization explained.
- Quantise the KV cache. In vLLM,
--kv-cache-dtype fp8halves cache memory. - Cap the context.
--max-model-len 8192stops vLLM reserving space for 128k-token conversations you won't have. - Control how much VRAM vLLM claims.
--gpu-memory-utilization 0.90is the default; lower it if other processes share the GPU. - Gradient checkpointing in training recomputes activations instead of storing them, saving a lot of memory for roughly 20–30% more compute.
- Smaller batch, more accumulation. Gradient accumulation keeps the effective batch size while lowering peak memory.
A vLLM launch that fits Llama 3.3 70B FP8 onto an 80 GB card might look like this (assumes a recent vLLM release and access to the model):
vllm serve meta-llama/Llama-3.3-70B-Instruct \
--quantization fp8 \
--kv-cache-dtype fp8 \
--max-model-len 8192 \
--gpu-memory-utilization 0.95The flags are documented in the vLLM docs. If it still runs out of memory at startup, lower --max-model-len further or move to a bigger card.
Does more VRAM mean a faster GPU?
No. More VRAM means bigger models, longer contexts and more users fit; it does not make each token faster. Generation speed is set mainly by memory bandwidth, and prompt processing by compute.
Compare an RTX 4090 and an L40S. The L40S has twice the VRAM (48 GB vs 24 GB) but slightly lower bandwidth (864 GB/s vs 1,008 GB/s). For an 8B BF16 model that fits on both, the bandwidth rule (0.6–0.75 × bandwidth ÷ 16 GB) estimates about 32–41 tokens per second on the L40S and 38–47 on the 4090. The L40S wins when you need the extra room, not on raw speed. GPU memory bandwidth, FLOPS and compute performance explains the other two numbers.
How do you check VRAM usage?
Check VRAM usage with nvidia-smi for the whole GPU and PyTorch's memory functions for your own process.
nvidia-smi --query-gpu=name,memory.used,memory.total --format=csv -l 2import torch
print(torch.cuda.memory_allocated() / 1e9, "GB allocated")
print(torch.cuda.max_memory_allocated() / 1e9, "GB peak")Note that vLLM deliberately pre-allocates most of the card for KV cache, so nvidia-smi will show it nearly full even when idle. Check vLLM's startup log for how many tokens of KV cache it reserved.
How much VRAM can you rent from Wandering Giants Compute?
Wandering Giants Compute rents GPUs from 24 GB to 288 GB on a single card, so you can pick the memory your VRAM sum calls for rather than the nearest thing in stock. Every one-click model in our Chat and API modes lists its minimum VRAM, so you don't have to do the sum for those.
| VRAM you calculated | GPU | Memory | Price per hour | One-click example |
|---|---|---|---|---|
| Up to ~22 GB | RTX 4090 | 24 GB | $1.59/hr | Qwen3 8B, gpt-oss 20B |
| ~22–44 GB | L40S | 48 GB | $1.89/hr | Qwen3 32B AWQ |
| ~44–75 GB | A100 80GB or H100 | 80 GB | $3.79/hr / $4.99/hr | Llama 3.3 70B FP8, gpt-oss 120B |
| ~75–88 GB | RTX PRO 6000 | 96 GB | $4.89/hr | 70B with more KV room |
| ~88–130 GB | H200 | 141 GB | $9.09/hr | Very long contexts |
| ~130–165 GB | B200 | 180 GB | $15.49/hr | 70B in BF16 |
| ~165–265 GB | B300 | 288 GB | $18.09/hr | Qwen3 235B-A22B FP8 |
Need more than one card's worth? Stack 2, 4 or 8 of the same GPU in one machine. Billing is by the minute from prepaid credit, and the machine stops itself if credit runs out. See the GPUs and prices.
Frequently asked questions
Is VRAM the same as GPU memory?
Yes. VRAM (video RAM) is the traditional name for the memory on a graphics card. On data-centre GPUs it is usually called GPU memory or HBM. It is separate from the system RAM your CPU uses.
How much VRAM do I need to run a 7B or 8B model?
About 16 GB for the weights in BF16, plus a few GB of KV cache and headroom, so a 24 GB GPU is comfortable. At 4-bit the weights shrink to about 4.5–5 GB, so 8–12 GB cards can run it with a modest context.
How much VRAM does a 70B model need?
About 140 GB in BF16, 70 GB in FP8 and roughly 35–42 GB at 4-bit, before KV cache. In practice that means two or more 80 GB GPUs or one 180 GB B200 for BF16, one 80 GB card for FP8 with a modest context, and a 48 GB card for 4-bit.
What happens when a model doesn't fit in VRAM?
The framework raises an out-of-memory error, or, if it supports offloading, moves some layers to system RAM. Offloaded layers are read over PCIe at tens of GB/s instead of from VRAM at 1–8 TB/s, so generation slows dramatically.
Does more VRAM make a GPU faster?
Not directly. More VRAM lets bigger models, longer contexts and more users fit. Speed comes from memory bandwidth and compute. An L40S has twice the VRAM of an RTX 4090 but slightly lower bandwidth, so a model that fits on both generates at a similar speed.
What is the KV cache and why does it use so much memory?
The KV cache stores attention keys and values for every token in each active conversation so the model does not recompute them. It grows with context length and the number of users. For Llama 3.x 70B it is about 0.33 MB per token, so 32,000 tokens take about 10.7 GB.
What is the difference between HBM and GDDR memory?
HBM (high-bandwidth memory) is stacked next to the GPU die and gives very high bandwidth, 2–8 TB/s on current data-centre GPUs. GDDR sits on the board around the GPU and is cheaper, giving roughly 0.9–1.8 TB/s on current cards. Both work the same way from your code's point of view.
Rent the GPU for this, by the minute.
Pick exactly the VRAM your model needs, from 24 GB to 288 GB on one card, and pay only for the minutes you use.
Prepaid credit, billed by the minute, stops itself when credit runs out. Prices in £, $, €, ¥, CA$, A$, CHF and S$; UK prices include VAT.
Keep reading
- Complete guideWhat Is GPU Cloud Computing? The Complete Guide
- GuideHow Much GPU Memory Do You Need to Run LLMs?
- GuideUnderstanding GPU Memory Bandwidth, FLOPS and Compute Performance
- GuideHow to Choose the Right GPU for Your AI Workload
- GuideHow Much VRAM Do You Need for Stable Diffusion and FLUX?
- GuideHow Much VRAM Do You Need to Fine-Tune an LLM?
About this article. Written by the Wandering Giants Compute team, the people who run Wandering Giants Compute. Hardware figures are the manufacturers’ published specifications. Speeds and costs marked as estimates are worked out from those specifications and our current prices, with the method shown; they are not measured benchmarks. Wandering Giants prices are taken live from our price list each time this page is built.
Last reviewed 25 November 2026.