LoRA Low-Rank Adaptation
LoRA (Low-Rank Adaptation) is currently the most popular parameter-efficient fine-tuning method, proposed by Microsoft in 2021. It lets ordinary graphics cards fine-tune large models.
The problem it solves
Full-parameter fine-tuning of a 7B model requires storing model parameters plus gradients plus optimizer states, and the video memory demand exceeds 100GB. Individual developers simply cannot afford it.
Core insight
The paper found that the change in model parameters during fine-tuning actually has a very low "intrinsic rank". That is, although the parameter matrix is large, there are few directions that really need to be adjusted.
So LoRA works like this: freeze all parameters of the original model and attach only two small matrices A and B beside it, updating only these two small matrices during training. The final output = original weight + A x B.
Parameter count comparison
Suppose the original matrix is 4096x4096 (16 million parameters). With rank r=8, LoRA's two small matrices are 4096x8 and 8x4096, totaling only 65000 parameters - a 99.6% reduction.
Practical advantages
- VRAM friendly: a 7B model can be fine-tuned with 8GB of video memory (even less with quantization)
- Pluggable: one base model can carry multiple LoRAs, switching between different styles and abilities
- Small files: a LoRA file is usually tens to hundreds of MB, easy to share
- Does not damage the original model: just unload it when you are done
Use in AI image generation
LoRA is even more prominent in image generation: an artist can train a LoRA on a few dozen images and then have the model reliably draw a specific character, art style, or outfit. This is the technical foundation of the flourishing of communities such as Civitai.
Key parameters
rank: the larger it is, the stronger the capability but the easier it is to overfit; 8 to 64 is common. alpha: a scaling coefficient, usually set to 1 to 2 times the rank.