FDEInterviews logo
★ Read firstICLR 2022

LoRA: Low-Rank Adaptation of Large Language Models

The 2021 Microsoft paper behind most fine-tuning today: freeze the model, learn each layer's change as two thin matrices, and match full fine-tuning of GPT-3 with 10,000× fewer trained parameters.

Breakdown by FDE Interviews · 13 min read · Updated

About the original · 2021
AUTHORS
Hu, Shen, Wallis, Allen-Zhu, Li, Wang, Wang, Chen
FROM
Microsoft
PUBLISHED
Jun 2021 · ICLR 2022
CITED BY
24,443Semantic Scholar · Oct 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 21% of this breakdown.

01

The paper in one minute

Fine-tuning adapts a pretrained model to a task by continuing to train it. Doing that the usual way updates every weight. For GPT-3, with 175 billion parameters, that means each fine-tuned version is a new 350 GB model, and training needs memory for gradients and optimizer state for all of them. A company with a hundred tasks would store 35 TB of near-identical models.

LoRA (low-rank adaptation), from Edward Hu and colleagues at Microsoft, starts from an observation: the change fine-tuning makes to a weight matrix seems to have a low "intrinsic rank". So instead of learning the full change ΔW, which is as big as the layer, LoRA learns it as the product of two thin matrices: B (d × r) and A (r × d), where r is tiny, often 1 to 8, against a layer width of 12,288 in GPT-3. The pretrained weights stay frozen. A starts random and B starts at zero, so training begins exactly at the pretrained model. When training is done, BA can be added into the original weight, so the served model has exactly the same shape and speed as before.

The paper applied LoRA to the attention projection matrices, mostly just the query and value matrices. On GPT-3 175B, with 4.7 million trainable parameters, it matched or beat full fine-tuning on three tasks: SQL generation (WikiSQL), natural-language inference (MultiNLI) and dialogue summarization (SAMSum). Training memory fell from 1.2 TB to 350 GB, a task checkpoint from 350 GB to about 35 MB, and training ran about 25% faster. Unlike adapter layers, it adds no inference latency; unlike prefix tuning, it uses none of the input length.

A rank as small as one was enough on those tasks, and the learned changes amplified directions already present in the pretrained weights but not emphasized there.

THE IDEA, VISUALLY
TRAIN TWO THIN MATRICES, NOT THE WHOLE LAYER W₀ d × d, frozen d = 12,288 in GPT-3 + B d × r × A (r × d) r = 1 to 8 sufficed on these tasks A starts random, B at zero, so training starts at W₀ After training: W = W₀ + BA, merged, no extra latency training memory 1.2 TB → 350 GB checkpoint per task 350 GB → ~35 MB 100 tasks stored 35 TB → ~354 GB training throughput +25% GPT-3 175B, W_q and W_v adapted, r = 4; Section 4.2 GPT-3 175B: 4.7M PARAMETERS VS 175B WikiSQL accuracy full FT 73.8 LoRA 73.4 MultiNLI-m accuracy full FT 89.5 LoRA 91.7 SAMSum ROUGE-1 full FT 52.0 LoRA 53.8 RANK BARELY MATTERS HERE WikiSQL accuracy, LoRA on W_q, W_v, Table 6 73.4 r=1 73.3 r=2 73.7 r=4 73.8 r=8 73.5 r=64 axis starts at 72%; all five are within the ±0.5 seed noise
LoRA in one picture: a frozen weight plus a low-rank change that can be merged back in. On GPT-3, 4.7 million trained parameters matched or beat updating all 175 billion, and the rank hardly mattered.
Research notes: the problem, approach and results
10,000×

fewer trainable parameters than full fine-tuning of GPT-3 175B

350 GB → 35 MB

size of a task-specific checkpoint for GPT-3 (r = 4, two attention matrices)

r = 1

rank that already performed competitively on GPT-3's WikiSQL and MultiNLI

THE PROBLEM

Fine-tuning a large model updates every weight, so each task needs a full copy of the model and training needs memory for the optimizer state of every parameter. For GPT-3, that is 350 GB per task.

THE IDEA

Freeze the pretrained weights. Represent each layer's change as the product of two small matrices B and A with a tiny inner rank r, train only those, and add BA back into the weight when serving.

THE RESULT

On GPT-3 175B, LoRA matched or exceeded full fine-tuning on WikiSQL, MultiNLI and SAMSum, cut training memory from 1.2 TB to 350 GB and a task checkpoint from 350 GB to about 35 MB, with no added latency.

02

Why it matters to an FDE

LoRA is the default way to fine-tune open models, and most customer conversations about "training a model on our data" end up being about LoRA or its quantized cousin, QLoRA. Understanding it lets you set expectations on cost, hardware and serving.

It makes fine-tuning a small artifact. The output of a LoRA run is an adapter measured in megabytes, not a new model. You can keep many adapters, one per customer, product line or task, on top of one shared base model, version them like code, and roll them back.

It changes what serving looks like. Merge the adapter into the weights for a single task with no extra latency. Or keep adapters separate and swap them per request on one GPU holding the base model, which is how multi-tenant adapter serving works; the paper notes that batching requests for different adapters in one forward pass requires not merging.

It lowers the hardware bar, not the data bar. LoRA reduces memory and storage. It does not reduce the need for good training examples or an evaluation that shows the fine-tune beats prompting and retrieval.

Low rank is a finding about these tasks, not a law. The authors warn that a task far from pretraining, their example being a different language, may need much more capacity. Treat rank as a hyperparameter to test.

Fine-tune for form, retrieve for facts. LoRA is good at teaching formats, styles and task behavior. Knowledge that changes often is still better served by retrieval.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 49 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦6 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    How LoRA compares with other methods, what the experiments show, and the misreadings to avoid

    Free account
  2. 04How it works

    The math, the initialization, merging, and the rank analysis

    Premium
  3. 05The numbers that matter

    The GPT-3 results, the weight-type and rank tables, and the latency study

    Premium
  4. 06Try it yourself

    Reproduce the GPT-3 parameter counts, then train LoRA at several ranks against full fine-tuning

    Premium
  5. 07Where it breaks

    The limits the authors state, and the ones practice has added

    Premium
  6. 08Using it on a deployment

    Running a LoRA fine-tune for a customer, from the decision to serving

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →