Generative AI · Advanced level

Advanced level · Module 3 of 12 · 13 guided hours

Foundation Model Adaptation

When and how to adapt models: choosing between prompting, RAG and fine-tuning; preparing instruction datasets; supervised fine-tuning with TRL on small models; and an overview of preference and reinforcement fine-tuning.

Learning objectives

  • Choose the right adaptation approach
  • Prepare instruction datasets
  • Run supervised fine-tuning on a small model and understand preference tuning

Topics

  • prompting vs RAG vs fine-tuning
  • instruction datasets and chat templates
  • data quality and licences
  • supervised fine-tuning with TRL
  • preference tuning (DPO) overview
  • reinforcement fine-tuning overview

Lessons

  1. Lesson 1 Prompting, RAG or Fine-Tuning?

    Learners decide which adaptation fits a need: prompting for behaviour, RAG for knowledge, fine-tuning for consistent style, format or specialised skills.

    promptingRAG for knowledgefine-tuning for behaviour and formatcost and maintenancedecision tree

  2. Lesson 2 Preparing Instruction Data

    Learners build a small, clean instruction dataset (instructions and ideal responses) in the chat format of the target model, with licence and privacy checks.

    instruction–response pairschat templatestrain/validation splitdata licencespersonal data removal

  3. Lesson 3 Supervised Fine-Tuning and Preference Tuning

    Learners run supervised fine-tuning on a tiny model with TRL's SFT trainer, evaluate it against the base model, and study preference (DPO) and reinforcement (GRPO) fine-tuning conceptually.

    SFTTrainerepochs and learning ratebase vs fine-tuned evaluationDPOGRPO

Practical activity

Make and document an adaptation decision for the capstone, build an instruction dataset, and fine-tune a tiny model with SFT, comparing it with the base model.

Expected outcomes

  • Sound adaptation decisions
  • Practical supervised fine-tuning

Assessment

Dataset and datasheet (40%) and fine-tuning experiment (60%).

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.