Llama 3.1 8B VRAM requirements
Llama 3.1 8B needs about 6.58 GB of VRAM at Q4_K_M with 8K context, so it fits an 8 GB card such as the RTX 4060 8GB. Llama 3.1 8B has 8.0B parameters. With the same 8K context and one request it needs 9.83 GB at FP8 and 18.1 GB at FP16/BF16. The published weights take 15.0 GB (BF16). The smallest setup here that holds it at Q4_K_M with an 8K context is the RTX 4060 8GB; on one 24 GB RTX 3090 / 4090 it runs with its full 128K-token context.
6.58 GB at Q4_K_M, 8K context, one request
- FP8
- 9.83 GB
- FP16 / BF16
- 18.1 GB
- Published weights
- 15.0 GB
- Smallest setup, Q4_K_M
- RTX 4060 8GB
Worked example: Llama 3.1 8B with 32K tokens
Inputs: Llama 3.1 8B · Q4_K_M weights · 32,768 tokens of context · one request · FP16 KV cache
- Weights (8.0B at Q4_K_M)
- 4.52 GB
- KV cache (128 KB per token)
- 4.00 GB
- Buffers and runtime (0.5 GB + 10%)
- 1.35 GB
- Total
- 9.88 GB
The smallest setup here that holds it is the RTX 3060 12GB, with about 2.12 GB to spare. Change the inputs in the calculator
Can I run Llama 3.1 8B on…
- RTX 4090: Yes, up to BF16
- RTX 3090: Yes, up to BF16
- RTX 5090: Yes, up to BF16
- RTX 3060 12GB: Yes, up to Q5_K_M
- RTX 4060 Ti 16GB: Yes, up to Q8_0
- RTX 5060 Ti 16GB: Yes, up to Q8_0
- RTX 4070 12GB: Yes, up to Q5_K_M
- RTX 5080 16GB: Yes, up to Q8_0
- RTX 4080 Super 16GB: Yes, up to Q8_0
- RX 7900 XTX: Yes, up to BF16
What makes Llama 3.1 8B's memory use different
Per token of context it adds 128 KB of FP16 cache; Qwen3 8B (8.2B), the nearest-sized model here with plain full attention, adds 144 KB, so Llama 3.1 8B needs 11% less.
How much VRAM does Llama 3.1 8B need?
Llama 3.1 8B needs 6.58 GB at Q4_K_M, 10.3 GB at Q8_0 and 18.1 GB at FP16 with 8,192 tokens of context and one request. Each total below is the weights plus the FP16 KV cache and the runtime overhead (0.5 GB plus 10%), and each row opens the calculator with that setting. What the GGUF names mean.
| Precision | Weights | Total | Smallest setup |
|---|---|---|---|
| As published (BF16) | 15.0 GB | 18.1 GB | RTX 3090 (24 GB) |
| FP16 / BF16 | 15.0 GB | 18.1 GB | RTX 3090 (24 GB) |
| FP8 / INT8 | 7.48 GB | 9.83 GB | RTX 3060 12GB |
| INT4 (AWQ / GPTQ) | 3.97 GB | 5.97 GB | RTX 4060 8GB |
| GGUF Q8_0 | 7.95 GB | 10.3 GB | RTX 3060 12GB |
| GGUF Q6_K | 6.13 GB | 8.35 GB | RTX 3060 12GB |
| GGUF Q5_K_M | 5.30 GB | 7.43 GB | RTX 4060 8GB |
| GGUF Q4_K_M | 4.52 GB | 6.58 GB | RTX 4060 8GB |
| GGUF IQ4_XS | 4.07 GB | 6.07 GB | RTX 4060 8GB |
| GGUF Q3_K_M | 3.66 GB | 5.62 GB | RTX 4060 8GB |
| GGUF IQ3_XXS | 3.08 GB | 4.99 GB | RTX 4060 8GB |
| GGUF Q2_K | 3.13 GB | 5.04 GB | RTX 4060 8GB |
Fine-tuning Llama 3.1 8B? Llama 3.1 8B VRAM for LoRA, QLoRA and full training.
Llama 3.1 8B GGUF files on Hugging Face
The 7 GGUF files llama.cpp picks for Llama 3.1 8B with -hf <repo>:<QUANT>, with the bytes the Hugging Face file list reported on 2026-09-29. Each total is that file plus the FP16 KV cache and 0.5 GB + 10%, one request. "vs estimate" compares the file with the bits-per-weight size the table above uses.
| Quant | File | Size | vs estimate | 8K | 32K | 128K |
|---|---|---|---|---|---|---|
| Q2_K | bartowski/ | 2.96 GB3,179,136,416 bytes | −5% | 4.86 GB | 8.16 GB | 21.4 GB |
| Q3_K_M | bartowski/ | 3.74 GB4,018,922,912 bytes | +2% | 5.72 GB | 9.02 GB | 22.2 GB |
| IQ4_XS | bartowski/ | 4.14 GB4,447,667,616 bytes | +2% | 6.16 GB | 9.46 GB | 22.7 GB |
| Q4_K_M | bartowski/ | 4.58 GB4,920,739,232 bytes | +1% | 6.64 GB | 9.94 GB | 23.1 GB |
| Q5_K_M | bartowski/ | 5.34 GB5,732,992,416 bytes | +1% | 7.47 GB | 10.8 GB | 24.0 GB |
| Q6_K | bartowski/ | 6.14 GB6,596,011,424 bytes | ±0% | 8.36 GB | 11.7 GB | 24.9 GB |
| Q8_0 | bartowski/ | 7.95 GB8,540,775,840 bytes | ±0% | 10.3 GB | 13.6 GB | 26.8 GB |
GB here is GiB (1024³ bytes), as everywhere on this site; Hugging Face shows the Q4_K_M file as 4.9 GB, in 10⁹ bytes.
Which Llama 3.1 8B GGUF fits a 16, 24, 32, 48 or 80 GB GPU or a Mac
From the file sizes above: the largest file that fits each machine with an 8K context and 0.5 GB left free, the longest context it then has room for, and the longest context for Q4_K_M (4.58 GB). One request, FP16 KV cache.
| Hardware | Largest GGUF, 8K | Its longest context | Q4_K_M, longest context |
|---|---|---|---|
| RTX 5060 Ti 16GB | Q8_0, 7.95 GB | 45K | 72K |
| RTX 4090 (24 GB) | Q8_0, 7.95 GB | 103K | 128K (full) |
| RTX 5090 (32 GB) | Q8_0, 7.95 GB | 128K (full) | 128K (full) |
| L40S (48 GB) | Q8_0, 7.95 GB | 128K (full) | 128K (full) |
| H100 SXM (80 GB) | Q8_0, 7.95 GB | 128K (full) | 128K (full) |
| M4 Pro Mac (64 GB, 48 GB usable) | Q8_0, 7.95 GB | 128K (full) | 128K (full) |
| M4 Max Mac (128 GB, 96 GB usable) | Q8_0, 7.95 GB | 128K (full) | 128K (full) |
Run Llama 3.1 8B with llama.cpp or Ollama
llama-server -hf bartowski/Meta-Llama-3.1-8B-Instruct-GGUF:Q4_K_M -c 131072 Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf, 4.9 GB, from bartowski/
ollama run llama3.1:8b
Ollama library tag llama3.1:8b; its quant is Ollama's choice. Same context: /set parameter num_ctx 131072.
Llama 3.1 8B at 8K, 32K and 128K (full) tokens of context
All 32 layers use full attention. Each extra token of context adds 128 KB of FP16 cache per request. The last column is the smallest setup here, one card or a group, that holds it at Q4_K_M. How the KV cache works.
| Context | KV cache, FP16 | Total at Q4_K_M | Total at Q8_0 | Smallest setup, Q4_K_M |
|---|---|---|---|---|
| 8K tokens | 1.00 GB | 6.58 GB | 10.3 GB | RTX 4060 8GB |
| 32K tokens | 4.00 GB | 9.88 GB | 13.6 GB | RTX 3060 12GB |
| 128K tokens | 16.0 GB | 23.1 GB | 26.8 GB | RTX 3090 (24 GB) |
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.
| Hardware | Bandwidth | Q4_K_M | FP8 |
|---|---|---|---|
| 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 Llama 3.1 8B fits on a single card with one request, an FP16 KV cache and 0.5 GB left free. "Full" means the model's whole context window fits.
| GPU | Memory | Q4_K_M | Q8_0 | FP8 |
|---|---|---|---|---|
| RTX 3060 | 12 GB | 43K | 16K | 20K |
| RTX 4060 Ti 16GB | 16 GB | 72K | 45K | 49K |
| RTX 3090 / 4090 | 24 GB | 128K (full) | 103K | 107K |
| 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
Why this estimate looks this way
At Q4_K_M and an 8K-token context, Llama 3.1 8B uses 4.52 GB for weights, 1.00 GB for its FP16 KV cache and 1.05 GB for estimated runtime overhead, totaling 6.58 GB. The overhead is a 0.5 GB base plus 10% of weights and cache.
The architecture and published checkpoint size come from the model's config.json and weight files. These are estimates rather than measured peak memory; inference engines can reserve extra buffers or preallocate the full configured cache.
Llama 3.1 8B next to similar-sized models
The three models here closest to it in parameter count, at Q4_K_M with 8,192 tokens of context.
| Model | Parameters | Total | KV per token | Smallest setup |
|---|---|---|---|---|
| Llama 3.1 8B | 8.0B | 6.58 GB | 128 KB | RTX 4060 8GB |
| Gemma 4 E4B | 8.0B | 5.64 GB | 16 KB | RTX 4060 8GB |
| Ling 3.0 Tiny 7.9B-A1.3B | 7.9B, 1.3B active | 5.45 GB | 7 KB | RTX 4060 8GB |
| Qwen3 8B | 8.2B | 6.81 GB | 144 KB | RTX 4060 8GB |
Llama 3.1 8B VRAM questions
How much VRAM do I need to run Llama 3.1 8B locally?
About 6.58 GB at Q4_K_M with an 8K context and one request, by the bits-per-weight estimate, and 18.1 GB at BF16. The Q4_K_M GGUF Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf in bartowski/
Can I run Llama 3.1 8B on a 24 GB GPU?
Yes. On the RTX 4090 (24 GB), the largest listed GGUF that fits with an 8K context and 0.5 GB free is Q8_0 (7.95 GB), with up to 103K tokens of context. Q4_K_M (4.58 GB) runs with its full 128K-token context.
Which quantization of Llama 3.1 8B fits in 16 GB of VRAM?
On the RTX 5060 Ti 16GB, the largest listed GGUF that fits with an 8K context and 0.5 GB free is Q8_0 (7.95 GB), with up to 45K tokens of context. Q4_K_M (4.58 GB) runs with up to 72K tokens of context.
Can I run Llama 3.1 8B on a Mac?
On the M4 Pro Mac (64 GB, 48 GB usable), the largest listed GGUF that fits with an 8K context and 0.5 GB free is Q8_0 (7.95 GB), with its full 128K-token context. On the M4 Max Mac (128 GB, 96 GB usable), the largest listed GGUF that fits with an 8K context and 0.5 GB free is Q8_0 (7.95 GB), with its full 128K-token context. By default macOS lets the GPU use about 75% of unified memory.
How much more VRAM does Llama 3.1 8B need for 32K or 128K tokens of context?
Its FP16 KV cache is 1.00 GB at 8K, 4.00 GB at 32K, 16.0 GB at 128K for one request, so 128K adds 15.0 GB over 8K, plus 10% overhead. A q8_0 cache
Why does Llama 3.1 8B use more VRAM than its GGUF file size?
The file holds only the weights. At Q4_K_M with an 8K context: 4.58 GB of weights (the file's 4,920,739,232 bytes) + 1.00 GB of FP16 KV cache + 1.06 GB of compute buffers and runtime (0.5 GB + 10%) = 6.64 GB.
Badge for your model card
Paste it into a Hugging Face or GitHub README; it shows the Q4_K_M total above and links to this page. Q8_0 and FP16 badges.
Numbers read from the model files on Hugging Face on . Compare it with other models in the reproducible model and GPU report.