
Full fine-tuning of a large language model demands hardware that few teams own. A 175B parameter model needs around 1.2TB of training VRAM with Adam, a figure that puts full fine-tuning out of reach for most developers and small teams. LoRA changes that math. It adapts a model by training a tiny set of extra weights while the original weights stay frozen, and the result often matches full fine-tuning on the target task. This article explains the mechanism, the numbers behind it, and the cases where it falls short.
LoRA fine-tuning is the default choice when you need a large model to adopt a specific style, format, or task behavior and you lack a GPU cluster. The LoRA paper reports 10,000 times fewer trainable parameters and 3 times less GPU memory than full fine-tuning of GPT-3 175B with Adam, and the merged adapter adds zero inference latency. QLoRA pushes the bar further, cutting the memory needed to fine-tune a 65B model from more than 780GB to under 48GB. Full fine-tuning still wins for foundation-scale changes, such as teaching a model a new language from scratch, and retrieval beats fine-tuning when the model needs fresh facts. Start with LoRA at rank 8 on attention layers, measure against a held-out eval set, and escalate only when the numbers say the adapter has hit its ceiling.
LoRA, short for Low-Rank Adaptation, freezes every pretrained weight in the model and injects two small matrices into selected layers. The first matrix compresses the layer input down to a low rank r, and the second expands it back to the original size. Training updates only those two matrices. The base model never changes during training, which is why the optimizer state and gradients stay small.
Rank r controls the capacity of the adapter. A rank of 8 produces a small update with few parameters, while a rank of 64 produces a larger update that can capture more complex behavior. The scaling factor lora_alpha divided by r sets the size of the update relative to the frozen weights. The Hugging Face PEFT library ships LoraConfig with defaults of r=8, lora_alpha=8, and lora_dropout=0.0, a sane starting point for most tasks.
At deployment time, the team merges the trained matrices into the frozen weights with a single matrix addition. The merged model has the same shape as the base model, so it serves through the same inference stack with no extra compute. The Hugging Face PEFT documentation states the point directly: LoRA does not add inference latency because adapter weights merge with the base model. The original paper makes the same claim from the design side, noting that the linear design introduces no inference latency compared with a fully fine-tuned model, by construction.
The storage math explains why teams keep dozens of adapters. With r=4 and only the query and value projection matrices adapted, the LoRA paper reports a checkpoint shrinking from 350GB to 35MB, roughly a 10,000 times reduction. Storing 100 adapted variants costs about 354GB, one full copy plus 100 small adapters, versus about 35TB for 100 full fine-tuned copies. That gap turns per-customer or per-task models from a storage problem into a file-management task.
Four approaches cover most customization needs, and each one trades memory, data, and latency differently. Prompting and retrieval change no weights at all. LoRA changes a small slice. QLoRA adds quantization to the frozen base. Full fine-tuning changes everything. The table below compares them on a 65B-class model, using figures from the LoRA and QLoRA papers.
| Factor | Prompting and RAG | LoRA (16-bit) | QLoRA (4-bit) | Full Fine-Tuning |
|---|---|---|---|---|
| Trainable parameters | None | Millions (rank-driven) | Millions (rank-driven) | All billions |
| GPU memory to train 65B | None for training | Hundreds of GB | Under 48GB | More than 780GB |
| Storage per variant | Index only | Tens of MB | Tens of MB | Full model copy |
| Serving latency | Retrieval adds latency | Same as base model | Same as base model after merge | Same as base model |
| Data needed | Documents to index | Hundreds to thousands of examples | Hundreds to thousands of examples | Thousands to millions of examples |
| Best for | Fresh facts, grounding | Style, format, task behavior | Same as LoRA on one GPU | Foundation-scale change |
Retrieval wins when the model needs knowledge it never saw in training. A guide on when fine-tuning beats retrieval, and when it doesn’t, covers that decision in depth. LoRA wins when the knowledge already sits inside the model and the gap is behavior: tone, output format, tool use, or a narrow task. QLoRA wins the same cases on tighter hardware. Full fine-tuning wins when the task demands deep changes across the whole model, and the team can pay the memory and data bill.
The QLoRA paper backs the single-GPU claim with a concrete result. Its authors report that QLoRA cuts the average memory needed to fine-tune a 65B parameter model from more than 780GB to under 48GB, without degrading runtime or predictive performance against a 16-bit fully fine-tuned baseline. Their Guanaco model family reached 99.3 percent of ChatGPT performance on the Vicuna benchmark after 24 hours of fine-tuning on a single GPU, a 2023 result that showed how far one GPU could go. Benchmarks and reference models have moved since then, so treat that figure as a historical marker, not a current ranking.
Three settings shape most LoRA runs: rank, target modules, and alpha. Rank sets adapter capacity. Rank 8 handles format and style tasks well, and most teams start there. Rank 16 or 32 suits tasks with more complex behavior, and rank 64 fits cases where the adapter must carry substantial new skill. Higher rank costs more memory and trains slower, and returns diminish past the point where the data supports the extra capacity.
Target modules decide where adapters attach. The PEFT documentation notes that in Transformer models, LoRA is typically applied to attention blocks only, and practice follows that convention: query and value projections first, then key and output projections when the task needs more capacity. Some teams extend adapters to MLP layers for harder tasks. Each added module grows the trainable parameter count, and the count depends mainly on rank r and the shape of the original weight matrix, as the PEFT docs state.
Alpha scales the adapter update. With the current PEFT defaults, lora_alpha equals r, which makes the scaling factor 1. Older blog posts and tutorials often cite lora_alpha 32, a value from earlier PEFT versions. Current PEFT documentation lists lora_alpha 8 as the default, so check the version in your environment before copying a value from an old tutorial. A scaling factor above 1 amplifies the adapter effect, and a factor below 1 softens it.
Dropout on the adapter, lora_dropout, defaults to 0.0. Small datasets benefit from a dropout of 0.05 to 0.1, which guards against overfitting when examples number in the hundreds. Large datasets rarely need it. Keep the learning rate in the usual LoRA range, around 1e-4 to 2e-4 with a cosine schedule, and watch the eval loss rather than the training loss for the stop signal.
A LoRA project moves through four stages: data, train, merge, and serve. Data quality decides the outcome more than any hyperparameter. Collect instruction pairs that show the exact behavior you want, in the exact format you want, with clean and consistent outputs. The Stanford Alpaca project demonstrated the scale involved: 52,000 unique instructions with corresponding outputs, generated for less than 500 dollars using the OpenAI API in 2023. Modern generation costs differ, but the lesson holds: a few thousand clean examples beat a large pile of noisy ones.
Training runs through the PEFT library, often paired with TRL for supervised fine-tuning. Load the base model in 16-bit for standard LoRA or 4-bit for QLoRA, attach a LoraConfig, and train on the instruction pairs. Track a held-out eval set from the first run, and compare the adapter against the base model on that set before and after training. A guide to evals that catch real failures shows how to build a set that measures behavior you care about instead of surface fluency.
Common failure modes trace back to data, not rank. Bad labels teach bad behavior at any rank. Duplicated or templated examples push the model toward rigid outputs. A missing eval set hides regressions until users find them. Fix the data first, then tune rank, and only then question the base model choice.
Merging folds the adapter into the base weights for serving. The merged model loads in any standard inference server with no adapter code in the path. Teams that serve many variants skip the merge and keep adapters hot-swappable: one base model in memory plus a small adapter per customer or task, swapped in milliseconds. The storage math from the LoRA paper makes this practical, with 100 variants fitting in about 354GB instead of about 35TB.
Serving a merged model costs the same as serving the base model, which keeps the infrastructure bill flat. How quantization shrinks models at inference time covers the next step for teams that need smaller serving footprints, since quantization and LoRA solve different parts of the memory problem.
LoRA adapts behavior, style, and format. It does not inject knowledge the base model lacks. A model that never saw your internal product docs will not learn them from a few hundred fine-tuning examples. Retrieval handles that case better, because it grounds answers in documents at query time. Teams that need fresh or private facts should build the retrieval path first and reserve LoRA for behavior.
LoRA also does not beat quantization for pure inference memory reduction. Quantization shrinks the weights the server holds, while LoRA shrinks the weights you train. A team that needs a smaller serving footprint should quantize the base model, and optionally fine-tune with QLoRA on top. The two techniques stack, but they answer different questions.
Quality ceilings appear at foundation-model scale. Full fine-tuning moves every weight, and for tasks that demand deep change across the model, the extra capacity shows in the evals. Small teams rarely hit this ceiling, because most commercial tasks sit in the behavior-adaptation zone. When evals plateau across ranks and data sizes, consider a different base model before reaching for full fine-tuning. Small purpose-built models winning in production make the case for matching model size to the task instead of scaling the training bill.
Cost belongs in the same decision. Full fine-tuning a large model needs cluster-scale hardware, while LoRA runs on a single high-end GPU and QLoRA runs on one consumer card. Cutting LLM API bills with prompt caching covers a cheaper lever for teams that call hosted models instead of training their own. Pick the cheapest method that clears the eval bar, and spend the savings on better data.
LoRA fine-tuning earns its default status with hard numbers: 10,000 times fewer trainable parameters, training VRAM cut from 1.2TB to 350GB on a 175B model, checkpoints measured in megabytes, and zero added serving latency after the merge. QLoRA extends the same idea to a single GPU for 65B models. The limits are clear too: LoRA shapes behavior, not knowledge, and full fine-tuning still owns foundation-scale change.
Start with rank 8 on attention projections, alpha equal to rank, and a clean dataset of a few thousand examples. Hold out an eval set before training, compare base versus adapter on it, and raise the rank only when the evals show headroom. When the adapter stops improving, fix the data, and when the data stops improving, reconsider the base model. Share what you adapted and what the evals showed, and read the related guides on retrieval versus fine-tuning and quantization to round out the picture.