logprobs on the student’s own generated tokens. There is no
external reward; the training signal is purely how much the teacher would
have preferred the student’s own choices.
The two-run loop
- Create the student session/run as usual (see Quickstart).
- Create a second session/run for the teacher — same model for OPSD/SDPO, a different (typically larger) model for OPD.
- Sync the teacher’s sampler exactly once with
save_weights_for_sampler. Never calloptim_stepon the teacher run again — it is a frozen reference for the rest of the loop. - Each cycle: sample from the student, then ask the teacher for
logprobson the student’s exact generated tokens (prompt-conditioned differently per algorithm — see each page). - Build the loss from
teacher_logprob - student_logprobper completion token,forward_backwardandoptim_stepthe student only. save_state/export_lora/finish/closeboth sessions.
cancel both runs, poll each to terminal, then
close both sessions. Never mix teacher and student weight versions on the
same sampler without explicit versioning.
Distillation loops build on the same datum and advantage helpers
as every other algorithm — rl_datum() and forward_backward_payload() in
particular.