O&O ConsultingBook a free call

Home / Insights / AI in Practice

LoRA: Adapting Large Models on a Budget

How low-rank adaptation and quantised training made customisation far cheaper.

O&O Consulting · · 2 min read

Computer chips used for model training

Fully fine-tuning a model with billions of parameters requires storing and updating all of them, which is costly. Parameter-efficient methods change only a small part.

The low-rank idea

Edward Hu and colleagues observed that the change needed to adapt a model can often be expressed compactly. LoRA represents the update to a large weight matrix as the product of two much smaller matrices. The original weights are left untouched, and only the small pair is learned.

The trained addition, called an adapter, is tiny compared with the model. Several adapters can share one base model, each serving a different task or customer, and can be merged into the weights so that answering is no slower.

How low-rank adaptation worksIllustrative diagram, not data
Swap adapters for different tasksOnly the adapters are trainedSmall adapter matrices are addedOriginal model weights stay frozen
Swap adapters for different tasksOnly the adapters are trainedSmall adapter matrices are addedOriginal model weights stay frozen

Diagram by O&O Consulting.

QLoRA

QLoRA, published in 2023, stores the frozen model in 4-bit form while training the adapter in higher precision. This lowered memory needs enough that quite large models could be fine-tuned on a single graphics card, with results the authors reported as close to full 16-bit tuning on their benchmarks.

When it fits

  • A consistent output format or tone that prompting does not hold.
  • Classification or extraction in a specialist domain.
  • Making a smaller, privately hosted model adequate for a defined job.

What to watch

The rank of the adapter and the amount of training determine how much the model can change. Too little and nothing improves; too much on a narrow dataset and the model overfits. Compare against the untouched model with a good prompt, which is sometimes hard to beat.

Licences matter as well: open-weight models come with differing terms about commercial use, which apply to adapted versions.

Limitations and open questions

Low-rank updates may be insufficient for large changes, such as learning a substantially new language or skill. Adapters trained for one base model do not transfer to its successor. And any personal or confidential information in the training examples can be reflected in the adapter's behaviour.

References

This article is general information, not financial, legal or investment advice. AI research and rules change quickly; check the cited sources for the current position.