Cold Starts, Rejection Sampling, and Distillation
Learn how reasoning pipelines produce, filter, and imitate traces through cold-start supervision, verifier-filtered rejection sampling, and distillation.
Language AI HandbookAll chapters Cold Starts, Rejection Sampling, and Distillation
Reasoning pipelines can use supervised examples at different stages. An initial set can demonstrate the response format, verifier-filtered candidates can supply later targets, and teacher responses can guide a student. These are interventions that can be combined or used independently.
Cold-start fine-tuning uses curated examples before a later stage. Rejection sampling filters generated candidates. Distillation trains a student on a teacher’s sequences or probability distributions. They can share a supervised training loss even when their targets come from different sources or are created in different ways.
The unifying object is the trace: a sequence of tokens that describes intermediate steps and ends in a short answer. Everything in this chapter is about how traces are produced, filtered, and imitated. We will work through the mechanics of each stage, then build a small CPU-sized simulation that makes the failure modes concrete, and we will be careful, throughout, to distinguish what the small simulation shows from the behavior of DeepSeek-R1, with 671B total parameters.
Cold start can demonstrate a response format, verifier filtering selects examples from a proposal pool, and distillation fits a student to teacher targets. The stages can share training examples. Tracing who proposed the examples, how they were selected, and which model learned from them helps identify where an error entered the pipeline.
Cold-start supervision
Cold-start supervision can make training examples easier to parse and provide patterns the proposal policy rarely generates. It is optional. DeepSeek-R1-Zero used reinforcement learning with no preliminary supervised fine-tuning. DeepSeek-R1 report, abstract and §2.3.1
Format sparsity arises when correct attempts do not use the answer format the verifier expects. If an outcome-only check cannot parse the answer it may give that attempt zero reward. Other rewards, baselines, and regularizers can still contribute an update.
An outcome reward can support a policy-gradient update for a direct answer when its advantage is nonzero. A longer trace makes intermediate actions visible, but a reward on the final answer does not itself label which steps were valid.
A small rollout pool can contain few successes. If independent rollouts each succeed with probability , the probability that a pool of includes at least one success is . This does not tell us whether failed rollouts contribute a policy update.
The figure shows how often a fixed pool includes a success as the number of independent attempts increases. It does not measure optimizer updates.
PythonIn [2]Expand
import numpy as np
attempt_counts = np.arange(1, 33)
base_success_rates = [0.02, 0.10, 0.30]
success_curves = [
(rate, 1.0 - (1.0 - rate) ** attempt_counts) for rate in base_success_rates
]VisualizationOut [3]Expand

The probability that every step is correct can be factored into the probability each step is correct given that the preceding steps were correct. A higher success rate increases expected yield. The mix of successful strategies also depends on how often each strategy is proposed and how often it succeeds.
A verifier with a blind spot can favor a narrow set of attempts that are easier to pass. A curated dataset can demonstrate alternative approaches, but whether they persist after training depends on the objective and which samples receive weight.
The DeepSeek-R1 report describes thousands of long cold-start examples and several ways to obtain them, including prompts and post-processing by annotators. It discusses readability and answer summaries. It describes an intervention for this training run, not a universal threshold.
A set of curated supervised demonstrations used before a later training stage. It can show the policy an answer schema, reasoning pattern, or response style. Choose the set size for the task and measure whether the desired behavior becomes more frequent.
Next-token training increases the objective weight on demonstrated targets at their training prefixes. It can encourage the response format and show a way to decompose a problem. Measure whether sampled responses follow the format, and use held-out tasks to test whether decomposition transfers. A later verifier can select responses that pass its checks.
Curated examples can reflect the style and methods their authors chose. A set drawn from one contributor pool or template may represent a narrow set of strategies. That motivates measuring transfer with prompts and methods that did not contribute to the training set.
Suppose a set only demonstrates fact recall. It supplies no direct examples of decomposing an unfamiliar problem. A later stage could still introduce those examples or the model could already know the strategy. The cold-start data alone cannot tell us what the final policy will learn.
Rejection sampling with verifiers
In a verifier-filtered training pipeline, sample responses to a prompt, keep the ones that pass and fit the surviving examples. The proposal policy can be a base model or a later checkpoint. DeepSeek-R1 applied this step after cold-start supervision and reasoning-oriented RL.
The procedure is simple.
- For each prompt in a problem set, sample traces from the current policy . Choose the budget based on generation and verification cost and the observed yield of usable examples.
- Apply a binary gate . An exact checker can return pass or fail directly, for example by comparing the boxed answer with the reference. For a real-valued outcome score, use a binary decision rule, such as accepting scores above a threshold. Step scores need an aggregation or acceptance rule, such as requiring every scored step to pass.
- Keep all accepted traces and discard the rest.
- Fine-tune the policy (or a student) on the surviving traces with standard cross-entropy.
The math is worth writing down because it clarifies what the resulting dataset is and is not. The sampling distribution over accepted traces is
The denominator is the acceptance probability for that prompt and must be positive. If judgment is stochastic, replace the indicator in both places by . A deterministic gate recovers conditioning on correctness if it accepts exactly the correct traces on the proposal support and correct traces have positive mass. A verifier error changes which targets survive and can affect the model fitted to them.
The formula has a direct visual consequence: a small false-positive rate is not harmless when the base policy is already much more likely to produce wrong traces than correct ones.
PythonIn [4]Expand
import numpy as np
epsilon_fp = np.linspace(0.001, 0.5, 101)
epsilon_fn = 0.05
base_odds = [0.1, 1.0, 10.0]
bias_curves = [
(odds, odds * epsilon_fp / (1.0 - epsilon_fn)) for odds in base_odds
]VisualizationOut [5]Expand

Suppose prompts occur with mass , each receives candidates, and each candidate has pass probability at that prompt. Under a keep-all rule, expected accepted counts are proportional to . These also give the weights in the accepted-row population after pooling across batches. With equal budgets the factor cancels. A realized finite pool uses its actual accepted counts, which can give different weights. A per-prompt cap can also change the weights. Report how many prompts are covered as well as how many rows survive.
DeepSeek-R1 collected about 600,000 reasoning examples by filtering outputs of the reasoning-RL checkpoint. A subset used DeepSeek-V3 to judge the generated answer against the reference. About 200,000 non-reasoning examples came from the DeepSeek-V3 pipeline, which reused some of its existing supervised data. The large model used the combined set for supervised fine-tuning before another RL stage. The smaller models reused that same set. DeepSeek-R1 report, §§2.3.3–2.4
The large-model supervised stage and the smaller-model distillation stage can use the same examples. Their training purposes differ: one is an intermediate stage for the large model, while the other supplies targets to the smaller models. This reuse is distinct from sampling another independent dataset.
In on-policy RL, the current policy generates rollouts, and a verifier can supply part of their reward. The optimizer uses that reward to estimate a policy-gradient update. In verifier-filtered supervised training, a proposal model generates the examples, a verifier determines which examples enter the dataset, and a model fits those fixed targets with cross-entropy. The proposal model and the model being fit can be different.
- Fixed-target cross-entropy does not estimate a policy-gradient reward on fresh rollouts for each fitting step. Generation, scoring, and fitting all contribute to cost.
- Rejection sampling is bounded by the quality of the filter, because whatever gets past it becomes a target.
- On-policy sampling can discover rare traces with positive probability that did not appear in an earlier finite batch. A trace with exactly zero proposal probability cannot appear in a draw from that policy. Access requires a proposal or exploration change that gives the trace mass, or an outside source of examples.
DeepSeek-R1 is a documented example of combining cold-start supervision, reasoning RL, verifier-filtered supervised training, and a further RL stage. The stage order reflects what its designers chose to measure and train on.
Filtering can only retain responses present in the proposal pool. Drawing more candidates may reveal a low-probability strategy. If the current sampler excludes that strategy, a different teacher or a change to the proposal distribution is needed to add it directly to the dataset.
STaR and iterative bootstrapping
STaR is a documented example of using generated rationales as later training data. Its method makes the distinction between an observed correct answer and an answer-conditioned explanation concrete. STaR, §3 and Algorithm 1
By default, the STaR experiments add a few worked examples with rationales to each generation prompt. Each round follows this procedure. STaR, §§3.1 and 4.1
- Greedily decode a rationale and final answer for each problem using the current model. Keep the examples whose answers match the reference.
- For each initial miss, add the known answer to its prompt as a hint and ask the same model for another rationale and answer. Keep it if the generated answer matches . Remove the hint from the supervised input.
- Combine the successful examples from both passes in that round. Start from the original pretrained weights and fine-tune on that combined set.
- Use the fitted model to generate examples in the next round.
STaR calls the hint-conditioned pass rationalization. It can add examples from problems that the model missed on the first pass. STaR, §§3.1–3.2 and Algorithm 1
A rationale from the second pass can contain a valid derivation even when the model missed the answer unaided. It can also reach the correct answer through an invalid step. The answer-match filter accepts both.
The STaR authors describe unsupported conclusions and other logical fallacies among generated CommonsenseQA rationales. That observation illustrates the distinction between checking an answer and checking the steps that lead to it. STaR, §4.4 and Appendix A
The same risk applies to distillation. Answer accuracy can improve without showing whether each displayed step is valid or causally reflects how the student reached its answer. A process reward model can score step validity when trained for that purpose. A separate experiment is needed to test causal faithfulness. Lightman et al., §2
In practice, STaR-style iteration is:
- Report retained count and prompt coverage across the passes in use.
- If those passes produce few usable examples, there may be too little data to fit. If usable yield varies across prompts, a keep-all pool can overrepresent the prompts that pass most often.
- A systematic verifier error can recur in later batches if fitting changes which responses the policy proposes. Measure the direction and magnitude of the change.
Each round uses the previous fine-tuned policy to generate more candidates. An informative filter can help, but the possibility of a biased filter makes a separate held-out evaluation valuable.
Iteration changes the proposal pool, so the filter can face different types of responses in later rounds. There is no universal rate at which a particular error must compound.
Verifier filtering for training and best-of- at inference
Here, verifier filtering supplies examples for fitting, and best-of- selects a response for one inference request. Acceptance rules can also be used at inference. The distinction in this comparison is what happens to the selected response.
Best-of- inference. At inference time, sample candidate traces for prompt from a fixed policy . Assign each a score and return the candidate with the highest score. The model parameters stay fixed. The expected score of the selected trace is
where the expectation is over independent candidates. If the score equals binary correctness, the expectation is the probability that at least one candidate is correct, for per-draw success probability . With an imperfect ranker, measure the true correctness of the selected candidate.
If , one draw succeeds with probability 0.1. Sixteen independent draws give roughly 0.81 probability that the pool includes a success. A perfect ranker realizes that gain in selected accuracy. With an imperfect ranker, the extra draws can also give a high score to an incorrect answer.
Rejection sampling for training. Offline. The samples are filtered, the survivors are collected into a dataset, and the model is fine-tuned. Evaluate on held-out prompts with one sample per prompt if the aim is to isolate single-draw performance.
Verifier-filtered fitting spends compute ahead of serving to change a model's parameters. Best-of- adds generation and scoring at serving time. The two can be combined by using the fitted model as the inference proposal. Measure both its single-draw accuracy and its selected accuracy on held-out prompts.
For one fixed prompt under a perfect oracle, suppose a pool of 64 independent attempts succeeds with probability 0.70. The chance all 64 fail is 0.30. If each attempt has the same success probability , then
That is about 1.86% per draw for this prompt. Across prompts with varying success probabilities, oracle pass@ averages the per-prompt success probabilities after applying the pool formula. The single-prompt inversion does not recover mean single-draw accuracy from that aggregate.
Filtered training needs an acceptance decision for each candidate in the offline pool. Best-of- needs an ordering within each request's pool. A score can rank the correct candidate first while putting a wrong candidate above the filter threshold. Judge cost, reproducibility, and accuracy matter in both settings.
Compare offline generation, scoring, and fitting costs with the repeated cost of generating and scoring candidates for each served request. Request volume and latency determine whether the online cost fits the budget. Compare the measured task quality under each use of the verifier.
Distillation: hard targets, soft targets
Distillation fits a student to targets supplied by a teacher. DeepSeek-R1 used the same roughly 800,000 training examples for the large model's intermediate supervised stage and the smaller Qwen and Llama models. The student checkpoints ranged from 1.5B to 70B parameters and included Llama-3.3-70B-Instruct. The report describes supervised fine-tuning for those students without an RL stage. DeepSeek-R1 report, §2.4
The sequence-level and logit-level variants are worth separating carefully.
Hard-target sequence distillation. Let be a fixed dataset of prompt and teacher-response pairs . The response can come from stochastic sampling, deterministic decoding, or a filtered teacher proposal. The student objective over this fixed dataset is
The hard target supplies one token at each visited prefix. If averaging over newly sampled teacher responses instead of a fixed dataset, the population objective also averages over for each prompt. With fixed deterministic decoding the response is a function of the prompt.
Kim and Rush compared word-level and sequence-level distillation for machine translation. A hard sequence target can be chosen from the teacher’s output and then used in ordinary supervised training. Student free-running prefixes can still differ from those seen during training. Kim and Rush, §§3–4
Soft-target distillation. On the same fixed prompt and response pairs, the teacher gives a next-token distribution at each visited prefix. The student uses these distributional targets:
Here is the teacher next-token distribution and is the student distribution on the same token categories. Both are evaluated on shared training prefixes . Temperature can change how much probability mass each distribution allocates to alternatives. The displayed equation is cross-entropy at the chosen temperature; specifying any temperature or auxiliary hard-label terms is a separate design choice. Hinton, Vinyals, and Dean, §2
Hard-target distillation is a special case of soft-target distillation in which is a Dirac mass on the teacher's sampled token. Both are valid; they trade off against different concerns.
- Hard targets are straightforward to generate with a text-only teacher and can be retokenized. A chosen response gives the student a precise target for each visited context.
- A single hard target does not tell the student how the teacher scored alternative tokens. Quality depends on the teacher output and dataset selection, and calibration is a separate empirical question.
- Soft targets provide information about alternatives at the training prefix. Exact token-level comparisons require compatible categories or an explicit mapping. Better agreement with the teacher need not improve task accuracy or calibration.
Kim and Rush report results for a machine-translation setup. Their work distinguishes matching teacher token distributions from fitting a sequence selected using the teacher. It does not establish that one method dominates for long reasoning traces. Kim and Rush, §§4–5 and Table 1
Hard targets give the selected token at each visited prefix. Soft targets also give the probabilities of the alternatives at those same prefixes. Neither loss follows branches absent from the training-prefix set. At a fixed prefix, averaging one-hot targets sampled from the same teacher distribution gives that distributional cross-entropy in expectation. The practical difference depends on teacher concentration and prefix coverage.
In that example, the reasoning rows were filtered outputs of the earlier reasoning-RL checkpoint. The non-reasoning rows came from the DeepSeek-V3 pipeline. The report calls student training on this mixture distillation. The role of a teacher in building a corpus can involve proposing or judging rows at different stages.
A student may perform differently across trace lengths or problem types. The following figure makes a hypothetical length pattern explicit. It models a chosen scenario and gives no estimate for a language model.
Longer outputs consume more decoding steps. To compare models across length groups, record how prompts are grouped and whether length is a task property or an outcome of the model’s own generation.
The following illustrative calculation makes the shape of that length dependence explicit. The curves use logistic parameters for a teacher with a longer effective horizon and a student with a shorter one; they are a mechanism sketch, not a fitted model of any specific system.
PythonIn [6]Expand
import numpy as np
trace_lengths = np.arange(20, 421, 10)
teacher_curve = 0.90 - 0.45 / (1.0 + np.exp(-(trace_lengths - 320.0) / 45.0))
student_curve = 0.82 - 0.75 / (1.0 + np.exp(-(trace_lengths - 160.0) / 35.0))VisualizationOut [7]Expand

Verifier errors and selection bias
A verifier is a classifier from (trace, problem) to . Like any classifier it can be wrong in two directions, and the two directions have asymmetric effects on training data.
Let be the false-positive rate: the probability the verifier accepts a trace that is actually incorrect. Let be the false-negative rate: the probability the verifier rejects a trace that is actually correct. For a correctly generated trace, the survival probability of rejection sampling is . For an incorrect trace, it is .
For equally frequent correct and incorrect traces, the accepted wrong-to-correct odds are . At false-positive rate and false-negative rate, this is approximately . The wrong-to-correct odds decrease relative to the proposal pool. Most retained traces can still be wrong when initially correct candidates are sufficiently rare.
For a fixed prompt , let indicate true correctness and let mean that the verifier accepts the trace. The false-positive rate is , and the true-positive rate is . Measure both on the same proposal population. With positive mass in both classes and positive accepted correct mass, Bayes’ rule yields
These are class odds, not a ratio for two individual traces. Fitting accepted examples targets the retained distribution. A finite dataset and a limited model need not reproduce that distribution or any particular verifier error.
False negatives remove correct responses and can underrepresent particular successful strategies. False positives place incorrect responses among the supervision targets. Precision alone does not indicate whether one valid type of response is systematically missing.
Verifier errors may favor a particular strategy or response format. Even independent false positives can change the composition of the retained pool. In a dataset audit, estimate error rates on the deployment or training distribution you actually want to characterize.
Verifier accuracy can change when the student generates a different mix of formats or responses from those seen during verifier training. Audit on the intended deployment or training distribution. A deliberately shifted evaluation set can answer a separate question about robustness.
A static audit dataset can stay unchanged as effective false-positive and false-negative rates on current proposals move. Audit a fresh sample from each proposal population if the aim is to detect that shift.
The practical mitigations are straightforward:
- Use a deterministic check where it reliably decides the desired condition, and use a fallback where it cannot. Audit both branches; a definitive rule can still accept systematic errors.
- Audit a representative sample of accepted responses to estimate retained precision. To estimate recall and both class-conditional error rates, label rejected responses as well. Weight the strata by their prevalence in the proposal pool.
- Group traces by problem identity when splitting data. If the target is transfer to unseen multiplication facts, put both operand orders in the same split. The toy below holds out ordered prompts only.
- Compare successive rounds on a validation set that is separate from the final held-out evaluation. Stop or revise the filter when the measured tradeoff stops improving.
Repeated selection can amplify, reduce, or preserve a particular bias. With a fixed deterministic acceptance set and an exact refit to its first conditional proposal distribution, applying that same filter again leaves the distribution unchanged for the fixed prompt.
Worked example: one product, two verifiers
To make the mechanics concrete, consider a single problem, , with true answer . Suppose the policy generates the following five attempts, all with trace text omitted for clarity, and suppose the verifier has the even-product bug described below.
| # | Strategy | Boxed answer | True correctness | Buggy verifier | Strict verifier |
|---|---|---|---|---|---|
| A | fact recall | correct | accept | accept | |
| B | fact recall | (near miss) | incorrect | accept (even) | reject |
| C | guess | incorrect | accept (even) | reject | |
| D | repeated addition | correct | accept | accept | |
| E | repeated addition | (off by one) | incorrect | reject (odd) | reject |
The verifier bug is: "when the true product is even, any even answer is accepted." This is a stand-in for classes of real verifier errors, such as checking only the last digit, checking the range, or partial-matching against the reference. It is unrealistic as a single rule; it is realistic as a shape of error.
The permissive verifier retains , including two incorrect targets. One of them is an even guess. The strict verifier retains only . This tells us which targets enter training; it does not establish that a fitted student generalizes a guessing rule.
Trace B is incorrect by two and passes the permissive verifier because 54 is even. Excluding it removes that particular wrong target from the training set.
The exact checker keeps one fact-recall and one repeated-addition response for . Both answers are correct. Testing a fitted student is a separate step.
That is the story the toy implementation in the next section makes measurable.
Separating verifier and policy measurements
Consider 1,000 proposals that contain 20 correct answers. If the verifier accepts 95 percent of correct responses and 10 percent of wrong responses, the expected accepted counts are 19 and 98. That makes the expected counts add to 117, though the sample actually observed may differ. About 84 percent of the accepted mass is wrong. The important denominator here is the number of accepted candidates, rather than the total number sampled. Reporting that the verifier catches 19 out of 20 correct responses describes recall; it tells you little about the purity of material you train on when successes are rare.
For a fair comparison of two verifiers, draw one candidate pool and apply both filters to it. Use an independent correctness criterion to score the same rows. This controls for changes in both the prompt mix and the proposal policy. Later, if you rerun the comparison on a newly trained policy, record which pool each verifier saw. A change in retained accuracy could reflect a changed policy, a changed mix of prompts, a different verifier, or some combination of those changes.
It helps to log both the rate of retained attempts and the fraction of prompts represented at least once. With a fixed cap per prompt, a few easy prompts may contribute many fewer duplicate examples than they would under a keep-all rule. A prompt contributes no supervised example under either rule if none of its sampled responses passes the verifier. An audit that samples uniformly from retained rows will tend to see whatever kinds of prompts are abundant in those rows. If coverage of difficult prompts matters, measure that coverage separately and use an audit sample that includes difficult prompts.
Keep the units straight when comparing students. Accuracy belongs to the held-out task. Agreement measures whether a candidate follows the teacher's distribution or top choice. Mean maximum probability measures concentration of predicted probabilities. A student can predict the teacher's preferred strategy less often and still perform similarly on the task if several strategies often succeed. In that case a teacher-agreement metric helps diagnose what transferred, while the task score remains the criterion for whether the system solved the assigned problem.
A CPU-sized implementation
The example fits a three-strategy policy, queries a seeded stochastic simulator, scores the resulting answers with two verifiers, and compares those filters on the same proposals. Strategy labels stand in for token sequences so we can examine selection and target distributions without training a language model.
The toy is not an estimate of how any deployed model performs. Its numbers are illustrative of the direction and mechanism of each effect, nothing more.
The hidden setup cell calls seed_book_plots() to seed the plot random generators. The figure cells apply the shared style. The simulator uses the imports and seeded random generator in the displayed setup below.
The 64 problems are ordered pairs with both operands from 2 through 9. NumPy’s seed-7 permutation leaves the last 16 ordered pairs for evaluation and the other 48 for fitting. Ten of the held-out pairs have their reverse in training. The split excludes identical ordered prompts but not every previously seen multiplication fact.
PythonIn [9]Expand
import numpy as np
import pandas as pd
rng = np.random.default_rng(7)
PAIRS = [(a, b) for a in range(2, 10) for b in range(2, 10)]
perm = rng.permutation(len(PAIRS))
train_pairs = [PAIRS[i] for i in perm[:48]]
heldout_pairs = [PAIRS[i] for i in perm[48:]]
STRATEGIES = ["fact_recall", "repeated_addition", "guess"]
STRAT_TO_ID = {s: i for i, s in enumerate(STRATEGIES)}
N_STRATS = len(STRATEGIES)ConsoleOut [10]Expand
Total problems: 64 Train problems: 48 Held-out problems: 16 Example train problem: (4, 2) -> 8 Example held-out problem: (3, 9) -> 27
Each problem gets a small feature vector. The features include the operands and their exact product. This toy assumes the product is already available to the policy when it selects a strategy label. Held-out accuracy here compares strategies under that assumption rather than testing arithmetic fact learning.
PythonIn [11]Expand
def features(a, b):
prod = a * b
return np.array(
[
1.0,
0.1 * a,
0.1 * b,
0.02 * prod,
0.1 * (a + b),
0.1 * abs(a - b),
float(a == b),
float(min(a, b) <= 4),
float(max(a, b) >= 7),
],
dtype=float,
)
X_train = np.stack([features(a, b) for a, b in train_pairs])
X_held = np.stack([features(a, b) for a, b in heldout_pairs])The oracle knows the true product exactly. The three strategies are simulated as follows:
fact_recallis correct with probability . When wrong, it produces a near-miss offset from . With probability it forgets to format the answer, which the verifier treats as rejection.repeated_additionis correct with probability . When wrong, it slips by or .guessproduces a uniformly random integer in . Its expected accuracy is .
These probabilities are simulator settings. Repeated addition has success probability 0.75 for every pair, so it is the best action everywhere in this toy. Always choosing it attains the 0.75 ceiling. The experiment compares how filters and teacher targets affect fitted policies under that known ceiling.
PythonIn [12]Expand
P_CORRECT = {
"fact_recall": 0.60,
"repeated_addition": 0.75,
"guess": 1.0 / 80.0,
}
def run_strategy(name, a, b, rng):
correct = a * b
if name == "fact_recall":
if rng.random() < 0.60:
ans = correct
else:
offset = int(rng.choice([-1, 1, -a, a, -b, b]))
ans = max(2, correct + offset)
formatted = rng.random() > 0.08
return {"strategy": name, "answer": ans, "formatted": formatted}
if name == "repeated_addition":
if rng.random() < 0.75:
ans = correct
else:
ans = max(2, correct + int(rng.choice([-1, 1, -2, 2])))
return {"strategy": name, "answer": ans, "formatted": True}
if name == "guess":
ans = int(rng.integers(2, 82))
return {"strategy": name, "answer": ans, "formatted": True}
raise ValueError(name)The two verifiers implement the two error modes from the worked example. The strict verifier requires a parseable response and exact value. The buggy verifier accepts any even answer when the true product is even, and rejects unformatted traces.
PythonIn [13]Expand
def verifier_buggy(trace, a, b):
if not trace["formatted"]:
return False
correct = a * b
if trace["answer"] == correct:
return True
if correct % 2 == 0 and trace["answer"] % 2 == 0:
return True
return False
def verifier_strict(trace, a, b):
if not trace["formatted"]:
return False
return trace["answer"] == a * bThe student is a linear softmax over strategy labels. Its expected task accuracy averages the probability of producing the correct numeric value on a held-out problem. Both verifiers also require the answer format, so a numerically correct attempt can fail either filter.
PythonIn [14]Expand
def softmax(Z):
Z = Z - Z.max(axis=1, keepdims=True)
E = np.exp(Z)
return E / E.sum(axis=1, keepdims=True)
def fit_softmax(X, Y, epochs=400, lr=0.1, l2=1e-4):
N, D = X.shape
C = Y.shape[1]
W = np.zeros((D, C))
for _ in range(epochs):
P = softmax(X @ W)
G = X.T @ (P - Y) / N + l2 * W
W -= lr * G
return W
def predict_proba(W, x):
return softmax(x.reshape(1, -1) @ W)[0]
def expected_accuracy(W, pairs):
total = 0.0
for a, b in pairs:
p = predict_proba(W, features(a, b))
total += sum(p[i] * P_CORRECT[STRATEGIES[i]] for i in range(N_STRATS))
return total / len(pairs)expected_accuracy is the student's expected accuracy on a set of problems, computed analytically from its strategy mixture and the per-strategy accuracy. It is a clean way to evaluate without a sampling step, and it isolates the policy's accuracy from simulator noise. We report it on the held-out problems.
The cold-start set is a small collection of preset strategy labels restricted to training prompts. A softmax can assign positive probability to a strategy even if that strategy has no explicit label in the set.
PythonIn [15]Expand
cold_start_examples = [
(2, 3, "fact_recall"),
(2, 4, "fact_recall"),
(3, 3, "fact_recall"),
(3, 4, "fact_recall"),
(2, 5, "fact_recall"),
(2, 6, "fact_recall"),
(2, 5, "repeated_addition"),
(3, 5, "repeated_addition"),
(4, 4, "repeated_addition"),
(3, 6, "repeated_addition"),
(4, 5, "repeated_addition"),
(5, 5, "repeated_addition"),
(2, 4, "guess"),
(3, 2, "guess"),
]
cold_start_examples = [
row for row in cold_start_examples if row[:2] in train_pairs
]
assert all(row[:2] not in heldout_pairs for row in cold_start_examples)
X_cold = np.stack([features(a, b) for a, b, _ in cold_start_examples])
Y_cold = np.zeros((len(cold_start_examples), N_STRATS))
for i, (_, _, s) in enumerate(cold_start_examples):
Y_cold[i, STRAT_TO_ID[s]] = 1.0
W_cold = fit_softmax(X_cold, Y_cold, epochs=800, lr=0.1)ConsoleOut [16]Expand
Cold-start student held-out expected accuracy: 0.699 Expected accuracy if every problem uses repeated addition: 0.750 Expected accuracy with a uniform strategy mixture: 0.454
The warm-started classifier has higher expected accuracy here than a uniform mixture. One preset guess example survives training-prompt filtering. The softmax model may assign probability to each strategy even without an explicit example for that strategy.
Next we sample many attempts per training problem, apply both verifiers to the same attempts (so the comparison is controlled), and measure verifier precision and recall against the true oracle.
PythonIn [17]Expand
def sample_attempts(W, pairs, k=8, rng=rng):
rows = []
for a, b in pairs:
p = predict_proba(W, features(a, b))
for _ in range(k):
s_id = rng.choice(N_STRATS, p=p)
s = STRATEGIES[s_id]
trace = run_strategy(s, a, b, rng)
rows.append(
{
"a": a,
"b": b,
"strategy": s,
"answer": trace["answer"],
"formatted": trace["formatted"],
"true_answer": a * b,
"truly_correct": trace["answer"] == a * b,
}
)
return pd.DataFrame(rows)
def apply_verifier(df, verifier):
df = df.copy()
df["accepted"] = [
verifier({"answer": r.answer, "formatted": r.formatted}, r.a, r.b)
for r in df.itertuples()
]
return df
def verifier_report(df):
accepted = df["accepted"].values
correct = df["truly_correct"].values
tp = int((accepted & correct).sum())
fp = int((accepted & ~correct).sum())
fn = int((~accepted & correct).sum())
precision = tp / (tp + fp) if (tp + fp) else np.nan
recall = tp / (tp + fn) if (tp + fn) else np.nan
return {
"precision": precision,
"recall": recall,
"accepted": int(accepted.sum()),
"tp": tp,
"fp": fp,
"fn": fn,
}PythonIn [18]Expand
attempts = sample_attempts(W_cold, train_pairs, k=8)
df_buggy = apply_verifier(attempts, verifier_buggy)
df_strict = apply_verifier(attempts, verifier_strict)
report_buggy = verifier_report(df_buggy)
report_strict = verifier_report(df_strict)
summary_df = pd.DataFrame(
[
{"verifier": "buggy (parity)", **report_buggy},
{"verifier": "strict (exact)", **report_strict},
]
).set_index("verifier")ConsoleOut [19]Expand
Total attempts: 384
Traces that were actually correct: 266 (69.3%)
Verifier behavior on the same attempt set:
accepted tp fp fn precision recall
verifier
buggy (parity) 305 260 45 6 0.852 0.977
strict (exact) 260 260 0 6 1.000 0.977Both verifiers give the same decisions for truly correct candidates. They accept a correct value if it is formatted and reject it otherwise. The extra acceptances under the permissive verifier are wrong answers. The observed precision gap describes the fraction of retained responses that are correct under each filter.
VisualizationOut [20]Expand

Recall is the fraction of numerically correct attempts that pass the filter. The two filters agree on every numerically correct attempt, so their recall is equal whenever the pool contains at least one. Recall is undefined for both filters when the pool has no numerically correct attempts. The permissive rule can raise the false-positive rate by accepting extra incorrect answers.
We run four rejection rounds under each verifier, starting from the same cold policy and random seed. The current policy proposes examples. A nonempty round then fits a fresh coefficient matrix from zero on the new retained examples. Once policies diverge, the same random seed need not produce the same candidates.
PythonIn [21]Expand
def train_rejection(W, pairs, rounds=4, k=8, verifier=verifier_buggy, rng=rng):
W = W.copy()
history = [expected_accuracy(W, heldout_pairs)]
for _ in range(rounds):
attempts = sample_attempts(W, pairs, k=k, rng=rng)
accepted = apply_verifier(attempts, verifier)
accepted = accepted[accepted["accepted"]]
if len(accepted) == 0:
history.append(expected_accuracy(W, heldout_pairs))
continue
X_a = np.stack([features(r.a, r.b) for r in accepted.itertuples()])
Y_a = np.zeros((len(accepted), N_STRATS))
for i, r in enumerate(accepted.itertuples()):
Y_a[i, STRAT_TO_ID[r.strategy]] = 1.0
W = fit_softmax(X_a, Y_a, epochs=400, lr=0.1)
history.append(expected_accuracy(W, heldout_pairs))
return W, historyPythonIn [22]Expand
W_buggy, hist_buggy = train_rejection(
W_cold,
train_pairs,
rounds=4,
verifier=verifier_buggy,
rng=np.random.default_rng(11),
)
W_strict, hist_strict = train_rejection(
W_cold,
train_pairs,
rounds=4,
verifier=verifier_strict,
rng=np.random.default_rng(11),
)ConsoleOut [23]Expand
round buggy verifier strict verifier
0 0.699 0.699
1 0.712 0.725
2 0.720 0.731
3 0.729 0.735
4 0.734 0.739Compare the two curves for this fixed seed. They show how the two filters affect this simulated training loop.
VisualizationOut [24]Expand

Both curves rise in this run. The permissive filter changes the mix of examples that the policy sees, and the fitted policy changes future proposals. For each product parity in this split, both trained policies assign a lower mean probability to the guess strategy than the cold-start policy does. The strategy-mixture table below prints the probabilities used in the heatmap.
We can see the strategy distribution directly. On the held-out set, split by the parity of the true product, compare the average strategy mixture of the cold-start student, the buggy student, and the strict student.
PythonIn [25]Expand
def avg_strategy_mix(W, pairs):
probs = np.stack([predict_proba(W, features(a, b)) for a, b in pairs])
return probs.mean(axis=0)
even_held = [(a, b) for a, b in heldout_pairs if (a * b) % 2 == 0]
odd_held = [(a, b) for a, b in heldout_pairs if (a * b) % 2 == 1]
policies = [
("Cold start", W_cold),
("Buggy filter", W_buggy),
("Strict filter", W_strict),
]
rows = []
for name, W in policies:
for parity, pairs in [
("even product", even_held),
("odd product", odd_held),
]:
mix = avg_strategy_mix(W, pairs)
for s, p in zip(STRATEGIES, mix):
rows.append(
{
"policy": name,
"parity": parity,
"strategy": s,
"prob": float(p),
}
)
strategy_df = pd.DataFrame(rows)ConsoleOut [26]Expand
strategy fact_recall guess repeated_addition
policy parity
Buggy filter even product 0.077 0.005 0.919
odd product 0.084 0.006 0.910
Cold start even product 0.172 0.034 0.794
odd product 0.149 0.038 0.813
Strict filter even product 0.049 0.004 0.947
odd product 0.052 0.004 0.943VisualizationOut [27]Expand

Each row shows a learned strategy mixture. The verifier changes which outcomes enter training, but the direction of a fitted strategy probability also depends on the realized sample, features, and optimizer.
Now we turn to distillation. We define a strong teacher with a well-shaped strategy policy, then compare hard-target distillation (one sampled strategy per problem, imitated directly) with soft-target distillation (the teacher's full distribution, matched by KL).
PythonIn [28]Expand
def teacher_probs(a, b):
prod = a * b
logits = np.array(
[
1.2 - 0.04 * prod,
0.4 + 0.04 * prod,
-2.0,
]
)
z = logits - logits.max()
e = np.exp(z)
return e / e.sum()
teacher_held = np.stack([teacher_probs(a, b) for a, b in heldout_pairs])
teacher_expected_acc = np.mean(
[
sum(
teacher_probs(a, b)[i] * P_CORRECT[STRATEGIES[i]]
for i in range(N_STRATS)
)
for a, b in heldout_pairs
]
)
# Hard-target distillation: one sampled strategy per training problem
rng_hard = np.random.default_rng(0)
hard_labels = []
for a, b in train_pairs:
p = teacher_probs(a, b)
s_id = rng_hard.choice(N_STRATS, p=p)
hard_labels.append(s_id)
X_distill = np.stack([features(a, b) for a, b in train_pairs])
Y_hard = np.zeros((len(train_pairs), N_STRATS))
for i, s_id in enumerate(hard_labels):
Y_hard[i, s_id] = 1.0
W_hard = fit_softmax(X_distill, Y_hard, epochs=600, lr=0.1)
# Soft-target distillation: match the teacher's full distribution
Y_soft = np.stack([teacher_probs(a, b) for a, b in train_pairs])
W_soft = fit_softmax(X_distill, Y_soft, epochs=600, lr=0.1)PythonIn [29]Expand
def kl_to_teacher(W, pairs):
total = 0.0
for a, b in pairs:
p = predict_proba(W, features(a, b))
q = teacher_probs(a, b)
total += float(np.sum(q * np.log(q / p)))
return total / len(pairs)
def mean_max_prob(W, pairs):
return float(
np.mean([predict_proba(W, features(a, b)).max() for a, b in pairs])
)
def top1_agreement(W, pairs):
return float(
np.mean(
[
np.argmax(predict_proba(W, features(a, b)))
== np.argmax(teacher_probs(a, b))
for a, b in pairs
]
)
)
distill_results = pd.DataFrame(
[
{
"model": "Teacher (analytic)",
"accuracy": teacher_expected_acc,
"kl_to_teacher": 0.0,
"mean_max_prob": float(np.mean(teacher_held.max(axis=1))),
"top1_agreement": 1.0,
},
{
"model": "Hard-target student",
"accuracy": expected_accuracy(W_hard, heldout_pairs),
"kl_to_teacher": kl_to_teacher(W_hard, heldout_pairs),
"mean_max_prob": mean_max_prob(W_hard, heldout_pairs),
"top1_agreement": top1_agreement(W_hard, heldout_pairs),
},
{
"model": "Soft-target student",
"accuracy": expected_accuracy(W_soft, heldout_pairs),
"kl_to_teacher": kl_to_teacher(W_soft, heldout_pairs),
"mean_max_prob": mean_max_prob(W_soft, heldout_pairs),
"top1_agreement": top1_agreement(W_soft, heldout_pairs),
},
{
"model": "Strict rejection student",
"accuracy": expected_accuracy(W_strict, heldout_pairs),
"kl_to_teacher": kl_to_teacher(W_strict, heldout_pairs),
"mean_max_prob": mean_max_prob(W_strict, heldout_pairs),
"top1_agreement": top1_agreement(W_strict, heldout_pairs),
},
]
).set_index("model")ConsoleOut [30]Expand
Distillation comparison on held-out problems:
accuracy kl_to_teacher mean_max_prob top1_agreement
model
Teacher (analytic) 0.701 0.000 0.763 1.000
Hard-target student 0.706 0.033 0.807 0.938
Soft-target student 0.702 0.005 0.764 1.000
Strict rejection student 0.739 0.219 0.945 0.938The output table lets us compare students on the same held-out prompts. The soft-target student has the lowest KL among the students in this run. The hard-target student has a higher mean maximum strategy probability than the teacher, which describes concentration without measuring calibration. On the 16 held-out pairs selected with seed 7, expected accuracy rounds to 0.701 for the analytic teacher and 0.739 for the strict-rejection student. This illustrates that matching an analytic teacher and maximizing task accuracy can rank policies differently.
The scatter plot places teacher-to-student KL and mean maximum strategy probability on separate axes. The hard-target student differs from the analytic teacher on both measures in this run.
PythonIn [31]Expand
model_labels = distill_results.index.tolist()
kl_values = distill_results["kl_to_teacher"].to_numpy()
confidence_values = distill_results["mean_max_prob"].to_numpy()VisualizationOut [32]Expand

VisualizationOut [33]Expand

VisualizationOut [34]Expand

Accuracy, KL, and confidence measure different quantities. Mean maximum strategy probability describes concentration without measuring calibration.
Limitations
The toy fits a distribution over three strategy labels. It uses explicit strategy success rates and does not model token-by-token generation. Repeating the simulation with other seeds and splits can test its sensitivity; it cannot establish performance on language models.
Summary
Cold-start supervision supplies selected examples before another training stage. Rejection sampling uses a verifier to select candidates. Distillation uses teacher responses or probability distributions as student targets. The proposal policy, the verifier, and the prompt weighting together determine the training signal.
Quiz
Ready to test your understanding? Take this quick quiz to reinforce what you've learned about cold starts, rejection sampling, and distillation.
Cold Starts, Rejection Sampling, and Distillation
Join the discussionAsk a question or share what you learned.
Keep exploring
Reference
Citation details
Cite or share this article.


Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!