Skip to main content
issue 2026-07-12AI Research50 minICLR 2022interactive

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.

LoRA freezes W₀ and trains a low-rank update BAThe pretrained weight matrix stays frozen. A thin path through A then B adds ΔW = BA. At serve time the delta can merge into W₀ with no extra latency.xINPUTW₀FROZENAr×kBd×rhOUTPUTh = W₀x + BAx · TRAIN ONLY A,B · MERGE TO SERVERANK r ≪ min(d, k) CUTS TRAINABLE PARAMETERSLoRA low-rank adaptationMobile: frozen W0 plus BA adapter path.LOW-RANK ΔWFREEZE W₀share one base across tasksTRAIN A, B (RANK r)ΔW = BA · merge for zero latency taxparams: r(d + k) instead of d·kSMALL ADAPTERS · FULL-FT QUALITY BAND

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 W0W_0 and learns a low-rank update ΔW=BA\Delta W = BA with rank rmin(d,k)r \ll \min(d, k). Only AA and BB train. At inference you can merge W=W0+BAW = W_0 + BA so deployed latency matches the base model, or keep adapters swappable per task.

What this paper explains

For a dense multiply h=W0xh = W_0 x with W0Rd×kW_0 \in \mathbb{R}^{d \times k}, LoRA uses:

h=W0x+BAx=(W0+BA)xh = W_0 x + B A x = (W_0 + BA) x

where BRd×rB \in \mathbb{R}^{d \times r}, ARr×kA \in \mathbb{R}^{r \times k}. Typical init: AA Gaussian, BB zero, so ΔW\Delta W starts at zero. A scalar α/r\alpha / r can scale the update for tuning stability.

They inject LoRA primarily into attention projection matrices (e.g. WqW_q, WvW_v in Transformer blocks), keeping MLPs frozen in many experiments — a practical sweet spot between quality and parameter count.

LoRA reparameterizationOutput equals W0 x plus B A x, with rank r much smaller than d and k.W₀ (frozen)+B×A= ΔWrank rparams r(d+k)merge W ← W₀ + BA for zero added latency
Intrinsic low-rank adaptation: store tiny (A, B) per task instead of a full fine-tuned copy of W₀.

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 ΔW\Delta W, constrain it to rank rr. Gradient updates flow only into AA and BB; W0W_0 stays fixed (and can sit in pure FP16/INT8 storage shared across tasks).

Task switching: load a small (A,B)(A,B) pair. Serving many customers becomes a memory problem about adapter sets, not full model replicas.

Interactive

Rank vs trainable parameters

One weight matrix with d = k = 4096. Full fine-tune trains d·k parameters; LoRA trains r(d+k).

Real models adapt several matrices (often Wq, Wv); multiply this per-matrix count by how many you attach. Small r often matches full FT on the paper's tasks.

Algorithm / figure walkthrough

  1. Freeze W0W_0.
  2. Choose which matrices get LoRA (often qq and vv projections).
  3. Pick rank rr and scaling α\alpha.
  4. Train on downstream data; optimize only A,BA,B (and any task head).
  5. Deploy: either merge BABA into W0W_0 or keep separate for hot-swapping.

The opening figure shows the frozen highway W0W_0 beside a thin ABA\to B bypass that carries the learned delta.

What to notice when reading

  • Rank rr as the knob: quality vs storage (paper shows small rr 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 r=4r=4 or r=8r=8 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 rr 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

  1. Abstract + §1 — motivation vs adapters / full FT.
  2. §3 — reparameterization ΔW=BA\Delta W=BA.
  3. §4 — which weights to adapt; rank study.
  4. §5 — GPT-2 / GPT-3 / RoBERTa experiments.
  5. Related work — parameter-efficient fine-tuning landscape.

Knowledge check

In LoRA, what is trained while W0W_0 stays frozen?

Why can LoRA avoid extra inference latency?

For WRd×kW \in \mathbb{R}^{d \times k}, how many trainable parameters does a rank-rr LoRA adapter use?

Keep reading

  1. Original paper (arXiv:2106.09685)
  2. 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