AdvancedAbout 24 min

    RLHF & Alignment

    Read the full article on Substack

    6 min read.

    Walk through the full alignment pipeline — supervised fine-tuning, reward model training, and PPO — then see how DPO simplifies this by removing the RL loop entirely, and explore the failure modes that can make aligned models misbehave.

    Think of it this way: Pretraining produces a brilliant but unconstrained intern. SFT gives them a style guide. RLHF is running thousands of simulated performance reviews — the intern maximizes for your feedback score. DPO skips the simulation: you directly express preferences ("I liked answer A better than B") and math does the rest.

    1. 1
      Pretraining
      Next-token prediction on internet-scale text.
      A raw language model: fluent but uncontrolled.
    2. 2
      SFT
      Supervised fine-tuning on high-quality (instruction, response) examples.
      A well-behaved baseline policy, π_SFT.
    3. 3
      Reward model
      Train a reward model on human preference pairs: σ(RM(yw) − RM(yl)).
      RM(x, y) gives a scalar reward.
    4. 4
      PPO / RLHF
      Maximize E[RM(x, y)] − β·KL(πθ || π_SFT).
      An aligned policy: helpful, harmless, honest.

    Check your understanding

    Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.

    The RLHF pipeline

    Sequence

    Order the three training stages and what feeds them.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    1. 1Drop a step here
    2. 2Drop a step here
    3. 3Drop a step here
    4. 4Drop a step here
    5. 5Drop a step here
    6. 6Drop a step here
    6 pieces left to place

    Quiz

    20 questions
    Question 1 of 20
    Score: 0

    What does RLHF stand for?

    Done with this lesson?

    Sign in free to keep your progress, streak and quiz scores.

    Keep going