Skip to content
Go back

What Projection Sampling Changes About SFT

· 11 min read

A small model is learning to solve algebra problems. Given x+1/x=3x+1/x=3, it must find x2+1/x2x^2+1/x^2. One expert solution invokes a recurrence for symmetric powers. Another squares the given expression and subtracts the cross term, giving 32−2=73^2-2=7. Both solutions are correct and give the student different sequences of decisions to imitate.

Now imagine the expert consistently uses methods the student rarely produces. Supervised fine-tuning (SFT) has a direct training signal for every expert token. Reinforcement learning (RL) can train on the student’s own attempts, though it needs successful exploration or a reward that distinguishes useful partial attempts. Aayush Karan, Sitan Chen, and Yilun Du ask whether an expert solution can guide the search for a training target that the student is already more likely to produce. Their method, projection sampling, does the search before fine-tuning and uses ordinary SFT afterward. Finetuning with Sampling

I previously looked at how to repair individual errors in teacher traces. Projection sampling raises a different question. Given several valid solutions, how should we allocate training probability among them? The answer is conditional on the learner, and the difference between the mathematical answer and the paper’s implementation matters. Earlier post on trace repair

Table of contents

Open Table of contents

Which correct solutions should survive?

Fix a problem and let pp be the unassisted base model’s distribution over answers. Let CC contain the solutions that preserve the information we want to teach. For our algebra example, CC might require a correct justification and the answer 7. A final-answer checker implements a weaker constraint. It would accept a trace that makes a cancellation error and happens to end with 7. The definition of CC determines how much of the expert’s work survives. Paper §4.1

Among distributions supported on CC, the one closest to pp in DKL(q∥p)D_{\mathrm{KL}}(q\Vert p) is pp conditioned on CC:

pC(y)=p(y) 1[y∈C]p(C).p_C(y)=\frac{p(y)\,\mathbf{1}[y\in C]}{p(C)}.

This assumes p(C)>0p(C)>0. The projection preserves the base model’s relative probabilities within the valid set. If it assigns twice as much probability to one valid solution as another, their projected probabilities still have a ratio of two to one. That makes it a distribution over ways to solve the problem, with room for less common valid answers. Paper §4.1, Proposition 1

With a reliable verifier, ordinary rejection sampling can target that distribution by drawing from pp and keeping answers in CC. At a 1% success rate, getting one accepted answer takes 100 generations in expectation. This gives a concrete reason to use a worked solution. It provides an informed starting point and helps the model propose new answers where unrestricted sampling spends most of its time failing. An independent best-of-nn rewrite is another natural baseline because it uses the expert hint without maintaining a chain. Paper §4.1–4.3

Exact sampling and the shortcut

The theoretical sampler proposes a change from xx to yy with probability k(y∣x)k(y\mid x) and accepts it with probability

min⁡(1,pC(y)k(x∣y)pC(x)k(y∣x)).\min\left(1,\frac{p_C(y)k(x\mid y)}{p_C(x)k(y\mid x)}\right).

The reverse proposal term corrects for asymmetry. A proposal can be easy to generate in one direction and hard in the other. Under the stated Markov-chain conditions, Metropolis–Hastings has pCp_C as its stationary distribution. Its distribution-level KL contraction is compatible with occasionally accepting a less likely answer. Paper §4.2

In the language-model implementation, the sampler works in blocks. It keeps a prefix, chooses a random cut within the current sequence, and generates a replacement suffix with the expert solution in context. For the experiments, the authors save the cost of scoring reverse proposals by replacing the current candidate whenever the new one has higher base-model likelihood. That is a hill-climbing acceptance rule. The expert-conditioned proposal encourages information preservation, and the reported math dataset still has 95.33% accuracy after sampling. An implementation that uses this shortcut can concentrate on a few highly likely solutions. Paper §4.3 and Appendix C

A four-state example shows what this choice changes. The base model assigns probabilities 0.24, 0.18, and 0.12 to three valid solutions and 0.46 to an invalid one. The projected probabilities over the valid trio are 44.44%, 33.33%, and 22.22%. Starting at the least likely valid solution, exact MH and greedy replacement receive the same asymmetric proposal distribution. The calculation propagates probability mass exactly for both rules. KL is measured in nats.

Update stepsExact MH KL to projectionGreedy KL to projection
01.50411.5041
10.08560.0450
20.00650.0617
12Under 0.00010.7419

At step 12, greedy has raised the expected base-model log probability and put 98.62% of its mass on one solution. Its distance from the projection has grown since step 1. Exact MH converges toward the original 44:33:22 allocation. This small calculation isolates the acceptance rules. The language-model training results below come from the paper. For a real data pipeline, track likelihood together with validity, solution diversity, and downstream performance. The exact target and the experimental shortcut

Download the Python experiment and run it with Python 3.9 or later. It uses the standard library.

python3 projection_sampling.py --steps 12

The paper estimates the number of generated tokens for data construction as roughly ∣D∣NMCMCT2/(4B)|\mathcal{D}|N_{\mathrm{MCMC}}T^2/(4B), where TT is trace length and BB is block size. Long traces can dominate this budget. This is a generation-token estimate. End-to-end comparisons need to count reference scoring, expert-prompt prefill, and GPU time for training too. Paper §4.3, Equation 9

How each baseline uses the expert answer

The expert solution can supply target tokens, condition a rewrite, help a teacher score student prefixes, or make hard rollouts easier to discover. The methods differ in when they generate answers and what gets passed to the loss. Paper §2 and §5.1

MethodWhere the expert signal entersWhere answers come fromTraining objective
Expert SFTThe complete answer is the targetFixed expert tracesToken cross-entropy
Rewrite SFTThe expert answer conditions one rewriteFixed reference-model rewritesToken cross-entropy
Projection sampling + SFTThe expert answer conditions repeated proposalsOffline suffix resampling by a fixed reference modelToken cross-entropy
On-policy self-distillation (OPSD)An expert-conditioned teacher scores student prefixesOnline, unassisted student answersToken-distribution matching
GRPOA verifier provides rewards in the math setupOnline groups of unassisted policy answersGroup-relative policy updates
UFTExpert prefixes guide exploration and supply supervised targetsOnline completion with decreasing amounts of guidanceHint likelihood plus reward optimization

OPSD pays for student generation and teacher scoring during training. Its advantage is access to the prefixes the student actually reaches. A teacher that understands the demonstration can provide feedback there, even after an imperfect opening. Shenfeld et al. call their method SDFT and derive reverse-KL distillation, with forward KL performing best in their practical setup. The sampling paper cites both Shenfeld et al. and Zhao et al. and reports using Shenfeld et al.’s hyperparameters. Reproduction requires specifying the teacher update rule and KL direction. Shenfeld et al., §3 · Zhao et al. · Sampling paper §5.1

GRPO estimates advantages from rewards within each group. A group whose answers all get the same reward provides no relative reward signal. UFT uses demonstration prefixes to improve exploration and learns from the prefix tokens through a supervised term. POPE is another relevant guided-exploration comparison. It mixes problems with and without short expert hints and applies RL to the generated answers. DFT and ASFT act at yet another point, adjusting the SFT loss on fixed demonstrations. These last methods offer useful controls for future tests and have no row in the sampling paper’s results table. GRPO · UFT · POPE · DFT · ASFT

What the experiments establish

The table reports single-answer accuracy for Qwen2.5-3B, in percent. Math mean is the equal-weight average of the four math columns. Prior mean averages the paper’s chemistry, MMLU, and GPQA results. Paper Table 1

MethodMATH 3–5AMCMATH500GSM8KMath meanPrior mean
Base31.513.324.557.931.842.2
Expert SFT24.310.016.845.524.238.9
OPSD26.78.433.252.430.240.4
GRPO45.724.931.380.845.741.4
UFT47.029.329.774.645.242.1
Sampling SFT49.527.758.278.253.442.0
Sampling SFT → GRPO54.524.165.283.056.743.0

The largest math gain over GRPO is on MATH500, at 26.9 percentage points. GRPO scores higher on GSM8K than standalone sampling SFT, and UFT has the highest AMC score. Starting GRPO from sampling SFT yields the highest math mean, with AMC falling from 27.7% to 24.1%. Two comparisons would sharpen the interpretation. Direct rewrite SFT would help measure the contribution of repeated sampling. Expert SFT followed by the same GRPO recipe would isolate the effect of the initialization data. Paper §5.2, Table 1

The ordering changes across models and tasks. On the Qwen2.5-7B-Instruct chemistry task, sampling SFT reaches 66.0% target accuracy versus 61.8% for OPSD, with prior-capability averages of 58.6% and 56.8%. For the Olmo chemistry task, OPSD has the higher target score, 59.7% versus 58.3%, and sampling SFT has the higher prior mean, 61.7% versus 60.4%. On open-ended medical question answering graded by GPT-5-mini, OPSD scores 46.6% on the target task to sampling SFT’s 45.8%. For the prior mean, the respective scores are 50.1% and 51.6%. These comparisons make model–data fit worth testing. One Appendix B experiment trains Qwen on traces sampled for Olmo and reports 57.33% chemistry accuracy, versus 66.0% with Qwen-matched traces. That comparison also leaves room for changes in rewrite quality or length. Table 1 · Appendix B, Table 2 and reference-model comparison

The Olmo experiment shows gains that persist as the authors allow more answers per question on their chemistry evaluation. That is stronger evidence than a single-answer score for improvement at the tested inference budgets. For an individual question, zero successes in 64 independent base-model attempts still permits a true per-attempt success probability of about 4.6% at a one-sided 95% confidence limit. The study documents changes in observed capabilities at specific budgets. Paper Figure 4

The missing experiments

Start with the math setup. Hold the checkpoint, training problems, expert solutions, loss, and supervised target-token budget fixed. Compare unchanged expert traces, one rewrite, independent best-of-nn rewrites, and iterative suffix resampling. Match the generation budget for the two multi-proposal arms and account for rejected candidates, long expert prompts, and failed generations. Run both arms with a shared training-only verifier in a separate comparison. The resulting gap tests whether editing a current candidate yields better training targets than generating several independent rewrites for the same cost. Paper §4.3 and Appendix C

Then run expert SFT and projection-sampled SFT through the same GRPO stage, with the same reward, questions, and rollout budget. Measure both checkpoints before and after GRPO. Report a standalone GRPO arm at comparable end-to-end cost. For both comparisons, freeze evaluation decoding and check question-level overlap. MATH500 was drawn from MATH. If the selected evaluation splits overlap, averaging them gives those questions extra weight. Use paired intervals on the same test questions and report variation across independent training runs. Keep prior-capability scores by benchmark to see where any losses concentrate. MATH500 split · Paper evaluation setup

A useful result would show where changing the data pays back the cost of generating it. If matched-budget independent rewrites close the gap, a simpler offline pipeline can deliver the benefit. If iterative resampling wins mostly on questions where the base model seldom succeeds, the expert trajectory is likely buying access to valuable solutions. If the gain requires a matched reference model even after controlling rewrite quality, the reference checkpoint and tokenizer version become part of the dataset’s provenance. Changing the learner would then be a reason to revalidate the training set.


Share this post on:

Next Post
Why All Data Vendors Are Bad