Berk Bayri

LoRA

Low-rank adaptation: a way to fine-tune a large model by training a small set of added weights while the original weights stay frozen. It makes customization much cheaper and lets one base model carry many swappable adapters.

LoRA, short for low-rank adaptation, is a widely used way to fine-tune a large model without retraining all of it. The original weights are frozen. A pair of small matrices is added to selected layers, and only those are trained. The finished adapter is a separate file, often a tiny fraction of the model's size, that is applied on top of the base model when it runs.

The 2021 paper that introduced it reported that, compared with fully fine-tuning GPT-3 175B, LoRA cut the number of trainable parameters by about 10,000 times and GPU memory needs by about 3 times, with comparable quality on the tasks tested. A later variant, QLoRA, combines the idea with quantization so that adapters can be trained on a single large GPU.

"LoRA: Low-Rank Adaptation of Large Language Models"

arXiv (Hu et al., Microsoft) · 2021-06-17

Where it helps and where it does not

LoRA is useful when you need a model to adopt a consistent format, tone or narrow task behavior, and you can supply a few hundred to a few thousand good examples. Because adapters are small, one open-weight model can serve different adapters for different teams.

It is a poor tool for adding knowledge that changes. An adapter trained on last quarter's price list will confidently quote last quarter's prices. Facts that move belong in retrieval, not in weights. And an adapter only works with the exact base model it was trained on, so changing the base model means training it again.