Book a 30-min callBook a call

LoRA and fine-tuning explained: when to fine-tune an LLM and how adapters work

When fine-tuning an LLM beats prompting or RAG, and how LoRA and QLoRA work: low-rank updates, rank and alpha, 4-bit training, adapter serving and data.

A large frozen weight block with a padlock, a tall thin block and a wide thin block beside it, and a plus sign that feeds the output.
Written by
BYD Tech
Published
Topic
Deep dives
Reading time
17 min read

Questions people ask

Is LoRA as good as full fine-tuning?

For format, style and narrow tasks it often matches full fine-tuning, which is what the LoRA and QLoRA papers report on their benchmarks, especially with adapters on all linear layers. For large shifts such as a new domain of code or math, Biderman and colleagues found that common LoRA settings learn noticeably less than full fine-tuning, while forgetting less of what the base model knew.

What rank and alpha should I start with?

A small rank such as 8 or 16, with adapters on all linear layers, is a reasonable first run; the LoRA paper found very small ranks sufficient on its tasks, and the QLoRA authors found the choice of layers mattered more than the rank. Keep alpha fixed while you vary r, as the original authors did, and raise the rank only if the evaluation shows the adapter cannot fit the task.

How many training examples do I need?

Fewer than most people expect, if they are good. LIMA reached strong results with 1,000 curated examples, and OpenAI's guide suggests starting with about 50 well-crafted ones. Start with a few hundred examples you have checked by hand, measure, and add data where the errors cluster rather than adding volume for its own sake.

Can fine-tuning add new facts to a model?

Only unreliably. A model can memorize facts from training data, but it cannot tell you where an answer came from, and the facts go stale the moment the data changes. Put changing knowledge in retrieval and use fine-tuning for behavior: format, tone, task skill and how to use the retrieved context.

Does a LoRA model run slower than the base model?

Not once merged: the adapter is folded into the weight matrices and the model has exactly the original shape. Unmerged adapters add a small extra computation per adapted layer, which is the price of serving many fine-tunes from one base model.

Building something like this?