LoRA (Low-Rank Adaptation) fine-tunes a language model by freezing its weights and training a small pair of matrices alongside each targeted layer. QLoRA (Quantized Low-Rank Adaptation) stores those frozen weights in 4 bits, cutting their memory to about a quarter of 16-bit, and dequantizes them in every forward and backward pass so a larger model can fit on the same GPU.
Only the small adapters train, so both methods need far less memory for gradients and optimizer state than full fine-tuning. Use LoRA when the 16-bit base fits, and QLoRA when memory forces a 4-bit base.
How LoRA works
LoRA freezes each targeted weight matrix and learns its update as the product of 2 thin matrices, B and A, with inner dimension rank r. Microsoft researchers introduced it in the 2021 LoRA paper.
A 4,096 by 4,096 matrix has about 16.8 million entries; a rank-16 update has 131,072, or 16 times (4,096 + 4,096). Starting B at zero means "∆W = BA is zero at the beginning of training". Against Adam on GPT-3 175B, LoRA "can reduce the number of trainable parameters by 10,000 times and the GPU memory requirement by 3 times".
Merging or serving a LoRA adapter
A LoRA adapter can merge into base weights with no extra serving computation, or stay separate so several adapters share 1 base model. vLLM serves per-request adapters, and models trained with Miles run on vLLM or SGLang.
Merging into a quantized base adds another quantization step. For quantization methods that support merging, PEFT "dequantizes the base weight, adds the adapter weights, and quantizes the result again".
LoRA rank, alpha and target layers
LoRA's 5 main settings control capacity and stability: rank, alpha, target layers, dropout and learning rate. Adapt every linear layer first, then size rank and learning rate for the task.
- Rank (r) sets capacity. On 7B LLaMA with Alpaca, QLoRA found rank "unrelated to final performance if LoRA is used on all layers". On code and math, a Columbia and Databricks study (below) found low ranks trailing full fine-tuning. Our Training API runs rank 128 (Qwen3.5 9B, asynchronous GRPO); the 0.5B script uses 16.
- Alpha scales updates by alpha divided by r. Set it once and tune learning rate: Microsoft left alpha fixed since with Adam "tuning α is roughly the same as tuning the learning rate if we scale the initialization appropriately".
- Target layers choose where adapters attach. QLoRA found "LoRA on all linear transformer block layers are required to match full finetuning performance"; PEFT's
all-linearcovers every linear layer except the output layer. - Dropout: in QLoRA's search, 0.05 was "useful for small models (7B, 13B), but not for larger models (33B, 65B)".
- Learning rate: LoRA's best rate runs about 10 times full fine-tuning's. On Llama 2 7B, LoRA Learns Less and Forgets Less found best rates of 5e-4 (code) and 2e-4 (math) for LoRA, against 5e-5 and 1e-5 for full fine-tuning. The script uses
2e-4.
How QLoRA works
QLoRA stores frozen base weights in 4 bits, trains LoRA adapters on top, and dequantizes base weights in every forward and backward pass. Tim Dettmers and colleagues at the University of Washington published QLoRA in 2023, saving enough memory "to finetune a 65B parameter model on a single 48GB GPU while preserving full 16-bit finetuning task performance":
- 4-bit NormalFloat (NF4), called "information theoretically optimal for normally distributed weights".
- Double quantization, which quantizes the quantization constants too, cutting overhead from 0.5 to 0.127 bits per parameter (about 4.127 bits in all).
- Paged optimizers, using NVIDIA unified memory to evict optimizer state to CPU RAM during gradient checkpointing spikes.
LoRA vs QLoRA
LoRA and QLoRA train identical adapters and differ in base storage. With a 16-bit base, LoRA steps are faster; QLoRA stores the base in 4 bits, adding dequantization work on each pass.
| LoRA | QLoRA | |
|---|---|---|
| Frozen base | 16-bit (bfloat16) | 4-bit NF4 with double quantization |
| Memory per frozen base parameter | 2 bytes | About 0.52 bytes (quantized layers) |
| Training time in Raschka's 7B test | 1.85 hours | 2.79 hours |
| GPU memory in that test | 21.33 GB | 14.18 GB |
| Quality in QLoRA's MMLU tests | 16-bit reference | Matched 16-bit reference |
| Extra library | None | bitsandbytes 0.46.1 or later |
| Use it when | Training with a 16-bit base fits on your GPU | Training fits only with a 4-bit base |
Is QLoRA faster than LoRA?
No, QLoRA is often slower than LoRA on a 16-bit base. People often assume lower precision runs faster. In practice, QLoRA stores frozen weights in 4 bits and dequantizes them to bfloat16 (as in the paper and script below) in every forward and backward pass.
In Sebastian Raschka's 2023 test on 7B Llama 2, LoRA took 1.85 hours (21.33 GB) and QLoRA took 2.79 hours (14.18 GB). The QLoRA paper reports no runtime loss against 16-bit full fine-tuning, a heavier baseline. Pick LoRA when the 16-bit base fits; use QLoRA when memory forces 4-bit.
Native low-precision training: FP8 and FP4
Native low-precision training (FP8 and FP4) is distinct from QLoRA: matrix multiplications run directly in low precision, which can make training faster and leaner on GPU memory, depending on the hardware and recipe. QLoRA dequantizes its 4-bit weights to the compute dtype (16-bit here) every pass; native FP8 and FP4 run selected matrix multiplications in low precision.
Newer chips gain the most. NVIDIA Blackwell GPUs (B200, B300) beat Hopper (H100) on compute and low-precision efficiency. For RL at scale, we train on Miles (SGLang rollouts, Megatron-LM, FSDP2 or torchtitan training), which supports MXFP8 and NVFP4 RL on Blackwell.
How much GPU memory LoRA and QLoRA need
Before adapters, activations and unquantized layers, LoRA needs 2 bytes per parameter (16-bit base) and QLoRA needs about 0.52 bytes (4.127 bits). Full fine-tuning with mixed-precision Adam needs 16 bytes per parameter for weights, gradients and optimizer state by ZeRO's count.
| Model size | Full fine-tuning: weights, gradients and Adam state | LoRA: frozen 16-bit base | QLoRA: frozen 4-bit base |
|---|---|---|---|
| 7B | 112 GB | 14 GB | 3.6 GB |
| 32B | 512 GB | 64 GB | 16.5 GB |
| 70B | 1,120 GB | 140 GB | 36.1 GB |
| 120B | 1,920 GB | 240 GB | 61.9 GB |
ZeRO's 16 bytes is the highest count cited here. The QLoRA paper puts 16-bit full fine-tuning of 65B above 780 GB (over 12 bytes per parameter), and the LoRA paper reports 1.2 TB for GPT-3 175B (about 7 bytes).
What comes on top of the frozen weights
Adapter state, activations and unquantized layers sit above the frozen-weight floor. Budget for all 3 before sizing GPUs.
- Adapter state: PEFT keeps adapter weights in float32 on both 16-bit and 4-bit bases, so Adam uses 16 bytes per parameter (4 weight, 4 gradient, 8 for 2 moments).
- Activations grow with sequence length and batch size. Plain Hugging Face
Trainerleaves activation checkpointing (gradient checkpointing in older docs and the QLoRA paper) off;activation_checkpointing=Truetrades compute for memory. On our 0.5B test (1.13 GB base plus adapter arithmetic), peak MPS memory hit 1.80 GB off (1.82 GB over 3 epochs) and 1.41 GB on. - Unquantized layers under QLoRA:
bitsandbytesreplaces linear layers and Transformers leaves the output layer unquantized, keeping embeddings, norms and output out of 4-bit. On disk in bfloat16, a 4-bit Llama 3.1 8B checkpoint holds 1.05 billion bfloat16 parameters (5.7 GB vs 4.1 GB by the formula; 39.5 GB vs 36.4 GB for 70B). In training,prepare_model_for_kbit_trainingcasts them to float32 (adding about 3.5 bytes per unquantized parameter over the 4.127-bit column) and turns on checkpointing.
Which GPU you need for LoRA or QLoRA
Pick a GPU that clears the frozen base with headroom for adapters, unquantized layers and activations. The table checks self-serve GPUs on Lambda's public price list.
| GPU at Lambda | Memory | Price per GPU hour | LoRA: 16-bit base fits | QLoRA: 4-bit base fits |
|---|---|---|---|---|
| NVIDIA A6000 | 48 GB | $1.09 | 7B | 7B, 32B, 70B |
| NVIDIA GH200 | 96 GB | $2.59 | 7B, 32B | 7B to 120B |
| NVIDIA H100 PCIe | 80 GB | $3.79 | 7B, 32B | 7B to 120B |
| NVIDIA B200 SXM6 | 180 GB | $7.99 | 7B to 70B | 7B to 120B |
| 8 NVIDIA H100 (HGX) | 640 GB in all | $4.59, or $36.72 for 8 | 7B to 120B (70B and 120B split across GPUs) | 7B to 120B |
Multi-GPU sharding and RL vs SFT compute
RL usually needs more GPUs than SFT: about half run rollouts and half train, while SFT trains on every GPU. Our Training API uses that split, running asynchronous GRPO (Qwen3.5 9B, LoRA rank 128, 64K context) on 2 H100s: 1 sampler and 1 trainer.
Models above 1 GPU shard with FSDP or ZeRO stage 3, or train on Miles (SGLang rollouts with Megatron-LM, FSDP2 or torchtitan). Faster GPUs can cost less per run: Blackwell (B200, B300) beats Hopper on compute and low-precision efficiency, so measure throughput on each card.
How much LoRA fine-tuning costs
GPU cost equals hourly price times GPUs times training hours. Compute hours from tokens per epoch, epochs and measured tokens per second on your target GPU:
- Count tokens after chat templating and truncation (
MAX_LENGTH = 1024below; the script prints tokens per epoch). Truncation cuts the end of a long example, so the reply loses its last tokens first. An example whose prompt fills all 1,024 tokens keeps no reply tokens to train on, so drop it or raiseMAX_LENGTH. - Run a short timed test on your target GPU with your data and batch size (replacing
num_train_epochswithmax_stepspast the slow first step) to measure non-padding tokens per second. - Hours = tokens per epoch × epochs ÷ tokens per second ÷ 3,600.
- Cost = hours × price per GPU hour × GPUs, for each planned run.
A worked cost example
Assume 10,000 examples averaging 600 tokens (6 million tokens per epoch) over 3 epochs, or 18 million tokens total. Assume a timed run measured 2,500 tokens per second. That takes 7,200 seconds (2 hours), costing $7.58 on 1 H100 PCIe at $3.79 an hour.
What a run costs us
A typical LoRA run of ours on Qwen3.5 9B uses 2 H100s for about 4 hours and costs us about $50. That covers roughly 500M tokens of SFT and 50 RL steps at about 120 seconds a step.
A LoRA fine-tuning script with Transformers and PEFT
Run LoRA SFT directly in Hugging Face transformers (Trainer) and peft, plus datasets and accelerate. The script fine-tunes Qwen/Qwen2.5-0.5B-Instruct with rank-16 adapters on every linear layer except the output layer, masking prompt labels to -100 so loss covers only the final reply.
We tested it on November 23, 2026 on an Apple M4 Pro Mac (48 GB unified memory, PyTorch MPS) with PyTorch 2.15.0, Transformers 5.23.0, PEFT 0.21.3, Datasets 5.2.0 and Accelerate 1.16.0. The data was 32 synthetic support-ticket triage chats (2,273 tokens per epoch).
Running the printed script unchanged for 3 epochs completed 48 steps (exit 0, mean loss 0.1214, peak memory 1.82 GB). Swap in your model and train.jsonl; on NVIDIA, bf16=True needs an Ampere or newer GPU, and earlier assistant turns in multi-turn chats count as prompt.
# pip install torch==2.15.0 transformers==5.23.0 peft==0.21.3 datasets==5.2.0 accelerate==1.16.0import torchfrom datasets import load_datasetfrom peft import LoraConfig, get_peft_modelfrom transformers import ( AutoModelForCausalLM, AutoTokenizer, DataCollatorForSeq2Seq, Trainer, TrainingArguments,) MODEL = "Qwen/Qwen2.5-0.5B-Instruct" # small enough for a laptop; put your base model hereMAX_LENGTH = 1024 # longer examples are cut to this many tokens tokenizer = AutoTokenizer.from_pretrained(MODEL)model = AutoModelForCausalLM.from_pretrained(MODEL, dtype=torch.bfloat16) lora = LoraConfig( r=16, # adapter rank lora_alpha=32, # the update is scaled by lora_alpha / r lora_dropout=0.05, target_modules="all-linear", # every linear layer except the output layer task_type="CAUSAL_LM",)model = get_peft_model(model, lora) # freezes the base weights and adds the adaptersmodel.print_trainable_parameters() def tokenize(example): # The last message is the assistant's reply; everything before it is the prompt. prompt = tokenizer.apply_chat_template(example["messages"][:-1], tokenize=False, add_generation_prompt=True) full = tokenizer.apply_chat_template(example["messages"], tokenize=False) assert full.startswith(prompt), "the prompt must render as the start of the full chat" prompt_ids = tokenizer(prompt, add_special_tokens=False)["input_ids"] reply_ids = tokenizer(full[len(prompt):], add_special_tokens=False)["input_ids"] # A label of -100 gets no loss, so only the reply's tokens are trained on input_ids = (prompt_ids + reply_ids)[:MAX_LENGTH] labels = ([-100] * len(prompt_ids) + reply_ids)[:MAX_LENGTH] return {"input_ids": input_ids, "labels": labels} # 1 chat per line: {"messages": [{"role": "user", "content": "..."}, {"role": "assistant", "content": "..."}]}train = load_dataset("json", data_files="train.jsonl", split="train")train = train.map(tokenize, remove_columns=train.column_names) args = TrainingArguments( output_dir="lora-out", learning_rate=2e-4, per_device_train_batch_size=2, num_train_epochs=3, bf16=True, # on NVIDIA, needs an Ampere or newer GPU logging_steps=1, save_strategy="no", # the adapter is saved once, at the end include_num_input_tokens_seen="non_padding", # counts tokens for the speed figure below)trainer = Trainer( model=model, args=args, train_dataset=train, data_collator=DataCollatorForSeq2Seq(tokenizer), # pads each batch, with -100 for padded labels)result = trainer.train() per_second = trainer.state.num_input_tokens_seen / result.metrics["train_runtime"]dataset_tokens = sum(len(ids) for ids in train["input_ids"])print(f"{per_second:.0f} tokens per second, {dataset_tokens:,} tokens per epoch")print(f"about {dataset_tokens / per_second / 60:,.1f} minutes per epoch at this speed")print(f"peak memory {torch.accelerator.max_memory_allocated() / 1e9:.2f} GB")model.save_pretrained("lora-out") # saves only the adapter
A 10-step copy (max_steps=10 replacing num_train_epochs=3) exited 0 with loss from 0.4732 to 0.1069 and 1.80 GB peak memory. Below are its last 6 lines (progress bars and warnings omitted); treat tokens per second as a format check only, since busy-machine runs varied and step 1 includes warm-up.
{'loss': '0.1272', 'grad_norm': '2.542', 'learning_rate': '4e-05', 'epoch': '0.5625', 'num_input_tokens_seen': 1268, 'train_runtime': '7.012', 'train_tokens_per_second': '180.8'}{'loss': '0.1069', 'grad_norm': '2.28', 'learning_rate': '2e-05', 'epoch': '0.625', 'num_input_tokens_seen': 1407, 'train_runtime': '7.429', 'train_tokens_per_second': '189.4'}{'train_runtime': '7.432', 'train_samples_per_second': '2.691', 'train_steps_per_second': '1.346', 'train_loss': '0.2617', 'epoch': '0.625', 'num_input_tokens_seen': 1407}189 tokens per second, 2,273 tokens per epochabout 0.2 minutes per epoch at this speedpeak memory 1.80 GB
What the run measured and when to use Miles
The run added 8,798,208 trainable parameters (1.75% of 502,830,976): r times (input + output) across 7 linear layers in 24 blocks. Saving wrote 35 MB (lora-out/adapter_model.safetensors, float32, 336 tensors), which reloads via PeftModel.from_pretrained.
Plain Trainer leaves activation checkpointing off, pushing the 10-step peak to 1.80 GB against the 1.13 GB arithmetic floor. Adding activation_checkpointing=True cut it to 1.41 GB on a 10-step draft run. It recomputes activations on the backward pass, so expect slower steps.
These counts assume dense models: on mixture-of-experts models, bitsandbytes quantizes linear layers only. With Transformers 5, PEFT 0.21.3 can skip the dense MLP layers and shared experts in affected MoE models while still adapting routed experts and attention projections (PEFT 0.22.0 lists a fix), so check trainable parameters and peak memory. Trainer and PEFT suit small SFT checks; for RL with LoRA at scale, we use Miles.
The QLoRA variant
QLoRA adds bitsandbytes (0.50.2; Transformers 5.23.0 requires 0.46.1 or later), 4-bit NF4 BitsAndBytesConfig (double quantization, bfloat16 compute) and prepare_model_for_kbit_training. That casts embeddings, norms and output to float32 and enables checkpointing; PEFT keeps adapters float32. Paged optimizers stay off, and on NVIDIA, bfloat16 needs an Ampere or newer GPU.
We did not train this QLoRA variant end to end. On the Mac, Transformers put the 4-bit model on the bitsandbytes CPU backend while Trainer picked MPS, so a training step would say nothing about a GPU run. With bitsandbytes 0.50.2 the script compiled, loaded the 4-bit NF4 base, ran prepare_model_for_kbit_training, attached 8,798,208 float32 adapter parameters (0.759 GB model footprint at that point) and built Trainer, stopping before trainer.train(). Run it once on an NVIDIA GPU with the pinned versions before relying on it.
# QLoRA: the LoRA script with the frozen base in 4 bits. Run it on an NVIDIA GPU (Ampere or newer for bf16).# pip install torch==2.15.0 transformers==5.23.0 peft==0.21.3 datasets==5.2.0 accelerate==1.16.0 bitsandbytes==0.50.2import torchfrom datasets import load_datasetfrom peft import LoraConfig, get_peft_model, prepare_model_for_kbit_trainingfrom transformers import ( AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, DataCollatorForSeq2Seq, Trainer, TrainingArguments,) MODEL = "Qwen/Qwen2.5-0.5B-Instruct" # small enough for a laptop; put your base model hereMAX_LENGTH = 1024 # longer examples are cut to this many tokens tokenizer = AutoTokenizer.from_pretrained(MODEL)bnb = BitsAndBytesConfig( load_in_4bit=True, bnb_4bit_quant_type="nf4", # 4-bit NormalFloat bnb_4bit_use_double_quant=True, # quantize the quantization constants too bnb_4bit_compute_dtype=torch.bfloat16, # dequantize to bf16 for each matrix multiplication)model = AutoModelForCausalLM.from_pretrained(MODEL, quantization_config=bnb, dtype=torch.bfloat16)# Casts the layers left unquantized (norms, embeddings, output layer) to float32# and turns on activation checkpointingmodel = prepare_model_for_kbit_training(model) lora = LoraConfig( r=16, # adapter rank lora_alpha=32, # the update is scaled by lora_alpha / r lora_dropout=0.05, target_modules="all-linear", # every linear layer except the output layer task_type="CAUSAL_LM",)model = get_peft_model(model, lora) # freezes the base weights and adds the adaptersmodel.print_trainable_parameters() def tokenize(example): # The last message is the assistant's reply; everything before it is the prompt. prompt = tokenizer.apply_chat_template(example["messages"][:-1], tokenize=False, add_generation_prompt=True) full = tokenizer.apply_chat_template(example["messages"], tokenize=False) assert full.startswith(prompt), "the prompt must render as the start of the full chat" prompt_ids = tokenizer(prompt, add_special_tokens=False)["input_ids"] reply_ids = tokenizer(full[len(prompt):], add_special_tokens=False)["input_ids"] # A label of -100 gets no loss, so only the reply's tokens are trained on input_ids = (prompt_ids + reply_ids)[:MAX_LENGTH] labels = ([-100] * len(prompt_ids) + reply_ids)[:MAX_LENGTH] return {"input_ids": input_ids, "labels": labels} # 1 chat per line: {"messages": [{"role": "user", "content": "..."}, {"role": "assistant", "content": "..."}]}train = load_dataset("json", data_files="train.jsonl", split="train")train = train.map(tokenize, remove_columns=train.column_names) args = TrainingArguments( output_dir="qlora-out", learning_rate=2e-4, per_device_train_batch_size=2, num_train_epochs=3, bf16=True, # on NVIDIA, needs an Ampere or newer GPU logging_steps=1, save_strategy="no", # the adapter is saved once, at the end include_num_input_tokens_seen="non_padding", # counts tokens for the speed figure below)trainer = Trainer( model=model, args=args, train_dataset=train, data_collator=DataCollatorForSeq2Seq(tokenizer), # pads each batch, with -100 for padded labels)result = trainer.train() per_second = trainer.state.num_input_tokens_seen / result.metrics["train_runtime"]dataset_tokens = sum(len(ids) for ids in train["input_ids"])print(f"{per_second:.0f} tokens per second, {dataset_tokens:,} tokens per epoch")print(f"about {dataset_tokens / per_second / 60:,.1f} minutes per epoch at this speed")print(f"peak memory {torch.accelerator.max_memory_allocated() / 1e9:.2f} GB")model.save_pretrained("qlora-out") # saves only the adapter
How much data you need to fine-tune an LLM
Diversity and response quality beat raw volume, and 1,000 curated examples can go far. In LIMA (2023), Meta AI and university researchers fine-tuned a 65B LLaMa model on "only 1,000 carefully curated prompts and responses".
In LIMA's human study, responses were "either equivalent or strictly preferred to GPT-4 in 43% of cases". Its ablations found that "scaling up input diversity and output quality have measurable positive effects, while scaling up quantity alone might not".
Treat 1,000 as a reference point: train on 25%, 50% and 100% of your data and score each on a development set. For missing or stale facts, start with retrieval (RAG vs fine-tuning).
Training data for reasoning models
SFT without chain-of-thought traces can suppress a reasoning model's reasoning. AWS found that after SFT without reasoning traces under reasoning mode, Amazon Nova 2 Lite "loses its ability to reason during inference, even when you explicitly turn on reasoning mode".
SFT trains in open loop: the model imitates expert outputs and never sees its own errors (exposure bias). RL trains in closed loop inside an environment, generating its own chain of thought, learning error recovery, and reinforcing higher-advantage trajectories via policy gradient. SFT vs RL covers when to use each.
How to check that fine-tuning worked
Compare every trained adapter against the base model on held-out traffic in your exact deployment format. Track cost and latency per successful task alongside accuracy:
- Split real traffic into development and held-out test sets before training, and score the base model on development.
- Select the adapter on development, then score it against the base model on test in deployment format (merged or separate) across accuracy, latency and cost per successful task.
- Run a short out-of-domain check to catch forgetting.
Check out-of-domain scores carefully. In LoRA Learns Less and Forgets Less (2024), Columbia and Databricks found on code and math that "in the standard low-rank settings, LoRA substantially underperforms full finetuning", while "LoRA better maintains the base model's performance on tasks outside the target domain".
LoRA in our own training
We train small open models with GRPO and LoRA to beat frontier models on narrow workloads at lower cost. In our August 2026 claims research study (a controlled AVeriTeC benchmark experiment), we trained Qwen3.5-4B with GRPO and LoRA, and our CLaaS paper trains Qwen3-8B with LoRA on 2 H100s.
On 500 held-out development claims, the 4B model beat Claude Haiku 4.5 by 10.9% relative verdict accuracy (interval +4.5% to +17.3%) and cut cost per 1,000 claims from $17.86 to $1.75. It used 44% fewer searches, and in a separate routing evaluation on 489 held-out claims it scored 71.1%, raising the floor from 57% to 71%.
Fine-tuning on Experiential
Experiential trains custom small open models with RL to move high-volume workloads off frontier APIs. In our managed training engagements, we start with 1 workload, build a production simulation from agent traces, train on Miles and serve the model on the gateway under a new name.
Our open-source gateway turns agent traces into qualified Harbor tasks. Teams with Harbor collections can also use our early-access Training API, running asynchronous GRPO with rank-128 LoRA on Qwen3.5 9B across 2 H100s (queued time is free).
You start each run yourself and can download the weights anytime. Book a call on the fine-tuning page to start.
Questions answered
What is LoRA and QLoRA?
LoRA (Low-Rank Adaptation) fine-tunes a language model by freezing its original weights and training small low-rank matrices added to targeted layers. QLoRA stores those frozen weights in 4 bits, cutting their memory to about a quarter of 16-bit, and dequantizes them in every forward and backward pass. With PEFT, training saves only the adapter weights, which you can load on the base model or merge into it.
What is QLoRA used for?
QLoRA fine-tunes a model whose 16-bit weights do not fit in your GPU's memory. The QLoRA paper fine-tuned a 65B model on a single 48 GB GPU. A 70B model's frozen weights take 140 GB in 16-bit, while a stored 4-bit Llama 3.1 70B checkpoint is 39.5 GB on disk (with unquantized layers cast to float32 during PEFT QLoRA training).
Is QLoRA faster than LoRA?
No, QLoRA is often slower than LoRA on a 16-bit base. People often assume it runs faster because it uses 4-bit weights, when in practice its 4-bit weights are dequantized to the compute dtype (bfloat16 in the paper and the scripts here) in each forward and backward pass. In Sebastian Raschka's 2023 test on a 7B Llama 2, LoRA took 1.85 hours and 21.33 GB, while QLoRA took 2.79 hours and 14.18 GB. Native low-precision training (FP8 and FP4) runs selected math in low precision and can be faster, depending on the hardware and recipe.
How much GPU memory does QLoRA need for a 7B model?
For a 7B model, the 4.127-bit formula gives about 3.6 GB. Measured figures run higher: the QLoRA paper reports 5,048 MB for a 7B LLaMA's 4-bit base and 6.9 GB total in its memory breakdown at batch size 1 and sequence length 512. Unquantized layers (embeddings, norms and the output layer) add to the formula, PEFT's prepare_model_for_kbit_training casts them to float32, and longer sequences or larger batches add activations, so check peak memory on a short run.
How much does it cost to fine-tune an LLM with LoRA?
The GPU cost of a LoRA run equals the hourly GPU price times the number of GPUs times the hours. On Lambda on November 16, 2026, 1 A6000 (48 GB) cost $1.09 an hour and 1 H100 PCIe (80 GB) cost $3.79. Estimate hours from a short timed run (tokens per epoch times epochs, divided by measured tokens per second and by 3,600), and budget for RL needing about half its GPUs on rollouts. For our own Qwen3.5 9B runs, 2 H100s for about 4 hours cost us about $50, covering roughly 500M tokens of SFT and 50 RL steps at about 120 seconds a step.
How much data do you need to fine-tune an LLM?
Data diversity and quality count for more than raw size. Meta AI and university researchers fine-tuned a 65B LLaMa model in LIMA on 1,000 curated examples for general assistant behavior, and their ablations found measurable gains from input diversity and output quality while scaling quantity alone might not help. Train on 25%, 50% and 100% slices and score each on a development set to see when performance flattens.
Is LoRA as good as full fine-tuning?
LoRA matches full fine-tuning in some settings and trails it in others. In the QLoRA paper's experiments, adapting every linear transformer layer matched full 16-bit fine-tuning. In a 2024 Columbia and Databricks study on code and math, standard low-rank LoRA trailed full fine-tuning on target tasks while preserving base performance better on out-of-domain tasks.
