TechCompare LogoTechCompare

How much VRAM does Llama 3.1 405B need at Q4_K_M? Multi-GPU planning

405B local inference is achievable but not cheap. The minimum viable rig is around $30-50K of hardware, which only makes sense for serious research, regulated environments that prohibit cloud inference, or pure curiosity. For nearly every other use case, paying per-token to a hosted endpoint wins.

Llama 3.1 405B at Q4_K_M needs roughly 324 GB of VRAM at its native 128K context. That's a highly professional datacenter configuration.

By TechCompare · Updated

Total VRAM required
324 GB
Llama 3.1 405B at Q4_K_M
Weights
227 GB
405B params
KV cache
67.6 GB
128K tokens, FP16 KV

Calculator

Estimated VRAM required

324 GB

405B params at Q4_K_M, 131,072 token context, batch 1, inference.

Weights
227 GB
KV cache
67.6 GB
Overhead
29.4 GB

Estimate accuracy: Weights within ~2%. KV cache within ~5% for standard GQA models, ~10% for MLA (DeepSeek). Real VRAM may vary with framework (vLLM vs llama.cpp vs Transformers), Flash Attention, and driver overhead.

Hardware that fits

No single GPU in our catalog has enough memory. Multi-GPU or CPU offload required.

Just barely too small

NVIDIA B300
Datacenter
288 GB
short by 35.9 GB

How this is calculated

Q4_K_M weights take about 226.8 GB. KV cache adds another 67.7 GB at 128K context, with overhead pushing the total to 324 GB.

Verdict

The 324 GB resident total arrives from 226.8 GB of Q4 weights, 67.7 GB of FP16 KV cache at the full 128K context, and 29.5 GB of overhead. Hardware-wise that lines up as four A100 80GB cards in NVLink, three H100 80GB, or a single MI300X 192 GB with reduced context. A Mac Studio with 256 GB or 512 GB of unified memory also works at lower throughput, since prompt processing hits CPU but token generation stays usable. The economics almost never pencil out for self-hosting once you run against hosted 405B-instance pricing in fractions of a cent per thousand tokens: the self-host route earns its keep only for data residency, offline operation, or custom fine-tuning, which is the niche that justifies the $30-50K hardware spend.

More Llama scenarios

DeepSeek V4 Pro 1.6T (MoE) at Q4_K_M
DeepSeek V4 Pro 1.6T at Q4_K_M with the full 1M-token context needs about 1012 GB of VRAM with every expert resident - this is the real shape of the model and the number to plan a deployment against.
View details ➜
Llama 4 Scout (17B/109B) at Q4_K_M
Llama 4 Scout at Q4_K_M with its native 10M context needs about 2231 GB of VRAM with all 109B params resident - that's the number you size hardware against.
View details ➜
gpt-oss 20B (MoE) at Q4_K_M
gpt-oss 20B at Q4_K_M with native 128K context needs about 19.4 GB of VRAM with all experts resident, dropping to roughly 9.3 GB with active-only weight loading.
View details ➜

Frequently asked questions

What's the minimum hardware for 405B at Q4?
Four A100 80GB cards in NVLink is the entry-level professional setup. A single Mac Studio with 256 GB or 512 GB unified memory also works, with slower prompt processing but tolerable token generation speeds.
Is running 405B locally worth it vs the API?
Almost never on cost alone. Hosted APIs price 405B inference at fractions of a cent per thousand tokens. Self-host only when the workload requires data residency, offline operation, or custom fine-tuning.
What's the minimum hardware to run Llama 3.1 405B at Q4?
About 228 GB of VRAM resident, which fits on a single MI300X (192 GB) with some headroom if you reduce context, or roughly 3× 80 GB H100 cards with tensor parallelism. Active-only drops the footprint significantly. For most teams the hosted API is dramatically cheaper than self-hosting 405B - the local route only pays off for data residency or bit-exact reproducibility.
When does self-hosting 405B beat paying for the API?
When you have a compliance need that rules out sending data to a third party, or when your volume is so consistently high that the amortized GPU cost beats per-token pricing. The rough crossover is hundreds of millions of tokens a month sustained for over a year, plus the engineering time to run the cluster. Below that, hosted 405B-class APIs win on both cost and operational burden.