Supervised fine-tuning (SFT)
Definition
Fine-tuning on labelled input and output pairs so the model learns to produce the target output for each input.
In more detail
SFT is usually the first step of post-training and the most common form of fine-tuning for applications. Quality and consistency of the examples matter far more than quantity.
The data is a set of prompts with the responses you want, often a few hundred to a few thousand for an application. SFT is good at teaching format, tone and a narrow task, and poor at adding fresh knowledge, which retrieval handles better. Hold back a test set, compare against a well-prompted base model, and check that general abilities did not degrade.
Related terms
Fine-tuning
Further training a pretrained model on task-specific examples to change its behaviour, format or style, rather than its general knowledge.
Post-training
Training after pretraining that shapes a model's behaviour, including instruction tuning and preference or reinforcement learning.
RLHF
Reinforcement learning from human feedback: training a model with a reward signal learned from people's preferences between two outputs.
Read more about Supervised fine-tuning (SFT)
- TRL
Hugging Face's post-training library: supervised fine-tuning, DPO, GRPO and reward models.
- Fine-tuning
Further training a model on task-specific examples, and knowing when RAG is enough.
- LoRA
Low-Rank Adaptation: a fine-tuning method that freezes the model's weights and trains small added matrices instead, cutting memory needs.