Blog · Chapter 13 · Fine-tuning
When prompting is not enough
When fine-tuning is worth it, how to build the dataset, how to train locally or remotely, and how to prove it helped.
Fine-tuning is powerful, and often unnecessary. Chapter 13 explains when it is worth the effort and how to do it properly when it is.
Fine-tune for behaviour, not knowledge
Fine-tuning changes how a model responds: format, style, tone, and consistency on a narrow task. It is a poor way to teach facts, which change and need citations. Use RAG for knowledge.
Good reasons to fine-tune:
- a narrow, high-volume task where a smaller tuned model can replace a large general one;
- a strict output format or domain style that prompting cannot hold reliably;
- latency or cost targets that a large model cannot meet.
Beat the baseline first
Before training anything, build the strongest prompted baseline you can: good instructions, examples, retrieval and the right model. Fine-tuning must beat that baseline on your golden dataset. Otherwise it is cost without benefit.
The dataset decides the result
Training data comes from human-in-the-loop corrections, production logs, expert-written examples, distillation from a larger model and careful synthetic generation. Whatever the source, it must be:
- clean and correctly labelled;
- deduplicated and balanced across case types;
- validated by experts;
- versioned;
- leakage-free, with no test cases in the training set.
Train locally or remotely
- Locally: Unsloth makes LoRA and QLoRA fine-tuning fast and memory-efficient on a single GPU.
- Remotely: Hugging Face, GPU clouds and managed fine-tuning services scale to larger models and datasets.
LoRA adapters are small, so you can keep several and switch between them.
Test before you deploy
Evaluate the tuned model on:
- task performance against the baseline on the golden dataset;
- general capability, to check that the model has not forgotten how to follow instructions;
- robustness and safety, including adversarial inputs and refusal behaviour;
- efficiency: latency, throughput and cost.
Key takeaways
- Fine-tune for behaviour and format; use RAG for knowledge.
- A strong prompted baseline must be beaten first.
- Dataset quality decides the result.