← All posts

How much GPU do you need to run an LLM?

A practical rule of thumb for sizing GPU memory for large language models, with worked examples from 8B to 405B parameters.

The first question in almost every AI infrastructure project is "which GPUs, and how many?" The answer depends mostly on one number: GPU memory (VRAM). If the model and its working data don't fit, it won't run, or it will run painfully slowly.

Here is the rule of thumb our engineers use.

Step 1: memory for the model weights

Multiply the number of parameters by the bytes used for each one:

PrecisionBytes per parameter8B model70B model405B model
FP16 / BF16216 GB140 GB810 GB
FP8 / INT818 GB70 GB405 GB
4-bit (e.g. AWQ, GPTQ)about 0.54–5 GB35–40 GBabout 200 GB

Lower precision saves memory and usually speeds things up. For most business uses, a well-made FP8 or 4-bit version of a model gives answers very close to the original.

Step 2: memory for the KV cache

While generating text, the model stores attention data for every token in the conversation. This is the KV cache, and it grows with context length and the number of users served at once.

For each token, the KV cache needs roughly:

2 × layers × KV heads × head size × bytes per value

For a 70B model like Llama 3 70B (80 layers, 8 KV heads, head size 128) at FP16, that is about 0.33 MB per token. So:

  • one user with a 32,000-token context needs about 10 GB
  • 20 users with 8,000-token contexts each need about 52 GB

The KV cache is why a model that "fits" on paper can still run out of memory in production.

Step 3: add headroom

Add about 10–20% for the inference engine, activations and memory fragmentation. Engines such as vLLM reserve memory up front, so plan for the total.

Worked examples

WorkloadApproximate memoryGood fit on Mjenzi Cloud
8B model, FP16, internal chatbotabout 25 GB1× L40S (48 GB)
70B model, 4-bit, small teamabout 60 GB1× RTX PRO 6000 (96 GB)
70B model, FP8, 20 concurrent usersabout 140 GB2× H100 (188 GB)
70B model, FP16, high throughputabout 220 GB2× H200
405B model, FP8about 500 GB4× H200

These are starting points. Real throughput also depends on GPU speed, memory bandwidth, the inference engine, batch sizes and how long your prompts and answers are.

What about training and fine-tuning?

Training needs far more memory than inference. Full fine-tuning with the common Adam optimiser and mixed precision needs about 16 bytes per parameter before activations, so more than 1 TB for a 70B model. That means a multi-GPU cluster with a fast interconnect such as InfiniBand.

Parameter-efficient methods such as LoRA and QLoRA only train a small set of extra weights. They can fine-tune a 70B model on one or two large GPUs, which is why they are the usual choice for adapting models to your own data.

Try it with your own numbers

Our Server Sizing Configurator does this maths for you. Choose a model size, precision, context length and number of users, and it estimates the GPU memory and recommends GPU servers, with a spec sheet you can download. When you're ready to run it, you can rent the GPUs from us or buy your own servers, and we'll help you work out which is cheaper.

Talk to a Mjenzi engineer Questions about this post or your own cloud and AI plans? We reply within one business day.
← OlderData residency in Kenya, South Africa, Botswana and Australia: a practical guide
Keep reading

Introducing the Mjenzi Cloud Platform

In-country cloud for Africa and Australia. Use ours and pay monthly, or have us build the same cloud on hardware you own.

AnnouncementsCloudPartners

Data residency in Kenya, South Africa, Botswana and Australia: a practical guide

What the data protection laws in our four markets mean for where you host, and the questions to ask any cloud provider before you sign.

SovereigntyComplianceAfricaAustralia