LoRA (Low-Rank Adaptation)
Fine-tuning through the addition of external compact low-rank matrices, without changing all weights of the model.
Analogy
The model is a giant encyclopedia in a hardcover binding. Instead of reprinting the entire book, LoRA adds a thin notebook with sticky notes.
How It Works
- The base model weights are 'frozen' — they are not allowed to change.
- Two small low-rank matrices are created nearby.
- Only these matrices are adjusted during training.
The query passes through the base model + through the 'overlay' matrices.
Practical Benefits
- instead of a weight of 15 GB, a LoRA adapter file takes up 20–100 MB;
- one adapter can be 'slipped on' a model like a plugin and removed;
- several adapters can coexist, switching behavior.
LoRA vs Full Fine-Tuning
| LoRA | Full | |
|---|---|---|
| Memory | Low | High |
| File | 20–100 MB | GB |
| Trainable Parameters | <1% | 100% |