Fine-Tuning
Continuing to train a pretrained model on your own examples to specialize it. LoRA does this cheaply by training small add-on matrices instead of all the weights.
Also full fine-tuning · domain adaptation
Hu et al. (LoRA), 2021
A chef who already knows how to cook takes a short course in one cuisine. LoRA is like giving them a small recipe card to clip onto their existing knowledge rather than retraining them from scratch.
Where it fits
+All relationships as a list
Is a kind of / part of
Kinds and parts
Siblings
- AI Agents and Tool Use
- BERT
- Direct Preference Optimization
- Embedding
- Google Translate
- GPT
- Hallucination
- In-Context Learning
- Keyboard Autocomplete
- Large Language Model
- LLM Evaluation and Benchmarks
- Perplexity
- Pretraining
- Prompting
- Retrieval-Augmented Generation
- RLHF
- Sampling and Temperature
- Scaling Laws
- Tokenization
- Vector Database
- word2vec
Uses / built on
Applies to
How it works
A pretrained model already knows a lot. Fine-tuning adapts it with your own examples, a form of transfer learning: show input-output pairs, compute the loss, and update with gradient descent, usually with a small learning rate so it does not forget what it knew.
Updating every weight of a billion-parameter model is expensive, and each fine-tuned copy is as big as the original. LoRA (low-rank adaptation) avoids both:
- Freeze the original weights.
- Next to selected weight matrices, add two thin matrices, B and A, whose product is a correction to that weight.
- Train only B and A.
Because they are thin (the “rank” might be 8 or 16), they hold a tiny fraction of the parameters, often well under 1%. The resulting adapter is a small file you can swap in and out. QLoRA goes further by keeping the frozen base model quantized to 4 bits.
When to choose what: fine-tuning shapes behavior (format, tone, a narrow skill); RAG supplies knowledge that changes or must be cited; good prompting is the cheapest first try.
The math
For a frozen weight , LoRA learns and with :
Trainable parameters drop from to .
Everyday use cases
- Case 01
Company tone and format
Teach a model to write in a house style or output a specific structured format.
- Case 02
Specialist tasks
Classify legal clauses or extract fields from medical notes with a few thousand examples.
- Case 03
Turning base models into assistants
Supervised fine-tuning on example conversations is the first step of post-training.
Strengths, weaknesses and when to use it
Strengths
- Specializes behavior and format more reliably than prompting alone.
- LoRA makes it affordable on a single GPU, and adapters are small to store and swap.
Weaknesses
- Needs good examples; bad data teaches bad habits.
- Poor at adding lots of new factual knowledge; retrieval is usually better for facts.
When to use itWhen prompting is not consistent enough and you have a few hundred or more good examples of the desired behavior.
Compare with
Check yourself
- Q01
What does LoRA train?
Show answer
A: Small low-rank matrices added to frozen weights
- Q02
You need answers about documents that change weekly. What is usually better?
Show answer
A: Retrieval-augmented generation