LLM VRAM Calculator & GPU Sizing Guide
Calculate precise VRAM requirements, KV cache overhead, and distributed cluster topologies for hosting large language models like Llama 3.1, DeepSeek, and Qwen across NVIDIA A100, H100, and H200 accelerators.
Free LLM VRAM Calculator
Calculate precise GPU memory requirements for inference, full fine-tuning, and LoRA training. Plan your cluster architecture accurately for Llama 3.1, DeepSeek, Qwen, and custom models across modern NVIDIA accelerators.
Model and Workload Parameters
VRAM Breakdown
Denpex Developer Tools
Install the Denpex VS Code and Open VSX extension with over 2,000 active installs for real-time diagnostics. Decode offline browser logs instantly with our GPU log analyzer.
Hardware Cluster Sizing and GPU Recommendations
Estimated minimum GPU count required to host 163 GB VRAM safely with headroom for concurrency.
| GPU Accelerator | VRAM per GPU | Required Count | Estimated Utilization |
|---|---|---|---|
| NVIDIA H100 | 80 GB | 3 GPUs | 68% |
| NVIDIA H200 | 141 GB | 2 GPUs | 58% |
| NVIDIA A100 | 80 GB | 3 GPUs | 68% |
| NVIDIA B200 | 192 GB | 1 GPU | 85% |
| NVIDIA L40S | 48 GB | 4 GPUs | 85% |
| NVIDIA RTX 4090 | 24 GB | 7 GPUs | 97% |
Under the Hood: LLM Memory Calculation Formulas
Accurate GPU memory planning requires accounting for three distinct consumption vectors: static model parameter weights, dynamic KV cache allocation during inference, and temporary activation workspace memory.
1. Weight Memory
Model weights consume memory directly proportional to active parameter count and quantization precision.
- FP16 / BF16: 2 bytes
- FP8 (E4M3 / E5M2): 1 byte
- INT4 / GPTQ: 0.5 bytes
2. KV Cache Memory
Key-value cache scales dynamically based on concurrent request batch size and sequence length.
High context windows like 128k tokens can easily consume hundreds of gigabytes under heavy concurrent load.
3. Overhead & Headroom
Framework buffers, CUDA graphs, and workspace allocations require safety margins.
Allocating a 20 percent buffer prevents out-of-memory errors during peak inference spikes.
Cluster Topologies: Tensor Parallelism vs Pipeline Parallelism
When a single GPU lacks sufficient VRAM to hold model weights or KV cache, model parallelism distributes the workload across multiple accelerators. Choosing the right parallel strategy is critical for maximizing tokens per second while minimizing inter-GPU communication bottlenecks.
Tensor Parallelism (TP)
Tensor parallelism splits individual weight matrices across multiple GPUs within the same high-speed NVLink domain. Because synchronization occurs frequently during matrix multiplications, TP is typically restricted to 4 or 8 GPUs per node.
- Best for: Low latency generation on single nodes.
- Hardware requirement: NVLink interconnect (900 GB/s on H100).
- Common configurations: TP 2, TP 4, TP 8.
Pipeline Parallelism (PP)
Pipeline parallelism divides sequential model layers across multiple nodes. Stage 1 processes early layers and passes intermediate activations to stage 2 on the next node, accommodating massive models that exceed single-node memory limits.
- Best for: Extremely large models like 405B or MoE variants.
- Hardware requirement: InfiniBand or high speed Ethernet clusters.
- Common configurations: PP 2, PP 4, PP 8.
Recommended Hardware Configurations for 70B and 405B Models
Deploying frontier models requires balancing memory capacity against memory bandwidth. Below are validated production deployment topologies for popular open weight architectures.
| Model Scale | Precision | Minimum VRAM | Recommended Cluster |
|---|---|---|---|
| Llama 3.1 70B | FP16 | 160 GB | 2x H100 (80GB) or 1x H200 (141GB with quantization buffer) |
| Llama 3.1 70B | FP8 | 85 GB | 1x H100 (80GB) with strict context limits or 1x H200 (141GB) |
| Llama 3.1 405B | FP8 | 450 GB | 8x H100 (80GB) with TP 8 |
| Llama 3.1 405B | FP16 | 850 GB | 32x A100 / H100 with TP 8 and PP 4 |
Frequently Asked Questions
How does KV cache memory scale with batch size and context window?
KV cache memory scales linearly with context length and batch size, calculated as 2 multiplied by the number of layers, number of key-value heads, head dimension, batch size, context length, and bytes per parameter precision. For long context windows like 128k tokens, the KV cache frequently exceeds model parameter memory during high concurrency inference.
What is activation memory and how does it impact training versus inference?
Activation memory stores intermediate tensor outputs during the forward pass so gradients can be computed during backpropagation. During inference, activation memory is minimal and bounded by batch size and maximum sequence length, whereas during training it dominates peak VRAM consumption, often requiring activation checkpointing or recomputation.
What are the trade-offs between FP16, FP8, and INT4 precision?
FP16 offers full baseline precision requiring 2 bytes per parameter with zero quantization loss. FP8 cuts weight memory in half using 1 byte per parameter with negligible perplexity degradation when using scales like E4M3 or E5M2. INT4 quantizes weights to 0.5 bytes per parameter, yielding massive memory savings for serving large models on smaller GPU counts, though it requires specialized kernel support and careful calibration.
How do you determine tensor parallel and pipeline parallel splits for 70B and 405B models?
Tensor parallelism splits individual weight matrices across GPUs within a single high speed NVLink node (typically TP 4 or TP 8) to minimize communication latency. Pipeline parallelism divides model layers across multiple nodes when a single node cannot fit the weights or KV cache. For a 405B model in FP16 requiring over 800GB of VRAM, a combination of tensor parallel 8 and pipeline parallel 4 across a 32 GPU cluster is standard.
Related Resources & Tools
A100 vs H100 vs H200
Compare memory bandwidth, FP8 FLOPS, and interconnect speeds.
GPU Log Analyzer
Diagnose CUDA OOM errors and driver panics from raw logs.
Failure Archive
Post-mortems on distributed training and inference outages.
OpenVSX Registry
Browse open extension registry stats and extension safety audits.