How much does it cost to fine-tune an LLM with LoRA?
LoRA trains a small adapter on top of a frozen model, so it needs far less GPU memory than full fine-tuning. On rented GPUs at today's prices, a LoRA run of 10 million tokens costs about $1.03 for an 8B model and $4.06 for a 27B model. A 70B model costs $13.35 with QLoRA on one GPU. Below you'll find how much memory LoRA, QLoRA and full fine-tuning need, how long a run takes on each GPU and what it costs.
- Llama 3.1 8B · LoRA
- $1.031× L40S · 1.2 h · 10M tokens
- Qwen3.8-27B · QLoRA
- $4.371× L40S · 5.7 h · 10M tokens
- Llama 3.3 70B · QLoRA
- $13.351× H100 · 5.5 h · 10M tokens
- Llama 3.1 8B · full
- $2.092× A100 80GB · 59 min · 10M tokens
How much GPU memory LoRA, QLoRA and full fine-tuning need
Each method's memory, and the smallest GPU that holds it.
| Model | QLoRA 4-bit base | LoRA BF16 base | Full fine-tune BF16, AdamW |
|---|---|---|---|
| Llama 3.1 8B 8.03B dense | 11 GB 1× 24 GB | 21 GB 1× 24 GB | 133 GB 1× 141 GB |
| Gemma 4 12B 12B dense | 13 GB 1× 24 GB | 30 GB 1× 32 GB | 197 GB 2× 141 GB |
| Qwen3.8-27B 27.8B dense | 26 GB 1× 32 GB | 63 GB 1× 80 GB | 451 GB 4× 141 GB |
| Gemma 4 31B 31.3B dense | 26 GB 1× 32 GB | 71 GB 1× 80 GB | 507 GB 4× 141 GB |
| Llama 3.3 70B 70.55B dense | 52 GB 1× 80 GB | 154 GB 1× 180 GB | 1,138 GB 8× 180 GB |
Calculated for LoRA rank 16 on every linear layer, 4,096 tokens per micro-batch, gradient checkpointing and a fused loss (details in the method below). The smallest setup is counted in GPU memory: 24 GB = RTX 3090 or 4090, 32 GB = RTX 5090, 48 GB = L40S, 80 GB = A100 or H100, 96 GB = RTX PRO 6000, 141 GB = H200, 180 GB = B200. Full fine-tuning splits the model and optimizer state across GPUs with FSDP or DeepSpeed ZeRO-3.
- Full fine-tuning updates every weight. With AdamW in mixed precision, each parameter takes 16 bytes: the BF16 weight and gradient, an FP32 master copy and two FP32 optimizer moments. Before activations, an 8B model needs about 130 GB and a 70B model more than 1 TB.
- LoRA freezes the model and trains small adapters. Two thin matrices sit next to each linear layer. At rank 16 they hold 0.3–0.6% of the parameters: 42 million for Llama 3.1 8B. Memory is about the BF16 model plus a few GB, and the result is an adapter file of a few hundred MB instead of a full copy of the model.
- QLoRA stores the frozen model in 4-bit. bitsandbytes NF4 cuts the base model to about a quarter of its size, and the same LoRA adapters train on top. In the QLoRA paper this matched 16-bit LoRA quality on standard benchmarks. That is how a 70B model fits on one 80 GB GPU and a 27–31B model on a 32 GB RTX 5090.
What one fine-tuning run costs today
The cheapest GPU setup that fits each model and method, for 10 million training tokens: for example 5,000 examples of 700 tokens trained for 3 epochs.
| Model · method | GPU memory | Cheapest setup today | Training time | Cost of the run |
|---|---|---|---|---|
| Llama 3.1 8B QLoRA | 11 GB | 1× L40S | 1.6 h | $1.37 |
| Llama 3.1 8B LoRA | 21 GB | 1× L40S | 1.2 h | $1.03 |
| Llama 3.1 8B Full fine-tune | 133 GB | 2× A100 80GB | 59 min | $2.09 |
| Gemma 4 12B QLoRA | 13 GB | 1× L40S | 2.6 h | $2.08 |
| Gemma 4 12B LoRA | 30 GB | 1× L40S | 1.8 h | $1.53 |
| Gemma 4 12B Full fine-tune | 197 GB | 4× A100 80GB | 47 min | $3.51 |
| Qwen3.8-27B QLoRA | 26 GB | 1× L40S | 5.7 h | $4.37 |
| Qwen3.8-27B LoRA | 63 GB | 1× H100 | 1.5 h | $4.06 |
| Qwen3.8-27B Full fine-tune | 451 GB | 8× A100 80GB | 52 min | $7.58 |
| Gemma 4 31B QLoRA | 26 GB | 1× L40S | 6.7 h | $5.12 |
| Gemma 4 31B LoRA | 71 GB | 1× H100 | 1.8 h | $4.69 |
| Gemma 4 31B Full fine-tune | 507 GB | 8× A100 80GB | 1.0 h | $8.64 |
| Llama 3.3 70B QLoRA | 52 GB | 1× H100 | 5.5 h | $13.35 |
| Llama 3.3 70B LoRA | 154 GB | 4× A100 80GB | 3.4 h | $12.43 |
| Llama 3.3 70B Full fine-tune | 1,138 GB | 8× B200 | 19 min | $39.75 |
Cost = (training time + 15 minutes to download, load and save) × number of GPUs × typical marketplace price on 5 Dec 2026. Training time assumes the GPU spends 30% of its peak BF16 compute on useful work; see the method. Multi-GPU setups are one server with 2–8 GPUs.
- Small models cost about a dollar per run. Llama 3.1 8B costs $1.03 with LoRA on 1× L40S. Even full fine-tuning costs only $2.09 on 2× A100 80GB. At this size the GPU bill is the smallest part of the project. Preparing the data and evaluating the results take the time.
- QLoRA saves memory, not time. Each step dequantizes the 4-bit weights, so a run takes about 1.4× longer than LoRA. QLoRA pays off when it lets you use a smaller GPU. Llama 3.3 70B costs $13.35 with QLoRA on 1× H100 (5.5 h) and $12.43 with LoRA on 4× A100 80GB (3.4 h). For Llama 3.1 8B, whose 16-bit weights fit on any 24 GB card, LoRA is the cheaper option today.
- The real cost of full fine-tuning is memory. Per token, full fine-tuning needs only about a third more compute than LoRA: 8 FLOPs per parameter instead of 6. The problem is the 16 bytes per parameter. Qwen3.8-27B needs 451 GB, which means 8× A100 80GB, and Llama 3.3 70B needs 8× 180 GB. Short runs are still affordable when such a server is available, but each run saves a full copy of the model.
- Cost grows with the number of tokens. Twice the data or twice the epochs costs twice as much. Budget for 3–5 runs while you tune the learning rate, rank and number of epochs.
Cost and time of a run on each GPU
One GPU, 10 million training tokens: cost of the run and training time. The framed cell is the cheapest GPU for that model; “–” means it does not fit on one GPU.
| GPU · BF16 compute | Typical price | Llama 3.1 8B QLoRA | Llama 3.1 8B LoRA | Gemma 4 12B LoRA | Qwen3.8-27B QLoRA | Qwen3.8-27B LoRA | Llama 3.3 70B QLoRA |
|---|---|---|---|---|---|---|---|
| RTX 3090 24 GB · 71 TFLOPS | $0.22/hr | $1.83 8.2 h | $1.32 5.9 h | – | – | – | – |
| RTX 4090 24 GB · 165 TFLOPS | $0.47/hr | $1.77 3.5 h | $1.30 2.5 h | – | – | – | – |
| RTX 5090 32 GB · 210 TFLOPS | $0.67/hr | $2.02 2.8 h | $1.49 2.0 h | $2.29 3.2 h | $6.73 9.8 h | – | – |
| L40S 48 GB · 362 TFLOPS | $0.73/hr | $1.37 1.6 h | $1.03 1.2 h | $1.53 1.8 h | $4.37 5.7 h | – | – |
| RTX PRO 6000 96 GB · 468 TFLOPS | $1.60/hr | $2.40 1.2 h | $1.83 53 min | $2.68 1.4 h | $7.46 4.4 h | $5.44 3.1 h | $18.89 12 h |
| A100 80GB 80 GB · 312 TFLOPS | $0.84/hr | $1.79 1.9 h | $1.34 1.3 h | $2.01 2.1 h | $5.78 6.6 h | $4.19 4.7 h | $14.81 17 h |
| H100 80 GB · 989 TFLOPS | $2.33/hr | $1.96 35 min | $1.57 25 min | $2.16 40 min | $5.46 2.1 h | $4.06 1.5 h | $13.35 5.5 h |
| H200 141 GB · 989 TFLOPS | $4.73/hr | $3.97 35 min | $3.18 25 min | $4.37 40 min | $11.05 2.1 h | $8.23 1.5 h | $27.03 5.5 h |
| B200 180 GB · 2,250 TFLOPS | $8.75/hr | $4.46 16 min | $3.81 11 min | $4.78 18 min | $10.21 55 min | $7.92 39 min | $23.21 2.4 h |
BF16 compute is the dense tensor throughput with FP32 accumulation, as used in training. Sources: NVIDIA's RTX Blackwell whitepaper for the GeForce cards and NVIDIA datasheets for the rest. NVIDIA publishes no BF16 figure for the RTX PRO 6000 Server Edition, so we estimate it from its SM count and boost clock. Typical marketplace prices on 5 Dec 2026.
The cost of a run is similar across GPUs, because faster GPUs cost more per hour. At today's prices the L40S gives the most BF16 compute per dollar, followed by the H100. The bigger difference is time. GeForce cards compute BF16 with FP32 accumulation at half rate: an RTX 4090 has 165 TFLOPS against 989 on an H100, so the same run takes about 6× longer. Pick the GPU by memory first, then by how long you are willing to wait. Interruptible instances cost less still if you save checkpoints.
How we calculate memory and time
GPU memory ≈ frozen base model (BF16: 2 bytes per parameter; NF4: ≈0.52, embeddings stay BF16)
+ trainable parameters × 16 bytes (only the adapters for LoRA)
+ activations (one saved input per layer with gradient checkpointing,
plus one layer's working memory)
+ ≈1.5 GB CUDA and framework overhead
training time ≈ tokens × 6 × parameters ÷ (BF16 TFLOPS × 30%)
(8 × parameters for full fine-tuning; × 1.4 for QLoRA)
- Inputs. We take the layers, hidden size, MLP size, attention heads and vocabulary from each model's
config.jsonon Hugging Face. The BF16 size is the real size of the weight files. - Setup. LoRA rank 16 on all linear layers, AdamW with FP32 states for the adapters, 4,096 tokens per micro-batch on each GPU (two packed sequences of 2,048), gradient checkpointing and Flash Attention. A model “fits” when the estimate stays under 95% of GPU memory.
- Use a fused loss. Without one, the logits of a 4,096-token micro-batch take about 10 bytes per token for each vocabulary entry. That is 5 GB more for Llama (128K vocabulary) and 11 GB more for Gemma 4 (262K).
use_liger_kernel=Truein TRL or Unsloth avoids this. - Shorter batches fit smaller GPUs. Activations grow with tokens per micro-batch. With 2,048 tokens, QLoRA of Qwen3.8-27B and Gemma 4 31B only just fits on a 24 GB card. Gradient accumulation keeps the effective batch size the same.
- Speed. We assume the GPU spends 30% of its peak BF16 tensor compute on useful work. That is typical for LoRA with gradient checkpointing in Hugging Face TRL. Unsloth and well-tuned runs get more; short unpacked examples get less. QLoRA dequantizes weights on every step, so we count it 1.4× slower. 2–8 GPUs in one server scale at 90%.
These numbers are calculated, not measured. Expect real runs to land within about ±50% of the estimate, depending on the framework, sequence length and data. For inference memory, see the VRAM calculator.
A LoRA run with Hugging Face TRL, served with vLLM
On a rented GPU with a PyTorch template, install trl peft bitsandbytes liger-kernel flash-attn and prepare train.jsonl with one chat per line ({"messages": [...]}). For QLoRA, set qlora = True:
import torch
from datasets import load_dataset
from peft import LoraConfig
from transformers import AutoModelForCausalLM, BitsAndBytesConfig
from trl import SFTConfig, SFTTrainer
base = "meta-llama/Llama-3.1-8B-Instruct"
qlora = False
model = AutoModelForCausalLM.from_pretrained(
base,
dtype=torch.bfloat16,
attn_implementation="flash_attention_2",
quantization_config=BitsAndBytesConfig(
load_in_4bit=True, bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True, bnb_4bit_compute_dtype=torch.bfloat16,
) if qlora else None,
)
trainer = SFTTrainer(
model=model,
train_dataset=load_dataset("json", data_files="train.jsonl", split="train"),
peft_config=LoraConfig(r=16, lora_alpha=32, lora_dropout=0.05,
target_modules="all-linear", task_type="CAUSAL_LM"),
args=SFTConfig(
output_dir="out",
num_train_epochs=3,
learning_rate=2e-4,
per_device_train_batch_size=2,
gradient_accumulation_steps=8,
max_length=2048,
packing=True,
gradient_checkpointing=True,
bf16=True,
use_liger_kernel=True,
logging_steps=10,
),
)
trainer.train()
trainer.save_model("out/adapter")
vLLM serves the adapter next to the base model, with no merge step. Several adapters can share one GPU:
vllm serve meta-llama/Llama-3.1-8B-Instruct \
--enable-lora --max-lora-rank 16 \
--lora-modules support-bot=out/adapter
Requests with "model": "support-bot" use the adapter; the base model name still works without it. To serve the model on a GPU, see the model guides for Qwen3.8-27B and Gemma 4, and what self-hosting costs per month.
Which GPU to rent for fine-tuning
- 7–12B models: one 24–48 GB GPU. LoRA on an RTX 4090 ($0.47/hr), an RTX 5090 or an L40S ($0.73/hr) costs about $1–3 per 10M tokens. The RTX 3090 ($0.22/hr) is the cheapest per hour but the slowest. Gemma 4 12B needs 32 GB for LoRA or 24 GB for QLoRA.
- 27–31B models: QLoRA on 32–48 GB, or LoRA on 80 GB. QLoRA fits an RTX 5090 or L40S; LoRA in 16-bit fits one A100 80GB ($0.84/hr) or H100 ($2.33/hr). Qwen3.8-27B costs $4.06 per run with LoRA on 1× H100.
- 70B models: QLoRA on one 80 GB GPU or LoRA on several. A QLoRA run takes 17 h and $14.81 on an A100, or 5.5 h and $13.35 on an H100. LoRA on 4× A100 80GB costs $12.43 and takes 3.4 h.
- Full fine-tuning: only when adapters are not enough. Examples are teaching a new language or a big domain shift with a lot of data. It needs servers with 2–8 data-center GPUs from 12B up, and each run produces a full model copy to store and serve.
Want it fine-tuned and in production?
We prepare the dataset, run and evaluate the fine-tuning, and deploy the result as an API with vLLM, monitoring and 24/7 support. You pay the GPU provider directly, with no markup; we charge only for engineering.
Get a free fine-tuning planHow much VRAM inference needs →
A100 vs H100 vs H200 vs B200 →
RTX 5090 vs 4090 vs 3090 →
Fine-tuning cost questions
How much does it cost to fine-tune Llama 3.1 8B?
About $1.03 per 10 million training tokens with LoRA on 1× L40S at today's prices, including 15 minutes of setup. Training takes about 1.2 h. On an RTX 4090 the same run takes 2.5 h and $1.30; on an H100 it takes 25 min and $1.57. A typical dataset of a few thousand examples trained for 3 epochs is 2–20 million tokens.
What GPU do I need for LoRA fine-tuning?
Enough memory for the base model in 16-bit plus a few GB. That is a 24 GB card for 7–8B models (21 GB for Llama 3.1 8B), 32 GB for Gemma 4 12B (30 GB) and an 80 GB GPU for 27–31B models (63 GB for Qwen3.8-27B). With QLoRA the same models need about a third to a half of that.
Can I fine-tune on an RTX 4090?
Yes, up to about 12B. Llama 3.1 8B fits with LoRA in 16-bit (21 GB), and 10M tokens take 2.5 h and $1.30. Gemma 4 12B fits with QLoRA (13 GB). 27–31B models need QLoRA with short micro-batches of about 2,048 tokens, which only just fits in 24 GB. An RTX 5090 with 32 GB is more comfortable.
How much VRAM do I need to fine-tune a 70B model?
About 52 GB with QLoRA, which fits one 80 GB A100 or H100. With LoRA in 16-bit it is about 154 GB: two H100s, four A100s or one B200. Full fine-tuning needs about 1,138 GB across 8× 180 GB. A QLoRA run of 10 million tokens costs $13.35 on 1× H100 today.
Is QLoRA worse than LoRA?
Usually not by much. The QLoRA paper matched 16-bit LoRA and full fine-tuning results on standard benchmarks with NF4 and double quantization. The trade-off is speed: dequantizing on every step makes training about 1.3–1.5× slower. When the 16-bit model fits on a GPU you can afford, use LoRA. When it doesn't, QLoRA gets the job done on a smaller GPU.
How long does LoRA fine-tuning take?
It depends on the number of tokens, the model size and the GPU's compute. For 10 million tokens, an 8B model takes 1.3 h and $1.34 on an A100 and 25 min and $1.57 on an H100. A 27B model takes 1.5 h and $4.06 on an H100, and a 70B model with QLoRA takes 5.5 h and $13.35. Time grows in proportion to the number of tokens and epochs.
Can I serve a LoRA adapter without merging it?
Yes. vLLM loads adapters next to the base model with --enable-lora --lora-modules name=path, and each request picks the adapter by model name. Several adapters can share one GPU and one copy of the base model, so serving costs about the same as the base model alone. The same trick lets you canary a new adapter with no extra GPUs. You can also merge the adapter into the weights with PEFT's merge_and_unload() and serve the result as a normal model.