What is Fine-tuning?
Also called: Model fine-tuning · LLM fine-tuning · Supervised fine-tuning · SFTDefinition
Fine-tuning is the process of taking a pre-trained model, such as a large language model, and training it further on a smaller, task-specific dataset so that it performs better on a particular task, format or style. The model’s weights are adjusted using example inputs and desired outputs. Parameter-efficient methods such as LoRA update only a small number of added parameters, reducing cost. Fine-tuning is good for consistent behaviour; it is usually not the best way to give a model new or changing facts.
A fine-tuning project starts with a high-quality dataset of examples showing the exact behaviour wanted, such as support replies in the company’s tone or documents classified into categories. The model is trained on these examples, then evaluated against a held-out test set and compared with the base model plus good prompting.
Fine-tuning can make a smaller, cheaper model perform a narrow task as well as a larger one, enforce a consistent output format, or capture a house style that is hard to describe in a prompt. It is widely used for classification, extraction and specialised writing tasks.
The commonest mistake is fine-tuning to add knowledge, which tends to be unreliable and goes stale; retrieval-augmented generation usually suits facts better. Others are training on too few or inconsistent examples, not comparing against a well-prompted baseline, and forgetting that a fine-tuned model must be re-evaluated and maintained as base models change.
Key points
- Further trains a pre-trained model on task-specific examples.
- Best for consistent style, format or narrow tasks.
- LoRA and similar methods reduce cost.
- Not the best way to add changing facts; use RAG.
- Compare against a well-prompted baseline before committing.
An example at work
An Ahmedabad logistics firm fine-tunes a small open model on several thousand labelled shipment emails so it can classify incoming requests into twelve categories faster and more cheaply than a large general model.
Where this is used at Bodhih
Related terms
Large language model
A large language model (LLM) is an AI model trained on vast amounts of text to understand and generate language by predicting the next token.
Retrieval-augmented generation
Retrieval-augmented generation (RAG) is a technique where an AI system retrieves relevant documents first and gives them to an LLM to ground its answer.
LLM evaluation
LLM evaluation is the systematic testing of a language model or LLM application against defined criteria to measure quality, accuracy and safety.
Machine learning
Machine learning is a branch of AI in which computers learn patterns from data to make predictions or decisions without being explicitly programmed for each rule.
Embeddings
Embeddings are numerical vectors that represent the meaning of text, images or other data, so that similar items sit close together mathematically.
More about Fine-tuning
When should you fine-tune an LLM instead of using RAG?
Fine-tune when you need the model to behave differently, such as following a strict format, adopting a house style or performing a narrow classification task reliably. Use RAG when the model needs facts that change or must be cited. Try good prompting first; fine-tune only if evaluation shows prompting and RAG are not enough.
What is LoRA fine-tuning?
LoRA, or low-rank adaptation, is a parameter-efficient fine-tuning method. Instead of updating all of a model’s weights, it trains small additional matrices that adjust the model’s behaviour. This needs far less memory and compute, and the resulting adapters are small files that can be swapped in and out.