Rank of a matrix
Read "rank of W". It is the number of truly independent directions a matrix can produce, which equals its number of nonzero singular values.
A matrix stores about 16.8 million numbers, but its rank can be as low as 8: every output it produces is then a mix of just 8 directions. Low rank means the matrix can be stored much more compactly, as two thin matrices.
LoRA assumes that the change a fine-tune makes to the weights has low rank, even though the weights themselves do not. So the change can be learned as two thin matrices.
Example
The second row is twice the first, so there is only one independent direction.
Where the course uses it
Related terms
- 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.
- LoRA — low-rank adaptationRead "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.