All six chapters, every transfer answer, and each optional marked addition are authored open. Use the browser Print command for paper or PDF.
Chapter 1
What does “on-policy” actually modify?
“On-policy” tells you where the training states came from. It does not tell you which way the KL points.
What does “on-policy” actually modify?
OPD-CORE-v1 · canonical teaching contract A student generates a response. A teacher is queried along that response. A KL loss compares their next-token distributions. Which part makes the recipe on-policy?
The answer is the first part: the student generated the response trajectory, so the response's prefixes are student-visited states. Forward KL, reverse KL, and other divergences describe a different choice—the local comparison made after a prefix has been selected.
Source-backed: Agarwal et al.'s GKD objective exposes a student-output fraction separately from the divergence choice. See the author manuscript §3.1 and §4 variants.
Write the source outside the local loss
Let ρ name the source of prompt–response pairs. Once a response y is sampled, its prefixes st=(x,y<t) identify where teacher and student will be compared:
The expectation chooses trajectories and therefore visited prefixes. The inner D compares two distributions at one already chosen prefix. In other words, prefix provenance and divergence direction are different decisions. Keeping those jobs on separate lines is the central habit of this guide.
Place the recipe on both coordinates
OPD-FIG-001 · sourced relationshipPrefix source × divergence direction
Move horizontally to change who generated the response and its prefixes. Move vertically to change the local comparison. Neither coordinate determines the other.
A fixed prompt set does not settle the source axis. GKD can sample prompts from a fixed collection and still sample completions from the current student. Conversely, a fixed teacher-generated completion can be paired with reverse KL without becoming on-policy.
The loss does not choose the prefix. So what does?
Chapter 2
Who generated the supervised state?
The sampled token becomes part of the next state. Provenance travels with that collection event.
Who generated the supervised state?
OPD-TOY-001 · invented teaching fixture At prefix x, vocabulary order is [A,B] and the student distribution is [0.75,0.25]. The contract fixes a uniform draw at 0.8. Its inverse-CDF interval selects B, so the next visited prefix is xB.
Student draw at x
Token
Student probability
Sampling interval
Result
A
0.75
[0, 0.75)
not selected
B
0.25
[0.75, 1)
0.8 → B → xB
The same contract also supplies a fixed teacher demonstration whose first token is A, reaching xA. In this comparison, the occurrence of xA is fixed/off-policy and the occurrence of xB is student-generated/on-policy at collection. A prefix string alone cannot reveal who generated it.
Keep collection, supervision, and update distinct
OPD-FIG-002 · teaching decompositionCollection first; local differentiation later
Sample: student draw 0.8 → B.
Visit: the next prefix is xB.
Query: teacher and student both return distributions at xB.
Compare: the chosen divergence returns nats.
Update: local student parameters receive a gradient; the sampled path stays detached.
The solid chain records data and state flow. The final dashed edge marks the update boundary. The five-step wording is a teaching decomposition of the canonical equations and algorithm.
The five labels are a teaching decomposition. Implementations may fuse forward passes, but the logic remains: sampling determines the states; the teacher supplies feedback at those states; the objective turns feedback into a scalar; the update differentiates the declared estimator.
Detach the draw, not the student
The canonical GKD-style toy does not backpropagate through the discrete 0.8 → B draw. During the local update, the realized path [x,xB] is treated as fixed. The student distribution evaluated at x or xB is still differentiable through its logits and parameters.
Boundary. A fixed prompt collection is compatible with on-policy completion sampling. Reusing old responses after the student changes may not be. Record the behavior-policy snapshot instead of inferring freshness from a method name.
Now that xB exists, what exactly does the teacher provide there?
Chapter 3
What does the teacher provide at xB?
The teacher does not replace the student’s path. It evaluates the same state the student actually visited.
What does the teacher provide at xB?
At the student-visited prefix xB, the student assigns [0.6,0.4] to [A,B]. Querying the teacher at that same prefix returns [0.9,0.1].
Full next-token distributions at the held-fixed prefix xB
Policy
P(A | xB)
P(B | xB)
Sum
Teacher p
0.9
0.1
1
Student qθ
0.6
0.4
1
The teacher's probability vector is dense token-distribution supervision. It is not automatically a scalar reward, a correctness certificate, or process-level causal feedback.
Source-backed: GKD Eq. 2 evaluates teacher and student next-token distributions conditioned on the identical prefix. See the author manuscript §3.
The local comparison begins after the state is fixed
For a chosen state s, abbreviate the teacher probabilities by pi=p(i∣s) and the student probabilities by qi=qθ(i∣s). A declared divergence maps these aligned vectors to one scalar:
Ds=D(p(⋅∣s),qθ(⋅∣s)).
The state source is metadata about how this occurrence entered the batch. Changing the divergence does not rewrite that history.
Do not hide feedback granularity
This guide's canonical toy compares the complete two-token vocabulary. Other recipes may expose one sampled token, a hard teacher action, a top-k truncation, or a scalar reward. That objective granularity changes what information is available even when each signal is casually called “teacher feedback.”
Toy assumption. Teacher and student share the aligned vocabulary [A,B]. Cross-tokenizer mapping, EOS handling, and variable-length weighting remain outside the fixture.
With the state held fixed, KL direction finally becomes the question.
Chapter 4
What changes when KL direction changes?
Forward and reverse KL compare the same two distributions in different orders. Neither order chooses the state source.
Forward KL weights by the teacher
At one held-fixed prefix, forward KL places the teacher distribution first:
DF(p∥q)=DKL(p∥q)=i∑pilogqipi.
Teacher probabilities weight the log-ratios. The value uses natural logarithms, so its unit is nats.
Reverse KL weights by the student
Reverse KL swaps the arguments:
DR(q∥p)=DKL(q∥p)=i∑qilogpiqi.
Student probabilities now weight the log-ratios. KL is asymmetric, so forward and reverse values need not match even though the prefix and both vectors are unchanged.
Reduce the two visited positions once
OPD-FIG-003 · OPD-TOY-001Exact KL balance sheet
Full-precision route values before six-decimal display rounding
Held-fixed prefix
Student q
Teacher p
Reverse KL q ‖ p
Forward KL p ‖ q
x
[0.75, 0.25]
[0.5, 0.5]
0.130812035941137
0.143841036225890
xB
[0.6, 0.4]
[0.9, 0.1]
0.311238679583058
0.226289161185359
Unweighted mean
two visited positions
0.221025357762097
0.185065098705625
The canonical contract reports the reverse-KL column: 0.130812, 0.311239, then 0.221025 nats after one final rounding step. The forward column is a same-prefix comparison, not a different source.
The canonical student path is [x,xB]. Its reverse-KL losses are 0.130812035941… and 0.311238679583… nats (six-decimal displays: 0.130812 and 0.311239). The contract uses an unweighted two-position mean:
Compute at full precision and round the final mean once. Averaging two already rounded display values can change the last displayed digit.
A local gradient is not a gradient through collection
With the prefix and teacher fixed, the student logits can receive a gradient from either KL. That derivative answers how to change the student distribution at this state. It does not differentiate through the earlier categorical token draw in the canonical estimator.
Estimator boundary. Sequence-level reverse-KL policy-gradient methods can retain score-function terms from the sampling law. They are distinct estimators, not a hidden form of this detached local calculation.
The same surface words can therefore describe different training semantics.
Chapter 5
Which similarly named recipes differ?
Classify the source, feedback, objective, reduction, and gradient semantics before trusting a shared label.
Which similarly named recipes differ?
OPD-TBL-001 · Ask what is sampled, observed, optimized, and differentiated
Recipe
Response / prefix source
Teacher feedback
Objective and gradient boundary
Evidence status
SeqKD
fixed teacher beam output
hard teacher-generated sequence
student likelihood on fixed targets
peer-reviewed · EMNLP 2016
GKD / canonical toy
fixed, mixed, or current-student outputs via λ
full next-token distributions at selected prefixes
declared local divergence; sampled trajectory detached
peer-reviewed · ICLR 2024 + toy boundary
ImitKD
scheduled mixture of fixed and student-generated sequences
oracle action or full token distribution
oracle NLL or cross-entropy; implementation schedule matters
peer-reviewed · EMNLP 2020
MiniLLM
theory uses student response distribution; practical sampler is teacher-mixed
sequence and token-level log-ratio terms
sequence reverse KL with score-function terms and stabilizers
peer-reviewed · ICLR 2024
Scalar-reward RL
algorithm-dependent trajectory source
external scalar reward
expected reward or surrogate; not token-distribution KL by definition
separate objective family
A method name is a starting point, not a complete estimator. Ask what generated the response, what teacher information is visible, how it is reduced, and which dependencies reach the update.
Canonical GKD keeps source and divergence configurable
GKD can mix fixed and student-generated outputs with a coefficient λ, then choose a token-distribution divergence independently. Its canonical sampling path is stopped for the local update.
MiniLLM begins from reverse KL between complete response distributions and derives likelihood-ratio terms involving sampled tokens. Its practical estimator adds further approximations and stabilizers. That is not the same gradient semantics as freezing a sampled GKD trajectory and differentiating only local token-distribution losses.
Prompt source: fixed collection, live environment, or another distribution?
Response source: teacher, current student, stale behavior policy, or a mixture?
Feedback granularity: full vocabulary, top-k, one sampled token, hard target, or scalar reward?
Objective and reduction: which arguments, positions, lengths, and units?
Gradient semantics: detached collection, score-function term, importance weighting, or another estimator?
Vocabulary and EOS: how are supports aligned and sequence boundaries counted?
Use those questions on two recipes whose axes deliberately disagree.
Chapter 6
Can the reader diagnose an unfamiliar recipe?
Diagnose an unfamiliar recipe by answering the source and divergence questions separately.
OPD-XFER-A — Reverse loss, fixed prefix source
A learner uses reverse KL on a fixed teacher-generated xA prefix. Is the divergence reverse KL, and is the state sampling on-policy? Explain both axes separately.
Inspect the reasoning
Local axis: yes. The student distribution is the first KL argument and weights the log-ratio.
Source axis: no for this supplied occurrence. The prefix came from a fixed teacher-generated trajectory, not the current student. Another student draw could reach the same text; provenance belongs to the collection event.
OPD-XFER-B — Student prefix source, forward loss
A learner samples B from the student, queries the teacher at xB, and computes forward KL. Is this on-policy distillation? Explain why divergence direction does not change the state source.
Inspect the reasoning
Source axis: yes, provided the response was freshly sampled from the student behavior policy used for collection. xB is a student-visited prefix.
Local axis: forward KL compares teacher to student at that fixed prefix. Swapping the KL order changes the local value and derivative—not the already established provenance.
Carry a five-question rule
What samples the response?
Which prefix occurrence is evaluated?
What teacher feedback is visible?
What objective and reduction are formed?
Which dependence reaches the gradient?
If those answers are explicit, “on-policy” becomes one coordinate again instead of a bag of assumptions.
The field-guide version
The source chooses the visited states. The local divergence compares distributions at a visited state. The gradient estimator decides which parameter dependence survives.
This guide explains a canonical detached GKD-style toy and several boundaries. It does not define every method called On-Policy Distillation, report a real-model benchmark, or establish a measured learner outcome.
Glossary, sources, and optional additions
Glossary
Policy
A conditional distribution over the next token in this guide.
Trajectory
A generated response sequence; its prefixes provide the states evaluated during tokenwise distillation.
Prefix
The prompt plus response tokens generated before the current position.
On-policy
Here, the response occurrence was sampled from the student behavior policy used for collection.
Behavior policy
The policy that generated the collected response; it may differ from the current trainable parameters later.
Teacher
The model supplying supervision at the selected prefix; teacher probability is not automatically correctness.
Forward KL
D_KL(teacher || student) at one held-fixed prefix in this notation.
Reverse KL
D_KL(student || teacher) at one held-fixed prefix in this notation.
Nat
The information unit produced by natural logarithms.
Stop-gradient
An estimator choice that treats a dependency as fixed during differentiation; here it applies to the sampled trajectory.
Sources
SRC-GKD-ICLR-2024 · Peer-reviewed · ICLR 2024 official record
Sequence-source mixture, oracle supervision, schedule, and sample-pooling boundaries.
Variant 04 · passive media notes
Three local chapter replays
The clips are supplemental renderings of facts already established in the canonical prose. They contain no audio stream, use local English WebVTT captions, and retain six distinct still frames plus transcripts when motion or media is unavailable.
V04-VID-001 · 15 seconds · A draw becomes a visited prefix. MP4 · WebVTT
V04-VID-002 · 16 seconds · The teacher follows the visited prefix. MP4 · WebVTT
V04-VID-003 · 20 seconds · A loss is not yet an update. MP4 · WebVTT
Rendered locally with Remotion 4.0.506 at 1920 by 1080, 30 fps. The variant interaction gate fails: transport controls do not manipulate the toy model.