Llama 3.1 8B architecture and license
Llama 3.1 8B Instruct is a dense text model that Meta released on 23 July 2024, alongside 70B and 405B versions. The model card lists a 128K context window and grouped-query attention. Hugging Face counts 8,030,261,248 parameters in its BF16 safetensors.
The config.json sets 32 layers, a hidden size of 4,096, 32 query heads, 8 key-value heads and a head dimension of 128. With only 8 KV heads cached, the KV cache is a quarter of what full multi-head attention would need. The vocabulary has 128,256 tokens, and the input embedding and output layer are separate matrices, which together hold about 1.05 billion of the parameters.
The Llama 3.1 Community License allows commercial use. Services with more than 700 million monthly active users must request a license from Meta.
| Property | Llama 3.1 8B Instruct | Source |
|---|---|---|
| Parameters | 8.03B (dense) | Hugging Face safetensors count |
| Layers | 32 | config.json |
| Attention heads / KV heads | 32 / 8 (GQA) | config.json |
| Head dimension | 128 | config.json |
| Context length | 131,072 tokens (128K) | Model card, config.json |
| Native precision | BF16 | config.json |
| License | Llama 3.1 Community License | Model card |
References: Llama 3.1 8B Instruct model card · Llama 3.1 8B Instruct config.json
VRAM table: weights plus KV cache
Weights cost parameters times bytes per parameter: 2 in BF16, 1 in FP8 and about 0.5 at 4 bits plus scales. KV cache per token is 2 × 32 layers × 8 KV heads × 128 dimensions × 2 bytes, which is 131,072 bytes, or 0.13 MB, in BF16. An FP8 KV cache halves that.
The table assumes 32 concurrent requests at 8,192 tokens each: 262,144 cached tokens, which is 34.4 GB of BF16 cache. Notice that at this load the cache is twice the size of the BF16 weights. For a small model, concurrency and context length, not parameters, decide the GPU. Run your own numbers in the VRAM calculator, and read LLM VRAM requirements for the overhead terms.
Ollama’s published sizes line up with this math: 4.9 GB for the default q4_K_M build, 8.5 GB for q8_0 and 16 GB for fp16.
| Precision | Weights | KV cache (262,144 tokens) | Total before overhead |
|---|---|---|---|
| BF16 weights, BF16 KV | 16.1 GB | 34.4 GB | ≈50 GB |
| FP8 weights, FP8 KV | 8.0 GB | 17.2 GB | ≈25 GB |
| 4-bit weights, FP8 KV | 4.0 to 4.9 GB | 17.2 GB | ≈21 to 22 GB |
| BF16, one user at 8,192 tokens | 16.1 GB | 1.1 GB | ≈17 GB |
| BF16, one user at full 128K | 16.1 GB | 17.2 GB | ≈33 GB |
References: Llama 3.1 8B Instruct config.json · Ollama library: llama3.1 tags · vLLM quantized KV cache
Which GPU fits Llama 3.1 8B
Any single GPU from 24 GB up runs this model; the question is how many users it serves. FP8 needs compute capability 8.9 or newer for full-speed math, which includes RTX 4090, RTX 5090, L40S, Hopper and Blackwell. On A100, vLLM runs FP8 checkpoints as weight-only W8A16 through Marlin kernels.
Large GPUs like the H200 and B200 are more memory than one replica can use well. To fill them, run several replicas on one machine; vLLM’s data-parallel option does this, for example --data-parallel-size 4 on four GPUs. Splitting an 8B model across GPUs with tensor parallelism mostly adds communication; single GPU vs multi-GPU explains when it pays.
| GPU | Memory | Good fit for | Notes |
|---|---|---|---|
| RTX 4090 | 24 GB | BF16 for 1 to 4 users; FP8 for more | BF16 weights leave about 6 GB for cache |
| RTX 5090 | 32 GB | FP8 at the 32-user scenario | Blackwell consumer card, supports FP8 and FP4 |
| L40S | 48 GB | BF16 weights with FP8 KV cache | The BF16 scenario (≈50 GB) is just over |
| A100 80 GB / H100 80 GB | 80 GB | BF16 at the 32-user scenario | Room to raise concurrency further |
| RTX PRO 6000 | 96 GB | BF16 with long context | Several 128K requests at once |
| H200 / B200 | 141 / 180 GB | Multiple replicas | Use data parallelism, not tensor parallelism |
References: NVIDIA GeForce RTX 4090 specifications · NVIDIA GeForce RTX 5090 specifications · NVIDIA L40S specifications · NVIDIA A100 specifications · NVIDIA H100 specifications · NVIDIA H200 specifications · NVIDIA DGX B200 specifications · NVIDIA RTX PRO 6000 Blackwell specifications · vLLM FP8 W8A8 quantization · vLLM documentation: Data parallel deployment
Serve commands for vLLM, SGLang and Ollama
vLLM: vllm serve meta-llama/Llama-3.1-8B-Instruct --max-model-len 16384. The repository is gated, so accept the license on Hugging Face and export HF_TOKEN. Lowering --max-model-len from the default 131,072 lets vLLM plan for the requests you actually send. Add --kv-cache-dtype fp8 to halve cache memory.
For FP8, either serve a pre-quantized checkpoint such as nvidia/Llama-3.1-8B-Instruct-FP8, or let vLLM quantize the BF16 weights at load with --quantization fp8_per_tensor, which its docs say needs no calibration data. Deploy vLLM on a cloud GPU walks through Docker, ports and health checks.
SGLang: python -m sglang.launch_server --model-path meta-llama/Llama-3.1-8B-Instruct, which listens on port 30000 by default; --context-length and --kv-cache-dtype fp8_e4m3 work the same way. Ollama: ollama run llama3.1 pulls the 4.9 GB q4_K_M build, and llama3.1:8b-instruct-fp16 pulls the full-precision weights.
References: vLLM documentation: vllm serve CLI arguments · vLLM quantized KV cache · vLLM FP8 W8A8 quantization · NVIDIA Llama 3.1 8B Instruct FP8 checkpoint · SGLang server arguments · Ollama library: llama3.1 tags
Illustrative cost per hour and per million tokens
These figures are illustrative, not quotes or measurements. They assume $0.50 per hour for an RTX 4090, $1.00 for an L40S and $2.50 for an H100. Current NeuraMesh rates are on GPU prices.
Cost per million tokens is the hourly cost divided by tokens generated per hour, times one million. This guide does not quote throughput, because it swings with prompt length, output length and concurrency. Measure it with vllm bench serve using your real traffic shape, then read across. A cheap card only wins if your measured throughput on it stays high enough.
| GPU (assumed rate) | Per 1M tokens at 1,000 tok/s | At 2,500 tok/s | At 5,000 tok/s |
|---|---|---|---|
| RTX 4090 ($0.50/hour) | $0.14 | $0.06 | $0.03 |
| L40S ($1.00/hour) | $0.28 | $0.11 | $0.06 |
| H100 ($2.50/hour) | $0.69 | $0.28 | $0.14 |
References: vLLM serving benchmark options
Fine-tuning memory for Llama 3.1 8B
Full fine-tuning with mixed precision and AdamW needs about 18 bytes per parameter before activations, per Hugging Face’s training memory guide: 6 for weights, 8 for optimizer states and 4 for gradients. For 8.03B parameters that is about 145 GB. Use two 80 GB GPUs with FSDP or DeepSpeed sharding, or one 180 GB B200.
LoRA keeps the base model frozen in BF16 (16 GB) and trains small adapters, so a single L40S or 80 GB GPU handles it with room for activations; a 24 GB card works at short sequence lengths. QLoRA loads the base in 4 bits, about 5 GB, which makes an RTX 4090 comfortable. The QLoRA paper fine-tuned a 65B model on one 48 GB GPU, so 8B is well inside its range.
References: Hugging Face Transformers: GPU memory usage in training · Hugging Face PEFT: LoRA · QLoRA: Efficient Finetuning of Quantized LLMs
Llama 3.1 8B GPU requirements checklist
Decide concurrency and context first, since the cache outgrows the weights. Pick BF16 when quality baselines matter and FP8 when you need more users per GPU. Set --max-model-len to your real limit. Measure tokens per second before you choose between a consumer card and a data-center GPU.
NeuraMesh rents RTX 4090, L40S and H100 GPUs by the hour. Pick a GPU, plan, count, hours and region on rent GPUs and you get a confirmed quotation, typically within one business day, before any payment. Not sure which card fits? Ask the compute advisor.
NeuraMesh prices for these GPUs
| GPU | Memory | Data center | Value |
|---|---|---|---|
| RTX 4090 | 24 GB | $0.46 | $0.40 |
| L40S | 48 GB | $1.26 | $0.54 |
| A100 | 80 GB | $1.56 | $0.98 |
| H100 | 80 GB | $2.88 | $2.00 |
Every order is confirmed in a quotation before you pay. See all GPU prices.
Questions readers ask
What are the minimum Llama 3.1 8B GPU requirements?
A 4-bit build needs about 5 GB plus cache, so an 8 GB GPU runs it for one user at short context. For BF16, plan on a 24 GB card such as an RTX 4090, which leaves about 6 GB for KV cache.
Can an RTX 4090 run Llama 3.1 8B in full precision?
Yes. The BF16 weights take 16.1 GB of the 24 GB, leaving room for roughly 40,000 to 45,000 cached tokens after overhead. That suits a few users. Use FP8 weights and an FP8 KV cache to serve more.
How much VRAM does Llama 3.1 8B need for 128K context?
One request at the full 131,072 tokens needs 17.2 GB of BF16 KV cache on top of 16.1 GB of weights, about 33 GB before overhead. A 48 GB L40S or larger handles it; an FP8 cache halves the cache share.
How much GPU memory is needed to fine-tune Llama 3.1 8B?
Full fine-tuning needs about 145 GB before activations. LoRA needs roughly the 16 GB of BF16 weights plus activations, and QLoRA about 5 GB plus activations, which fits a 24 GB card.
Should I run Llama 3.1 8B in BF16 or FP8?
Use BF16 when you need a clean quality baseline or have memory to spare, since it is the precision Meta released. Use FP8 weights and an FP8 KV cache when you need more concurrent users per GPU; vLLM documents a 2x cut in weight memory. Compare outputs on your own evaluation set before switching.
Do I need an H100 for Llama 3.1 8B?
No. An H100 is useful for high concurrency or long contexts, but an L40S, RTX 5090 or RTX 4090 runs the model well for smaller loads. Measure tokens per second and cost per million tokens on each before choosing.
Sources and editorial notes
- Llama 3.1 8B Instruct model card
- Llama 3.1 8B Instruct config.json
- Ollama library: llama3.1 tags
- vLLM quantized KV cache
- NVIDIA GeForce RTX 4090 specifications
- NVIDIA GeForce RTX 5090 specifications
- NVIDIA L40S specifications
- NVIDIA A100 specifications
- NVIDIA H100 specifications
- NVIDIA H200 specifications
- NVIDIA DGX B200 specifications
- NVIDIA RTX PRO 6000 Blackwell specifications
- vLLM FP8 W8A8 quantization
- vLLM documentation: Data parallel deployment
- vLLM documentation: vllm serve CLI arguments
- NVIDIA Llama 3.1 8B Instruct FP8 checkpoint
- SGLang server arguments
- vLLM serving benchmark options
- Hugging Face Transformers: GPU memory usage in training
- Hugging Face PEFT: LoRA
- QLoRA: Efficient Finetuning of Quantized LLMs
Primary documentation reviewed November 24, 2026. Provider descriptions reflect published documentation. Recommendations are our analysis; worked figures are illustrative unless explicitly stated otherwise. No independent provider benchmark or uptime ranking is claimed.
Need this GPU? Rent it from NeuraMesh: choose a GPU and plan, get a confirmed quotation, and pay only when you approve. See pricing.


