LoRA — low-rank adaptation
Read "W zero plus alpha over r, B A". Keep the pretrained weights W₀ frozen and learn a small low-rank correction BA to add to them.
and , with much smaller than (written ). Their product has the same shape as but needs only numbers. The factor scales the correction so that changing does not require retuning the learning rate.
starts at all zeros, so at the first step and training begins from exactly the pretrained model. After training, can be added into once, so running the model costs nothing extra.
Example
The correction trains about 0.4% as many numbers as the full matrix.
Where the course uses it
Related terms
- Rank of a matrixRead "rank of W". It is the number of truly independent directions a matrix can produce, which equals its number of nonzero singular values.
- SVD — singular value decompositionRead "W equals U Sigma V transpose". Any matrix can be split into three steps: a rotation, a stretch along each axis, and another rotation.
- Δ — a changeRead "delta". Capital delta means "the change in", so ΔW is the amount W changes by.