Fine-tuning is the practice of taking a model that has already been trained on a broad corpus of data — often a large language model such as one in the GPT or LLaMA family — and continuing that training on a smaller, carefully selected dataset. The goal is to nudge the model toward a narrower behavior: answering medical questions, writing in a specific brand voice, producing code in a particular framework, or reliably following a structured output format.
Unlike training from scratch, fine-tuning starts from learned representations rather than random weights. Because the heavy lifting of learning grammar, reasoning, and world knowledge has already happened, fine-tuning typically needs orders of magnitude less data and compute to produce meaningful improvements on a target task.
How fine-tuning works
In practice, engineers prepare a dataset of example inputs and desired outputs that represent the behavior they want the model to exhibit. For a customer support assistant, that might be hundreds or thousands of past ticket resolutions; for a code-review tool, it could be pairs of pull requests and reviewer comments. The pre-trained model then runs additional training passes over this dataset, and its weights are updated via standard gradient-based optimization so that the loss between predicted and target outputs decreases.
A simple mental model: imagine a general-purpose foundation model as a medical intern who has read every textbook. Fine-tuning is the residency that specializes them in radiology. Their underlying knowledge remains, but their day-to-day decisions become sharply focused on one domain.
Why it matters
Fine-tuning is the primary lever teams use to turn a general-purpose model into a dependable product component. It can raise accuracy on niche tasks, enforce house style, reduce hallucinations in a defined scope, teach tool-use patterns, and align outputs with safety or compliance requirements. For organizations with proprietary data or domain expertise, fine-tuning offers a way to encode that knowledge into the model itself rather than relying solely on prompts.
It also has economic value: a smaller, fine-tuned open model can often match the quality of a much larger general model on a specific workflow, lowering inference costs at scale.
Key types
- Supervised fine-tuning (SFT): training on labeled input–output pairs to teach a specific skill or format.
- Instruction tuning: a broad form of SFT that trains the model to follow natural-language instructions across many tasks.
- Parameter-efficient fine-tuning (e.g. LoRA, QLoRA): freezes most weights and trains only small adapter layers, cutting compute and storage costs.
- Reinforcement learning from human feedback (RLHF): uses human preference rankings to further align the model beyond supervised examples.
- Continued pretraining: unsupervised fine-tuning on raw domain text to inject vocabulary and knowledge before task-specific SFT.
Fine-tuning is most useful when prompting and retrieval alone cannot reliably hit the quality bar, when latency or cost rules out very large models, or when the desired behavior depends on patterns the base model has rarely seen. For an accessible overview, see Hugging Face's training documentation, and for the original recipe behind instruction-following models, see the FLAN paper.