LoRA

2 min read

LoRA (Low-Rank Adaptation) makes fine-tuning large models practical by training only small low-rank matrices.

Core idea: instead of updating the full weight matrix WRd×dW \in \mathbb{R}^{d \times d}, freeze WW and add a low-rank update:

W=W+ΔW=W+BAW' = W + \Delta W = W + BA

where BRd×rB \in \mathbb{R}^{d \times r}, ARr×dA \in \mathbb{R}^{r \times d}, and rdr \ll d.

Connection to Singular Value Decomposition (SVD) : the update ΔW=BA\Delta W = BA has rank at most rr. SVD tells us that weight updates during fine-tuning tend to be low-rank — most of the change lives in a low-dimensional subspace. LoRA exploits this by parameterizing the update in that subspace directly.

Parameter savings:

  • Full fine-tuning: d×dd \times d parameters per layer
  • LoRA: d×r+r×d=2drd \times r + r \times d = 2dr parameters per layer
  • With d=4096d = 4096 and r=16r = 16: 16M16M vs 131K131K — 100x fewer trainable parameters

Training:

  • AA initialized with random Gaussian, BB initialized to zero (so ΔW=0\Delta W = 0 at start)
  • Only AA and BB are updated; base model stays frozen
  • At inference: merge W+BAW + BA — no additional latency

Practical use:

See also: Singular Value Decomposition (SVD) , Supervised Fine-Tuning

Linked from