Skip to content
learn
  1. Learn
  2. Artificial Intelligence
  3. Training, Fine-tuning and Alignment

AI-M06

Training, Fine-tuning and Alignment

How a raw pretrained model becomes a helpful assistant: supervised fine-tuning, preference tuning with RLHF and DPO, constitutional methods, LoRA, reasoning models and distillation.

9 lessonsabout 105 min

A pretrained language model can continue any text, but it does not yet answer questions, follow instructions or decline harmful requests. Those behaviours are trained in after pretraining, in a series of much smaller stages. This module walks through them in the order a model goes through them: supervised fine-tuning on example conversations, then preference tuning with human or AI feedback, then safety training.

You will see how RLHF uses a reward model and reinforcement learning, why DPO gets similar results with a single classification-style loss, and how written principles and AI feedback replace much of the human labelling. The practical lessons cover parameter-efficient fine-tuning with LoRA and QLoRA and a decision guide for choosing between prompting, retrieval and fine-tuning. The module closes with reasoning models that spend more compute at answer time, and with distillation and synthetic data, which make small models punch above their weight.

Lessons

  1. AI-06.01 The LLM training pipeline A chat assistant is built in stages. Intermediate 12 min
  2. AI-06.02 Supervised fine-tuning and instruction tuning Supervised fine-tuning trains a pretrained model on curated prompt and response pairs so it learns to follow instructions in a consistent format. Intermediate 12 min
  3. AI-06.03 RLHF Reinforcement learning from human feedback collects human rankings of model responses, trains a reward model to predict those preferences, and then optimizes the language model to score highly with that reward model, usually with PPO, while a penalty keeps it close to the original model. Advanced 15 min
  4. AI-06.04 DPO and other preference methods Direct preference optimization learns from pairs of preferred and rejected responses directly, with a simple classification-style loss, skipping the separate reward model and RL loop. Advanced 10 min
  5. AI-06.05 Constitutional AI and RLAIF Constitutional AI aligns a model using a written set of principles. Advanced 10 min
  6. AI-06.06 Parameter-efficient fine-tuning: LoRA and QLoRA Full fine-tuning updates every weight, which is expensive. Intermediate 14 min
  7. AI-06.07 Prompting vs RAG vs fine-tuning: choosing Use prompting first: it is fast and cheap to iterate. Intermediate 10 min
  8. AI-06.08 Reasoning models and test-time compute Reasoning models are trained, often with reinforcement learning on problems with checkable answers, to work through problems step by step before answering. Advanced 12 min
  9. AI-06.09 Distillation and synthetic data Distillation trains a smaller student model to imitate a larger teacher's outputs, keeping much of the capability at a fraction of the cost. Advanced 10 min

Start with lesson 1