Llama 3.1 8B Instruct — Requisiti VRAM, matrice di quantizzazione e guida GPU
Llama 3.1 8B Instruct (Meta Llama, Llama 3.1 Community) adotta un’architettura Transformer denso con 8.03B parametri residenti (8.03B attivi per token), 32 livelli e Attenzione a query raggruppate (GQA) con supporto fino a 131,072 token di contesto.
Simulatore interattivo di memoria e contesto per Llama 3.1 8B Instruct
Matrice VRAM per precisione e quantizzazione (contesto 8K / 32K / 128K)
| Precisione / Formato | bpw effettivi | Solo pesi | Totale @ ctx 8K | Totale @ ctx 32K | Totale @ ctx 128K | Fascia consigliata (@ 32K) |
|---|---|---|---|---|---|---|
| FP16 / BF16 | 16.00 bpw | 14.96 GB | 17.55 GB | 20.55 GB | 32.55 GB | RTX 3090 24GB |
| FP8 | 8.50 bpw | 7.95 GB | 10.32 GB | 13.32 GB | 25.32 GB | RTX 4060 Ti 16GB |
| Q8_0 | 8.50 bpw | 7.95 GB | 10.32 GB | 13.32 GB | 25.32 GB | RTX 4060 Ti 16GB |
| Q6_K | 6.56 bpw | 6.13 GB | 8.46 GB | 11.46 GB | 23.46 GB | RTX 3060 12GB |
| Q5_K_M | 5.69 bpw | 5.32 GB | 7.62 GB | 10.62 GB | 22.62 GB | RTX 3060 12GB |
| Q4_K_M | 4.85 bpw | 4.53 GB | 6.81 GB | 9.81 GB | 21.81 GB | RTX 3060 12GB |
| AWQ INT4 | 4.50 bpw | 4.21 GB | 6.47 GB | 9.47 GB | 21.47 GB | RTX 3060 12GB |
| IQ4_XS | 4.25 bpw | 3.97 GB | 6.23 GB | 9.23 GB | 21.23 GB | RTX 3060 12GB |
Compatibilità hardware e velocità di decodifica (Llama 3.1 8B Instruct @ Q4_K_M, contesto 32K)
| Fascia hardware | Memoria e banda | Richiesta (32K) | Compatibilità | Velocità decod. stimata |
|---|---|---|---|---|
| RTX 3090 24GB | 24 GB · 936 GB/s | 9.81 GB (41%) | Entra comodamente | 63.9 tok/s |
| RTX 4090 24GB | 24 GB · 1008 GB/s | 9.81 GB (41%) | Entra comodamente | 68.8 tok/s |
| RTX 5090 32GB | 32 GB · 1792 GB/s | 9.81 GB (31%) | Entra comodamente | 122.3 tok/s |
| Apple M-Max 64GB | 64 GB · 546 GB/s | 9.40 GB (15%) | Entra comodamente | 35.1 tok/s |
| Mac Studio 128GB | 128 GB · 546 GB/s | 9.40 GB (7%) | Entra comodamente | 35.1 tok/s |
| Mac Studio 192GB | 192 GB · 800 GB/s | 9.40 GB (5%) | Entra comodamente | 51.4 tok/s |
| NVIDIA A100 80GB | 80 GB · 2039 GB/s | 9.81 GB (12%) | Entra comodamente | 147.4 tok/s |
| NVIDIA H100 80GB | 80 GB · 3350 GB/s | 9.81 GB (12%) | Entra comodamente | 242.2 tok/s |
Parametri verificati dell’architettura Transformer
- Checkpoint ID
- meta-llama/Llama-3.1-8B-Instruct
- Ollama Tag
- llama3.1:8b
- License / Release
- Llama 3.1 Community · 2024-Q3
- Topologia e attenzione
- Transformer denso
- Meccanismo di attenzione
- Attenzione a query raggruppate (GQA)
- Parametri totali (B)
- 8.03B
- Parametri attivi / token (B)
- 8.03B
- Livelli nascosti / Dimensione nascosta
- 32 / 4096
- Teste di query / Teste KV
- 32Q / 8KV (d=128)
- Vocab / Max Position
- 128,256 / 131,072
I formati quantizzati memorizzano fattori di scala per blocco e zero-point accanto ai pesi interi compatti. Un checkpoint GGUF Q4_K_M a 4 bit richiede in media 4.85 bit effettivi per parametro (non 4.00), mentre Q8_0 si attesta a 8.50 bpw. Nei modelli Mixture-of-Experts, tutti gli esperti instradati e condivisi restano residenti in memoria per evitare il paging dall’host a ogni token.
La Grouped-Query Attention standard alloca 2 × L × H_kv × d_head × S × B × bytes_kv lungo i livelli. La Multi-head Latent Attention di DeepSeek (MLA) comprime chiavi e valori in L × (d_kv_lora + d_qk_rope) × S × B × bytes_kv, riducendo di oltre il 90% la memoria sui contesti lunghi. I modelli ibridi a finestra scorrevole limitano i livelli di attenzione locale a min(S, window_size) facendo scalare linearmente con S quelli globali.
Comandi rapidi vLLM e Ollama per Llama 3.1 8B Instruct
vllm serve meta-llama/Llama-3.1-8B-Instruct \
--tensor-parallel-size 1 \
--max-model-len 32768 \
--max-num-seqs 8 \
--gpu-memory-utilization 0.95 \
--kv-cache-dtype fp8 \
--enable-prefix-caching \
--port 8000
# Save as Modelfile, then run: ollama create llama-3-1-8b-custom -f Modelfile
FROM llama3.1:8b
PARAMETER num_ctx 32768
PARAMETER num_batch 512
PARAMETER flash_attn true
# Environment variables for ollama serve:
# OLLAMA_NUM_PARALLEL=8 OLLAMA_FLASH_ATTENTION=1 OLLAMA_KV_CACHE_TYPE=q8_0 ollama serve
Confronta modelli affini e di scala simile a pesi aperti
Llama 3.3 70B Instruct
Meta Llama · 70.6B (GQA)
Llama 4 Scout (109B / 17B-16E MoE)
Meta Llama · 109B (HYBRID_SWA)
Llama 4 Maverick (400B / 17B-128E MoE)
Meta Llama · 402B (GQA)
Llama 3.1 405B Instruct
Meta Llama · 405B (GQA)
Qwen3-8B
Qwen · 8.2B (GQA)
GLM-4-9B-0414
Zhipu GLM · 9.4B (GQA)