Llama 3.1 8B VRAM requirements

Llama 3.1 8B has 8.0B parameters. With an 8K-token context and one request it needs about 6.58 GB of GPU memory at Q4_K_M, 9.83 GB at FP8 and 18.1 GB at FP16/BF16. The published weights take 15.0 GB (BF16). On one 24 GB RTX 3090 / 4090 it runs at Q4_K_M with its full 128K-token context.

Open Llama 3.1 8B in the calculator

VRAM by quantization

Weights plus the KV cache for 8,192 tokens in FP16 and the runtime overhead (0.5 GB plus 10%). Each row opens the calculator with that setting. What the GGUF names mean.

PrecisionWeightsTotalSmallest setup
As published (BF16) 15.0 GB 18.1 GB RTX 3090 / 4090
FP16 / BF16 15.0 GB 18.1 GB RTX 3090 / 4090
FP8 / INT8 7.48 GB 9.83 GB RTX 3060
INT4 (AWQ / GPTQ) 3.97 GB 5.97 GB RTX 3060
GGUF Q8_0 7.95 GB 10.3 GB RTX 3060
GGUF Q6_K 6.13 GB 8.35 GB RTX 3060
GGUF Q5_K_M 5.30 GB 7.43 GB RTX 3060
GGUF Q4_K_M 4.52 GB 6.58 GB RTX 3060
GGUF Q3_K_M 3.66 GB 5.62 GB RTX 3060
GGUF Q2_K 3.13 GB 5.04 GB RTX 3060

KV cache at long context

All 32 layers use full attention. Each extra token of context adds 128 KB of FP16 cache per request. How the KV cache works.

ContextKV cache, FP16KV cache, FP8Total at Q4_K_M
4K tokens 512 MB 256 MB 6.03 GB
32K tokens 4.00 GB 2.00 GB 9.88 GB
128K tokens 16.0 GB 8.00 GB 23.1 GB

Which GPUs can run Llama 3.1 8B

With 8,192 tokens of context. Several GPUs means one tensor-parallel group of 2, 4 or 8 cards.

GPUMemoryQ4_K_MFP8
RTX 3060 12 GB Fits on one Fits on one
RTX 4060 Ti 16GB 16 GB Fits on one Fits on one
RTX 3090 / 4090 24 GB Fits on one Fits on one
RTX 5090 32 GB Fits on one Fits on one
A100 40GB 40 GB Fits on one Fits on one
Mac, 64 GB unified memory about 75% of it is usable by the GPU by default 48 GB Fits on one Fits on one
L40S / RTX 6000 Ada 48 GB Fits on one Fits on one
A100 / H100 80GB 80 GB Fits on one Fits on one
Mac, 128 GB unified memory about 75% of it is usable by the GPU by default 96 GB Fits on one Fits on one
H200 141 GB Fits on one Fits on one
B200 180 GB Fits on one Fits on one

How fast Llama 3.1 8B writes

Tokens per second for one request with 8,192 tokens of context, estimated from memory bandwidth. A dash means it does not fit on one card. Try other settings in the speed calculator.

HardwareBandwidthQ4_K_MFP8
RTX 3060 12GB 360 GB/s 32–45 21–29
RTX 4090 1,008 GB/s 82–120 56–80
RTX 5090 1,792 GB/s 133–204 93–137
M4 Max Mac (128 GB) 546 GB/s 47–67 31–44
M3 Ultra Mac Studio (512 GB) 819 GB/s 68–98 46–65
H100 SXM 3,350 GB/s 212–350 155–243
H200 4,800 GB/s 267–466 202–330

Longest context on one GPU

How many tokens of context fit on a single card with one request and an FP16 KV cache. "Full" means the model's whole context window fits.

GPUMemoryQ4_K_MQ8_0FP8
RTX 3060 12 GB 47K 19K 23K
RTX 4060 Ti 16GB 16 GB 76K 49K 52K
RTX 3090 / 4090 24 GB 128K (full) 107K 110K
RTX 5090 32 GB 128K (full) 128K (full) 128K (full)
A100 40GB 40 GB 128K (full) 128K (full) 128K (full)
Mac, 64 GB unified memory 48 GB 128K (full) 128K (full) 128K (full)
L40S / RTX 6000 Ada 48 GB 128K (full) 128K (full) 128K (full)
A100 / H100 80GB 80 GB 128K (full) 128K (full) 128K (full)
Mac, 128 GB unified memory 96 GB 128K (full) 128K (full) 128K (full)
H200 141 GB 128K (full) 128K (full) 128K (full)
B200 180 GB 128K (full) 128K (full) 128K (full)

Model details

Parameters
8.0B (8,030,261,248)
Layers
All 32 layers use full attention
Attention cache
8 KV heads × 128
Context length
131,072 tokens
Published weights
15.0 GB (BF16)
On Hugging Face
meta-llama/Llama-3.1-8B-Instruct

Other models

Numbers read from the model files on Hugging Face on .