Fine-tuning
Fine-tuning adapts an existing model on your own examples so it takes on a required style, format or narrow task. It changes the weights, unlike prompting and RAG, which work only with context.
How it works
You start from an already-trained model and nudge its weights on a set of request-and-desired-answer pairs. Training from scratch is unnecessary: the model already has language and world knowledge; only behaviour is being adjusted.
Usually not all weights are changed but a small addition to them, which makes the process thousands of times cheaper than full training and fits on a single GPU. The result is stored separately and attached to the base model.
Quality depends on the data rather than its volume. A few hundred carefully chosen examples beat tens of thousands of random ones: the model absorbs the mistakes too.
When it is needed and when not
- Needed: a strict output formatWhen a model must always answer in one structure, fine-tuning is more reliable than a long instruction in the prompt.
- Needed: your own voice or jargonAn editorial tone and industry terminology transfer through examples better than through description.
- Not needed: adding knowledgeFor facts there is RAG. Fine-tuning memorises specific information poorly and offers no way to update it.
- Not needed: try prompting firstA large share of tasks that fine-tuning is commissioned for are solved by a precise request and a couple of examples.