Coders In Hoods
  • Courses
  • Roles
  • Blog
  • Setup

Coders In Hoods AI Academy

Every course is free. Sign in to start, and your progress, quiz scores and bookmarks follow you.

AI Academy

  • Courses
  • Paths
  • Setup guides
  • How we teach

Role roadmaps

  • AI Engineer
  • Forward Deployed Engineer
  • Machine Learning Engineer
  • All roles

Coders In Hoods

  • The agency
  • Coaching for teams
  • Blog
  • LinkedIn
  • X (Twitter)

Contact

codersinhoods@gmail.com

© Coders In Hoods · since 2019

Course overview

LLMs for Engineers

Free · sign in to start and track progress

1 · Inside the transformer

  • 1Tokens and embeddings
  • 2Attention, step by step
  • 3The transformer block

2 · How models are trained

  • 4Pretraining and scaling laws
  • 5Post-training an assistant

    Exercise answers

    • Answer: Build a verifiable reward and simulate GRPO advantages

3 · Running models in production

  • 6Sampling and hallucination
  • 7Context windows, KV cache and caching
  • 8Reasoning models and extended thinking
  • 9Choosing and comparing models
CapstoneChoose a model for document extractionReference implementation

Module 2 · How models are trained · Lesson 5

Post-training an assistant

How supervised fine-tuning, preference learning (RLHF and DPO), constitutional training and reinforcement learning with verifiable rewards turn a base model into an assistant, and the side effects each one leaves behind.

75 min 2 videos 3 exercises 7-question quiz Answers
Setup for the exercises:Install Claude CodePython with uv

By the end of this lesson you can

  • Describe the stages of a modern post-training pipeline and what each one adds
  • Compute a Bradley–Terry preference probability and explain how a reward model is trained from comparisons
  • Explain the KL penalty in RLHF and how DPO removes the explicit reward model
  • Compute group-relative advantages for RL with verifiable rewards (GRPO) and pick real tasks that have verifiable rewards
  • Connect sycophancy, reward hacking and over-refusal to the training signals that cause them

On this page

  • The pipeline at a glance
  • Stage 1: supervised fine-tuning
  • Stage 2: learning from preferences
  • A reward model
  • Optimising against it
  • DPO: skipping the reward model
  • Constitutional AI: principles instead of labels
  • Stage 3: RL with verifiable rewards
  • Worked example
  • Side effects you will meet in production
  • Summary
  • Sources & further reading
  • Quiz

In this lesson

  1. 01The pipeline at a glance
  2. 02Stage 1: supervised fine-tuning
  3. 03Stage 2: learning from preferences
  4. 04Constitutional AI: principles instead of labels
  5. 05Stage 3: RL with verifiable rewards
  6. 06Side effects you will meet in production
  7. 07Summary

Sources & further reading

  • Training language models to follow instructions with human feedback (InstructGPT)Paper · Ouyang et al. · OpenAI · 2022The canonical SFT → reward model → PPO pipeline. Figure 2 is the diagram everyone copies; Section 3.5 gives the objective with the KL term.
  • Constitutional AI: Harmlessness from AI FeedbackPaper · Bai et al. · Anthropic · 2022Replaces human harmlessness labels with a written set of principles, used for self-critique and for AI-generated preference labels (RLAIF). Read Sections 1 and 3–4.
  • Direct Preference Optimization: Your Language Model is Secretly a Reward ModelPaper · Rafailov et al. · Stanford · 2023Shows the RLHF objective can be optimised directly from preference pairs with a classification-style loss. Section 4 derives it.
  • Tulu 3: Pushing Frontiers in Open Language Model Post-TrainingPaper · Lambert et al. · Ai2 · 2024A fully open post-training recipe (SFT, DPO, then RL with verifiable rewards, a term this paper introduced). The best place to see every stage with real data.
  • DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language ModelsPaper · Shao et al. · DeepSeek · 2024Introduces GRPO, the critic-free RL algorithm behind many reasoning models. Section 4.1 has the group-relative advantage used in this lesson.
  • Towards Understanding Sycophancy in Language ModelsPaper · Sharma et al. · Anthropic · 2023Evidence that human preference data rewards agreeing with the user, and that assistants trained on it become sycophantic.
  • Claude's ConstitutionLab research · AnthropicThe document Anthropic uses to shape Claude's values and behaviour in training. Skim the overview to see what a production constitution looks like.
Free · sign in to start

Sign in to keep reading.

Free, no card. We use your account to save progress, quiz scores, bookmarks and occasionally send updates from our team.

  • 7 more sections
  • 3 hands-on exercises
  • A 7-question quiz
  • Progress, quiz scores and bookmarks