TheFocus.AI TheFocus.AI
05 the flywheel Lesson 13

Chapter 13: Rejection Sampling

The simplest self-improvement method that works: sample k rollouts per task, keep the verified winners, train on them, redeploy, score.

TUTOR WITH THEFOCUS.AI

Agent Integration

Copy this prompt into Claude, ChatGPT, or any external AI assistant. It points the assistant to the course instructions and links it to your student profile to track your progress and customize observations.

Please tutor me in this lesson using the following context. First, read the instructions at: https://courses.thefocus.ai/llms.txt My Student ID is: <none> The lesson markdown source is at: https://courses.thefocus.ai/fine-tune-local-agent/05-the-flywheel/13-rejection-sampling.md

You are not enrolled yet. Enroll to generate a Student ID to track lesson completions and store learning notes.

Chapter 13: Rejection Sampling

This is rejection sampling, sometimes called STaR (Self-Taught Reasoner) or expert iteration. It is the simplest self-improvement method that works, and coding is its best-case domain because the filter is free — your verifier from Part 4.

The Loop

Sample k = 4–8 rollouts per task at temperature ~0.8. Keep every rollout that passes tests. One task can contribute several successful trajectories, each a different valid path — that diversity is a feature, not noise.

Train on the winners. Redeploy. Score.

Every piece already exists:

  • Generation: the harness from Chapter 07
  • Verification: eval.py-style pass/fail from Chapter 12, populating outcome
  • Filtering: a one-liner over trajectory JSONL
  • Training: make train from Chapter 06
  • Scoring: the held-out eval set — which the flywheel never trains on

Watch For: The Plateau

The loop plateaus. After 2–3 rounds the model gets good at exactly the tasks it can already sometimes solve, and stops improving on the ones it never solves. Expected. The fix is harder tasks or a better base model, not more rounds.

Exit Criteria for the Whole Flywheel

Round n+1 scores higher than round n on held-out tasks, for at least two consecutive rounds, with no teacher in the loop.


← Part 5 Index · Next: Chapter 14 →

Previous Lesson 13 of 16 Next