Projection Sampling
Expert traces can be hard for a base model to reproduce; projection sampling uses information-preserving Metropolis–Hastings proposals to move those traces toward the base model before finetuning.
Read the paper ↗What it is
- Information-preserving MH Begin with an expert trace, propose a revised trace that keeps the required information, and accept or reject it using a sampling rule aimed at the base model.
- Blockwise refinement Rather than repeatedly regenerating a whole long response, refine sequences through increasing lengths and carry each result forward.
- Expert-guided proposal Show the model a partial response alongside the expert solution, then ask it to continue consistently from that point.
Why it matters
Expert examples can be correct yet unlike what the base model naturally produces. Projection sampling uses them to guide candidate generation while keeping their required information, creating training traces closer to the base model’s own distribution.
Before getting into the mechanics, here is the short version: projection sampling starts from an expert solution, asks the base model to propose compatible rewrites, and uses Metropolis–Hastings to decide whether to keep them. The aim is not to invent new expert knowledge; it is to make expert traces more compatible with the model that will later be finetuned.
-
The starting point: Rejection sampling is straightforward if the base model can already generate correct expert trajectories reliably. But the interesting case is when those trajectories are difficult for it to produce. We need a way to start from the expert data rather than wait for the model to stumble onto the answer.
-
The constraint: We want to change how a solution is expressed without losing the information that makes it correct. The canonical example is one expert solution to a query: keep the expert’s relevant reasoning available, but let the model continue in its own words. This is not a guarantee that arbitrary paraphrases preserve meaning; the procedure relies on a proposal that stays within the information-preserving constraint.
-
The direction of travel: Think of the expert trace as a notebook whose useful information must travel with you, while the wording can be revised. The chain prefers candidates the base model finds more plausible, but it can reject a candidate and stay put. The analogy has a limit: MH corrects the proposal statistically; it does not certify each candidate by analogy or guarantee that every step looks better.
So what makes this more than repeatedly asking the model to rewrite an answer? The acceptance rule matters. In paper notation, the target is . In words, this is the base model’s distribution restricted to trajectories in the information-preserving set. The indicator assigns no target mass to trajectories outside that set.
For example, if the current candidate and a proposed continuation both satisfy the constraint, the restriction does not add a different weight between those candidates; MH uses the base-model probabilities together with the proposal probabilities to accept or reject. The chain starts at an expert trace and uses proposals constrained to stay in the set. Under the stated chain conditions, it targets the restricted base-model distribution.
So does each rewrite necessarily close the gap? No: the useful claim is about distributions after repeated steps. The MH transition has the restricted target as its stationary distribution, and applying the same transition to two distributions cannot increase their KL divergence. The result is a non-increasing policy gap across steps, not a promise about every individual trace or about how quickly a finite run converges.
The next question is practical: how do you propose a change to a long autoregressive answer without regenerating the entire thing each time? The method works through sequence lengths in blocks. It samples within a restriction at one length, then uses that result to initialize the next, longer restriction. The block size is a resolution-versus-cost knob: larger blocks lower the stated sampling cost, while smaller blocks provide higher resolution and less approximation error.
And where does the expert signal enter? The proposal picks a position in the current candidate, keeps the prefix up to that point, and asks the base model to continue with the expert solution and partial response in the prompt. The expert solution acts like a guide for what must remain; the partial response is the starting point for the model’s continuation. The prompt is intended to elicit a compatible complete answer, but the acceptance step is still part of the algorithm. That leaves the practical question: how reliably can the prompted model make information-preserving proposals for the dataset at hand?
Read the deep dive
Why People Wanted It
An expert trace may contain the right reasoning, but the base model may be unlikely to produce that exact trajectory on its own. Rejection sampling would be an easy way to get model-generated correct traces if the base model could reliably generate them; in the regime this method targets, that is not feasible. So the real question is: can you start from an expert trace, preserve its correctness-relevant information, and move the samples toward what the base model itself is more likely to produce?
The Core Move
Start an information-preserving Metropolis–Hastings chain from an expert trace, using proposals that remain within the set of information-equivalent trajectories; the target is the base model restricted to that set. In the paper’s notation, the target is .
Here is the set of trajectories that retain the required information, and the indicator excludes trajectories outside it. The method calls the resulting procedure projection sampling. The information-projection target is the closest-to-base distribution under that constraint; the focus here is how to sample toward it.
Why Information-Preserving Proposals Can Target the Base Model
Now the version for readers who want more of the machinery: restricting proposals to correct trajectories does not mean the chain must target a different distribution. Suppose the current trajectory is in , and the proposal kernel only proposes candidates in . The Metropolis–Hastings acceptance ratio uses the target density and the forward and reverse proposal probabilities:
Because both candidates are in , the indicator in the restricted target is one for each, so the restriction contributes no additional factor to this ratio. A proposal outside would have zero target mass and therefore zero acceptance probability. This is why the paper’s proposition relates MH with irreducible proposals targeting to MH with information-preserving proposals targeting .
The chain still needs suitable reachability and return behavior: the stated conditions are irreducibility and aperiodicity. A proposal that preserves information but cannot reach relevant trajectories does not, by that property alone, guarantee convergence to the desired target.
Why Repeated Steps Reduce the Policy Gap
Here is the part that gets technical: the claimed progressive reduction follows from the Markov transition’s stationary distribution and the data processing inequality, rather than from each individual proposal being more likely under the base model. Let denote one MH step, and let be the candidate distribution after steps. Since is stationary, applying the same Markov kernel to and cannot increase their KL divergence:
In words, each chain step does not increase the divergence to the stationary target. On trajectories in , the restricted target differs from by a normalization constant, so the corresponding KL divergences to and to differ by a fixed additive constant. Thus the policy gap to the base model is non-increasing across steps, while the candidates remain information-preserving. This is a monotonicity claim, not a guarantee that every individual trace improves or that a finite run has reached the target.
Why Blockwise Sampling Fits Autoregressive Models
Now for the implementation-level deep dive: direct full-sequence MH would repeatedly regenerate long token sequences, which is described as infeasible and can also mix slowly in high-dimensional spaces. The method instead defines restrictions of the target over prefixes of increasing length, in units of block size . It samples within one prefix-length distribution and uses that result to initialize sampling at the next length. The blockwise schedule is a way to make autoregressive refinement tractable; it is not a claim that the full sequence is resampled in one operation.
Why the Proposal Uses an Expert-Guided Partial Trace
Here is the other technical ingredient: the expert trajectory enters through the proposal kernel. Given a candidate, the procedure selects an index uniformly from the sequence positions, truncates the candidate there, and prompts the base model with the query, expert trajectory, and partial response. The prompt asks the model to continue from that partial response in a way consistent with the expert solution and to reach a complete answer. Conditioning the base model on this prompt defines the proposal distribution.
The expert trace guides the proposed continuation, while the partial response gives the model a point from which to continue. In practice, the text says this prompt can sufficiently generate correct trajectories from expert demonstrations, satisfying the information-preservation constraint. The MH acceptance step remains important: the proposal is not itself the target distribution.
Minimal Causal Code
This schematic loop makes the accept-or-stay update visible. log_target evaluates the base-model log probability for candidates in the information-preserving set, and log_proposal(a, b) means the log probability of proposing a from b. The prompt-based proposal is represented by propose.
import math
import random
current = expert_trace
for step in range(num_steps):
candidate = propose(query, expert_trace, current)
if not information_preserving(candidate, expert_trace):
continue
log_ratio = (
log_target(candidate) + log_proposal(current, candidate)
- log_target(current) - log_proposal(candidate, current)
)
if math.log(random.random()) < min(0.0, log_ratio):
current = candidate
A rejected candidate leaves current unchanged, which is the self-transition in MH. The code is illustrative: the paper’s sequence-length restrictions and blockwise schedule are additional parts of its autoregressive algorithm.
What You Gain, and What You Lose
You begin with expert trajectories and use a base-model proposal to produce information-preserving candidates that move toward the base model’s restricted distribution. The paper states that the policy gap is non-increasing across MCMC steps, not that every sample becomes better or that finite computation guarantees convergence.
The tradeoff is computational and algorithmic. Full-sequence MH entails repeated LLM inference and may mix slowly; blockwise refinement addresses the sequence-length burden but introduces a block-size choice. Larger blocks lower the stated sampling cost, while smaller blocks provide higher resolution and less approximation error. The procedure is a one-time cost before finetuning, rather than an inference-time sampling cost. The proposal also depends on the model following the expert-guided continuation prompt sufficiently well to preserve the required information.
Projection sampling keeps expert-relevant information fixed while MH moves candidate traces toward the base model’s distribution.