LoRA: Low-Rank Adaptation of Large Language Models
This research paper explains how freezing pretrained weights and learning a low-rank update ΔW = BA cuts trainable parameters by orders of magnitude while matching full fine-tuning quality on many tasks.
Full fine-tuning of a large language model means storing a second copy of every weight for each downstream task — prohibitive at GPT-3 scale. Adapter layers help, but many insert extra depth and add inference latency.
LoRA freezes the pretrained matrix and learns a low-rank update with rank . Only and train. At inference you can merge so deployed latency matches the base model, or keep adapters swappable per task.
What this paper explains
For a dense multiply with , LoRA uses:
where , . Typical init: Gaussian, zero, so starts at zero. A scalar can scale the update for tuning stability.
They inject LoRA primarily into attention projection matrices (e.g. , in Transformer blocks), keeping MLPs frozen in many experiments — a practical sweet spot between quality and parameter count.
Prior limits
- Full fine-tuning — best flexibility, worst storage/multi-tenant cost.
- Adapter modules (Houlsby et al.) — small bottleneck layers; extra depth → some latency unless carefully fused.
- Prefix / prompt tuning — very few parameters, but can lag full FT on harder tasks and still add sequence overhead.
- Sparse / difference editing — related goals, different inductive biases.
The mechanism
The hypothesis: adaptation updates to big models have low intrinsic rank. Instead of estimating a full , constrain it to rank . Gradient updates flow only into and ; stays fixed (and can sit in pure FP16/INT8 storage shared across tasks).
Task switching: load a small pair. Serving many customers becomes a memory problem about adapter sets, not full model replicas.
Algorithm / figure walkthrough
- Freeze .
- Choose which matrices get LoRA (often and projections).
- Pick rank and scaling .
- Train on downstream data; optimize only (and any task head).
- Deploy: either merge into or keep separate for hot-swapping.
The opening figure shows the frozen highway beside a thin bypass that carries the learned delta.
What to notice when reading
- Rank as the knob: quality vs storage (paper shows small often suffices).
- Mergeability — no inference tax when fused.
- Where they apply LoRA (attention vs MLP) changes the parameter/quality curve.
Results and evidence
On RoBERTa, DeBERTa, GPT-2, and GPT-3 175B adaptations, LoRA matches or nearly matches full fine-tuning quality on the paper’s benchmarks while using far fewer trainable parameters (e.g. adapting GPT-3 with ranks like or on selected matrices). They report large reductions in checkpoint size versus full FT and no added inference latency when weights are merged. Use the paper’s tables for task-by-task numbers rather than inventing aggregates.
Limitations
- Low-rank constraint can underfit if is too small for a hard domain shift.
- Choosing which layers/matrices to adapt is still a hyperparameter search.
- Merged models lose easy task-switching unless you keep separate deltas.
- Orthogonal to quantization and pruning — often combined in later systems (QLoRA, etc.).
How to read the paper
- Abstract + §1 — motivation vs adapters / full FT.
- §3 — reparameterization .
- §4 — which weights to adapt; rank study.
- §5 — GPT-2 / GPT-3 / RoBERTa experiments.
- Related work — parameter-efficient fine-tuning landscape.
Knowledge check
In LoRA, what is trained while stays frozen?
Why can LoRA avoid extra inference latency?
For , how many trainable parameters does a rank- LoRA adapter use?
Keep reading
- Original paper (arXiv:2106.09685)
- Related Fanout Daily: BERT, Attention Is All You Need.
Sources
- Hu et al., LoRA: Low-Rank Adaptation of Large Language Models, ICLR 2022 — arXiv:2106.09685