Search⌘ K
AI Features

Fine-Tuning Foundation Models

Explore the core fine-tuning methods for foundation language models. Understand supervised fine-tuning, instruction tuning, and reinforcement learning from human feedback to customize models for specific tasks. Learn when to select each technique, their data needs, and practical tips to optimize training while avoiding common pitfalls.

The previous lesson showed that pre-training a foundation model from scratch costs millions of dollars and demands massive datasets, making it justified only in narrow circumstances. Fine-tuning offers a far more accessible route to customization. Instead of building a model’s knowledge from zero, fine-tuning takes a pre-trained foundation model and continues training on a smaller, task-specific or domain-specific dataset so the model’s weights shift toward the target behavior. Think of it like onboarding a new employee who already speaks the language fluently but needs to learn your company’s specific processes, terminology, and tone.

Consider a concrete scenario. A customer-support team needs an LLM to follow company tone guidelines and reference internal product documentation accurately. The base model already understands language, grammar, and general knowledge. What it lacks is the specific behavior the team requires. Fine-tuning bridges that gap by adjusting the model’s parameters with targeted examples, without rebuilding everything from the ground up.

Fine-tuning sits between the extremes of full pre-training and zero-parameter in-context learning, offering a middle ground of cost, control, and performance. This lesson covers the three primary techniques that make this possible: supervised fine-tuning, instruction tuning, and reinforcement learning from human feedback (RLHF).

Supervised fine-tuning

Supervised fine-tuning (SFT) is the simplest and most direct form of fine-tuning. The model is trained on labeled input-output pairs where each example demonstrates the desired behavior for a specific task, such as sentiment classification, entity extraction, or summarization. If you have a dataset of customer reviews labeled as “positive,” “negative,” or “neutral,” SFT trains the model to reproduce those labels given similar inputs.

Data requirements and mechanics

The data requirement for SFT typically ranges from hundreds to tens of thousands of high-quality labeled examples, depending on task complexity. A straightforward binary classification task might need only a few ...