Act 3 · Frontier & Caveats
12. Teaching Models to Reason: STaR and Self-Improvement
In STaR, a model writes its own reasoning, an answer key discards what's wrong, and the survivors become its next training set.
1. Run the loop
The algorithm, explained. Start with a pretrained model and a stack of problems whose correct answers you know. There are no worked solutions, only the answers. For each problem, the model writes out its reasoning and ends with an answer. If that answer matches the key, the reasoning is kept. If it misses, the model gets one more try with the correct answer shown as a hint; if it now reasons its way there, the reasoning is kept and the hint is deleted from the record. Finally, the original pretrained model is fine-tuned on everything kept, and the loop starts over with a slightly better model writing the next round of reasoning.
This is STaR's loop.reference 1 It still needs a dataset, questions with correct answers, but nobody has to write the reasoning; the model authors that itself. Everything rests on the answer key: the correctness check that decides which rationales are allowed to train, and the external signal deciding what the model may study.
Algorithm
The same loop from section 1, in ten lines.
M ← M0one model is both student and teacherloop: until accuracy plateausexpert iteration (Anthony et al. 2017): the same loop, before LLMskept ← ∅for (x, y) in problems:the only supervision that exists: answers, never reasoningr, ŷ ← M(x)one greedy rollout: low variance, biased exploration; RFT (Yuan et al. 2023) samples k insteadif ŷ = y: keep (x, r, y)in RL terms: a binary reward, checked for free by section 1's answer keyelse:r′, ŷ′ ← M(x, hint = y)hindsight: knowing the destination makes the route easier to findif ŷ′ = y: keep (x, r′, y)the hint is stripped, so the model trains as if it had found the route unaidedM ← finetune(M0, kept)restart from the base model every round, so early quirks never compound into the weights2. Which reasoning goes into the training set?measured · Qwen2.5-3B-Instruct · 100 MATH-500 problems
Download the notebook (zip, 5.0 MB) ↓To understand how reasoning is selected for the training set, let's look at how STaR could work with Qwen2.5-3B-Instruct on 4 problems pulled from the MATH-500 dataset, below. We won't be showing the training itself; rather, we will focus on how the reasoning is selected for training in the first place.
Notice that when the model's answer does not match the answer key, the model still gets another chance, through rationalization. The model is re-prompted with the answer as a hint, and as long as it produces reasoning that leads to the correct answer, that reasoning trace is still stored. When rationalization is off, the model gets no second chances.
Press Play to run one pass of STaR on this problem.
The answer key for this problem:key81
Algebra · level 5
The greedy chain
What is the maximum value of 4(x + 7)(2 - x), over all real numbers x?
press Play to see its reply
Run the same pass on all 100 problems. How many put reasoning into the training set?
Why keep reasoning that was given the answer? The reasoning is what we want the model to learn, and the hint is removed before the trace is stored. In the STaR paper, rationalization raised accuracy on CommonsenseQA from 68.8% to 72.5%.reference 1
No human in the loop. Every trace in the training set was written by the model and checked only against the answer key: 43 from one greedy pass, 53 more from rationalization. The questions and their answer keys are reused; the model writes everything else. So the training set grows without drawing on the limited stock of human-written text that pre-training depends on.
Trained on reasoning, graded on answers. The answer key checks only the final answer, so a flawed argument that lands correctly is kept and imitated. Models often follow a wrong reasoning path to the right answer.reference 4 Here, 22 of the 53 rescued traces refer to the hint directly.