Fine-Tuning
Continuing a pretrained model's training on a smaller dataset to adjust its behavior.
What Is Fine-Tuning
Fine-tuning is the process of taking a pretrained large language model and continuing its training on a smaller, more specific dataset in order to adjust its behavior, tone, or knowledge for a particular use case. Unlike prompt engineering, which only changes the input sent to a model, fine-tuning updates the model's internal parameters, producing a new version of the model.
How It Works
Fine-tuning starts from an existing base or instruction-tuned model rather than training from scratch, which requires far less data and compute than the original pretraining process. A curated dataset of example inputs and desired outputs is fed through the model, and its weights are adjusted to reduce the difference between its predictions and the target outputs. Common approaches include full fine-tuning, which updates all of a model's parameters, and parameter-efficient methods such as LoRA, short for low-rank adaptation, which update a small number of additional parameters while leaving the original weights mostly unchanged, reducing cost and storage requirements.
When to Use Fine-Tuning
Fine-tuning is typically considered after prompt engineering has been exhausted, and is best suited to cases such as teaching a model a consistent style or format across many examples, adapting it to a narrow domain with specialized terminology, or reducing prompt length and latency by baking repeated instructions into the model itself. It is generally not the right tool for adding fresh or frequently changing factual knowledge, since that requires retraining whenever the underlying facts change, which is slower and more expensive than simply retrieving current information at request time.
Fine-Tuning vs Retrieval-Augmented Generation
Fine-tuning and retrieval-augmented generation solve different problems and are often used together. Fine-tuning changes how a model behaves or writes, while retrieval-augmented generation gives a model access to current or private information without modifying its parameters. A model fine-tuned to produce consistent, well-formatted answers in a specific style can still benefit from retrieval to ground those answers in accurate, up-to-date facts.
Tradeoffs
Fine-tuning requires a quality dataset, computing resources, and ongoing maintenance, since a fine-tuned model needs to be retrained or re-evaluated whenever the base model is updated or the target behavior changes. It also produces a model tied to a specific version and provider, which can complicate switching providers later. For many applications, careful prompt engineering combined with retrieval covers the same needs with considerably less operational overhead.