Why VRAM is the first number to get right

A GPU is fast at AI because it reads its own memory (VRAM) extremely quickly. When a model, its context and the runtime all fit in VRAM, answers stream at full speed. When they don't, the runtime either refuses to load the model or pushes part of it into system RAM, and generation slows towards CPU speed. Our local LLM hardware page explains why memory bandwidth sets that speed.

So the question isn't "which GPU is fastest?" but "how much memory does my workload need?" It has three parts:

VRAM ≈ model weights + KV cache (context) + runtime overhead

Part 1: model weights

Weights take roughly parameters × bits per weight ÷ 8 bytes. Quantisation stores them at lower precision to save memory. Common GGUF formats carry a little extra per weight for scaling data, so real files are slightly bigger than the simple maths suggests:

PrecisionEffective bits per weightLlama 3.1 8B file size
16-bit (FP16 / BF16)16≈ 16.1 GB
8-bit (Q8_0)≈ 8.58.5 GB
4-bit (Q4_K_M)≈ 4.94.9 GB

Good 4-bit quantisations are close to the original model for everyday chat, drafting and summarising. Maths, code and long reasoning are more sensitive, so if quality matters more than memory, use 8-bit.

Part 2: context memory (the KV cache)

While it generates, a model keeps a "key" and "value" vector for every token in the conversation, in every layer. That is the KV cache. It is the part most VRAM calculators skip, and it grows with context length and with every simultaneous user. At 16-bit it takes:

bytes per token = 2 × layers × KV heads × head dimension × 2 bytes

Using each model's published configuration:

ModelLayers × KV heads × head dimPer tokenPer 8K tokensPer 32K tokens
Llama 3.1 8B32 × 8 × 128131 KB1.07 GB4.3 GB
Qwen2.5 14B48 × 8 × 128197 KB1.61 GB6.4 GB
Qwen2.5 32B64 × 8 × 128262 KB2.15 GB8.6 GB
Llama 3.1 70B80 × 8 × 128328 KB2.68 GB10.7 GB

These models use grouped-query attention, sharing 8 KV heads across many query heads, which keeps the cache small. Older models without it need several times more memory per token. Runtimes such as llama.cpp and vLLM can also store the cache at 8-bit, roughly halving these figures for a small accuracy cost.

Part 3: runtime overhead

The GPU driver context, compute buffers and the runtime itself typically add around 1 GB per GPU. The exact amount varies by runtime, settings and batch size. Leave another 10–20% of headroom on top so you aren't running at the edge.

Worked examples: one user, about 8K tokens of context

Model and precisionWeightsKV (8K)OverheadTotalFits on
Llama 3.1 8B, 4-bit4.9 GB1.1 GB≈ 1 GB≈ 7 GB8 GB (tight), 12–16 GB comfortable
Llama 3.1 8B, 16-bit16.1 GB1.1 GB≈ 1 GB≈ 18 GB24 GB
Qwen2.5 14B, 4-bit9.0 GB1.6 GB≈ 1 GB≈ 11.6 GB12 GB (tight), 16 GB comfortable
Qwen2.5 32B, 4-bit19.9 GB2.1 GB≈ 1 GB≈ 23 GB24 GB (short context), 32 GB comfortable
Llama 3.1 70B, 4-bit42.5 GB2.7 GB≈ 1–2 GB≈ 46–47 GB48 GB total (limited context)
Llama 3.1 70B, 8-bit75.0 GB2.7 GB≈ 1–2 GB≈ 79 GB96 GB class

The examples use well-documented 2024 open models because their configurations and file sizes are published. The same arithmetic works for any newer model: read num_hidden_layers, num_key_value_heads and the head dimension from its config.json, and take the weight size from the file you'll actually run.

More users and longer documents

The KV cache is per conversation. Serve the 32B model above to eight people at once, each with 8K tokens of context, and the cache alone is about 8 × 2.15 = 17 GB, on top of 19.9 GB of weights. That's beyond any single 24 GB card. Summarising long PDFs has the same effect: one 32K-token request on the 70B model needs 10.7 GB of cache.

Serving engines such as vLLM allocate the cache in small pages (PagedAttention), so less memory is wasted and more users fit on the same GPUs. But the memory still has to exist. Multi-user sizing is the main reason teams move from a workstation to an AI server.

Image generation

  • Stable Diffusion 1.5-era models run in about 4–6 GB.
  • SDXL works from about 8 GB and is comfortable at 12 GB or more for 1024×1024 images, LoRAs and ControlNet.
  • FLUX.1 [dev] is a 12-billion-parameter model whose 16-bit weights file is 23.8 GB. With 8-bit (FP8) weights it needs roughly half that. Its text encoders add more, though tools such as ComfyUI can keep them in system RAM.
  • Video generation models vary widely. The larger ones need 24 GB or more.

Fine-tuning

  • Full fine-tuning with the Adam optimiser in mixed precision needs about 16 bytes per parameter for weights, gradients and optimiser states, before activations. For an 8B model that's about 128 GB, which means multiple GPUs.
  • LoRA freezes the base model and trains small adapter matrices. You mainly need memory for the 16-bit base weights (about 16 GB for 8B) plus activations.
  • QLoRA keeps the base model in 4-bit. It brings a 7–8B fine-tune within reach of a single 16–24 GB GPU, and its authors fine-tuned a 65B model on a single 48 GB GPU.

One big GPU or several smaller ones?

For inference, splitting a model across GPUs works well. llama.cpp places layers on different cards and vLLM uses tensor parallelism. Two 24 GB cards can hold the 46 GB 70B example above, with each card carrying its own overhead. Most current consumer GPUs have no NVLink, so the cards talk over PCIe. That's fine for inference but slows training jobs that exchange a lot of data between GPUs.

For training, or when you want the simplest setup, fewer GPUs with more memory each are usually better. Our GPU workstations page compares consumer and professional cards.

Don't forget system RAM and storage

  • System RAM: at least as much as total VRAM, ideally double. It's used for loading models, holding offloaded parts and preparing data.
  • Storage: fast NVMe, with room for several model files. The 70B example is 42.5 GB at 4-bit and 75 GB at 8-bit.

Quick sizing checklist

  1. Choose the largest model and the precision you'll run, and take its file size.
  2. Add the KV cache: per-token size × context length × simultaneous users.
  3. Add about 1 GB per GPU for overhead, then 10–20% headroom.
  4. Round up to the next real VRAM tier: 16, 24, 32, 48 or 96 GB and up.
  5. Check whether image generation or fine-tuning needs more than inference.
  6. Size system RAM, storage, power and cooling to match.

If you'd rather not do the arithmetic, send us your workload and we'll return the calculation with a recommended configuration.

Sources

  1. Meta Llama 3.1 8B: model card and configuration (Hugging Face)
  2. Meta Llama 3.1 70B: model card and configuration (Hugging Face)
  3. Qwen2.5-14B-Instruct: configuration (Hugging Face)
  4. Qwen2.5-32B-Instruct: configuration (Hugging Face)
  5. GGUF file sizes: Llama 3.1 8B Instruct (bartowski, Hugging Face)
  6. GGUF file sizes: Llama 3.1 70B Instruct (bartowski, Hugging Face)
  7. GGUF file sizes: Qwen2.5 14B Instruct (bartowski, Hugging Face)
  8. GGUF file sizes: Qwen2.5 32B Instruct (bartowski, Hugging Face)
  9. FLUX.1 [dev]: model card and files (Black Forest Labs, Hugging Face)
  10. Dettmers et al., QLoRA: Efficient Finetuning of Quantized LLMs (2023)
  11. Rajbhandari et al., ZeRO: Memory Optimizations Toward Training Trillion Parameter Models (2019)
  12. Kwon et al., Efficient Memory Management for LLM Serving with PagedAttention (vLLM, 2023)
  13. llama.cpp (ggml-org, GitHub)