Waypoint-OPD: Temporal Agreement for Policy-Shift Transfer
Endpoint-only distillation cannot tell whether a teacher’s policy shift was consistent over training; Waypoint-OPD gates that endpoint signal by agreement between early and late shifts at student-generated prefixes.
Read the paper ↗What it is
- Student-local comparison At each prefix, compare teacher changes only across a small set of next tokens the student itself considers likely, giving more weight to the student’s more likely choices.
- Temporal agreement gate Check whether the teacher’s early and late preference changes point in the same direction; use that agreement to scale the overall start-to-finish change.
- Dense candidate signal Turn the gated change into an advantage for each selected candidate token, while using sampled response tokens for the student’s reference penalty.
Why it matters
A start-to-finish comparison can hide a conflicting path between checkpoints. Waypoint-OPD uses the intermediate checkpoint to measure consistency, while retaining the endpoint change as the signal and avoiding imitation of the waypoint itself.
Before getting into the machinery, here is the short version: Waypoint-OPD transfers a teacher’s start-to-finish change in token preferences, but checks whether that change developed consistently through an intermediate checkpoint. The student is judged at its own generated prefixes, so the comparison concerns choices it might actually make. The waypoint is a consistency check, not another teacher distribution to copy.
-
Endpoint signal: Direct on-policy distillation uses the change from the teacher before reinforcement learning to the teacher after it as an implicit token-level reward. A positive change means the teacher has raised that token’s probability relative to its starting point; a negative change means it lowered it. That gives a practical signal on student-generated responses without asking a verifier for a reward, but it hides what happened in between.
-
A missing path check: Imagine the teacher first shifts preference toward one candidate and later shifts further the same way, versus first shifting toward it and then undoing that change. Both can have the same endpoint. The canonical example is two equal-and-opposite segment changes: their sum can be zero, even though the route had large movements. So the endpoint alone cannot tell you whether the path was coherent. The broader idea is to use an intermediate checkpoint to compare consecutive changes; this is about directional consistency, not requiring every step to be monotonic.
-
Student-local choices: At a prefix, Waypoint-OPD takes the student’s most likely next-token candidates and scores those candidates with the initial, waypoint, and final teachers. Think of this as asking for a second opinion only on the options the student is plausibly considering. More probable student options count more in the comparison. The limit of the analogy is that this is still a weighted mathematical comparison over token scores, not a human judgment about which option is sensible.
Before introducing the centering operation, notice what it should do: if every candidate’s teacher score changes by the same amount, their relative ordering and preferences have not changed. Waypoint-OPD subtracts the student-probability-weighted average shift, removing that shared offset. It does this separately for the early and late teacher changes, then adds the centered pieces back together to retain the centered endpoint signal.
So the real question was never just whether the path moved, but whether its two parts moved compatibly. The method takes a cosine between the centered early and late changes, weighted by the student’s candidate probabilities. A positive cosine means their directions agree; a negative one means they conflict. It clips the negative side to zero, so disagreement suppresses the endpoint reward rather than reversing it. If either centered change has almost no variation, it uses a gate of one instead of relying on an unstable angle. This resembles checking whether two notebook entries point in the same direction, though the cosine says nothing by itself about whether the advice is good.
The gate is shared across the candidates at a prefix. A batch-level positive multiplier then adjusts the average gate scale, subject to clipping; it changes scale, not which prefixes agree more. Finally, each selected candidate receives a detached, probability-weighted endpoint advantage, while the student’s KL penalty is estimated on sampled response tokens and anchors it to its own initialization. That makes supervision dense over the selected candidates rather than only the sampled next token. The tradeoff question remains: how much extra teacher scoring and possible suppression of useful endpoint signal is worth this path-consistency check?
Read the deep dive
Why People Wanted It
On-policy distillation asks the student to learn from teacher behavior at prefixes the student actually visits. Direct-OPD uses the teacher’s initial-to-final change in token log-probability as an implicit reward. That endpoint is useful, but it hides the path: two teachers can have the same start and finish while taking very different intermediate routes. So the real question is not only whether the teacher’s final preference changed, but whether its early and late changes point in compatible directions.
The Core Move
Compare the teacher’s consecutive policy shifts at each student-generated prefix, then use their positive directional agreement to scale the centered start-to-finish shift:
Here the waypoint checkpoint supplies consistency evidence, not a target distribution to imitate.
Why the Candidate Support Follows the Student
Now the version for readers who want more of the machinery: the comparison is deliberately local to actions the student is likely to take, rather than being an unweighted comparison over the entire vocabulary. At prefix , let and normalize the student probabilities over that support to obtain . Thus is nonnegative and sums to one over .
The three frozen teachers score each candidate. Write their consecutive log-probability changes as and . These telescope: their sum is the initial-to-final change. This keeps the endpoint as the transferred signal while exposing the intermediate route.
A shared shift across all candidates changes absolute log probabilities but not relative preferences. Remove that component with probability-weighted centering, . Then , , and . The centering makes each shift describe changes in relative candidate preference, and the weights make likely student actions count more.
Why Agreement Is a Positive Cosine
Here is the part that gets technical: Waypoint-OPD computes cosine similarity using the same student-probability weights, , where and . The gate is when both norms exceed ; if either norm is at most that threshold, the fallback is .
This is a bounded, shared-per-prefix gate: negative or zero cosine suppresses the endpoint signal, positive cosine scales it, and the low-variation fallback avoids dividing by a near-zero norm. For example, if both segments equal half the endpoint, their cosine is one; opposing segments can sum to the same endpoint yet receive a zero gate. Agreement is a consistency test, not a guarantee that the resulting supervision is beneficial.
Why Batch Scaling Does Not Change the Direction
Now the final implementation detail: per-prefix gates can have different average magnitudes across batches, so all gated rewards in a batch receive the same positive multiplier. One form is . This targets a chosen mean gate scale while using a numerical floor and clipping bounds.
Because is shared and positive, it preserves relative gate weights and leaves zero gates at zero; it does not constrain the norm of the resulting reward vector. The candidate advantage is dense, , with stop-gradient so these coefficients are treated as fixed in the student update. What remains to decide is how to use that dense signal without turning the waypoint into an imitation target.
Minimal Causal Code
# One prefix; scores are log probabilities on the student's top-k support.
with torch.no_grad():
q = student_probs / student_probs.sum()
early = waypoint_logp - initial_logp
late = final_logp - waypoint_logp
def center(x):
return x - (q * x).sum()
u = center(early)
v = center(late)
d = u + v
dot = (q * u * v).sum()
nu = (q * u.square()).sum().sqrt()
nv = (q * v.square()).sum().sqrt()
eps = 1e-8
gate = 1.0 if (nu <= eps or nv <= eps) else (dot / (nu * nv)).clamp(min=0.0)
# kappa_batch is shared across valid prefixes in the batch.
candidate_advantage = kappa_batch * q * gate * d
What You Gain, and What You Lose
You gain a way to distinguish endpoint shifts with different intermediate consistency, while preserving the initial-to-final shift as the signal being transferred. The student-local top-k support concentrates the comparison on likely student actions; probability weighting and centering focus it on relative preferences; the shared batch multiplier adjusts average gate scale without changing per-batch relative weights.
You also pay for an additional frozen waypoint checkpoint and scoring pass. The gate can suppress a useful endpoint signal when segment directions disagree, while its low-norm fallback deliberately treats near-constant segment changes as ungated rather than trying to infer an unstable angle. The method does not claim that agreement alone makes supervision useful. Candidate advantages are dense on the selected support, whereas the KL penalty is estimated on sampled response tokens and anchors the student to its own initialization. The reported implementation uses dual-clipped PPO, with the same gradient as the stated surrogate at the rollout policy.
Waypoint-OPD keeps the endpoint shift, but trusts it in proportion to how well its early and late directions agree.