Implement on-policy distillation: sample from the student, score tokens under a (toy) teac

Direct Alignment: DPO, Rejection Sampling & Distillation4 / 5

Chapter 134 / 5

Direct Alignment: DPO, Rejection Sampling & Distillation

Implement on-policy distillation: sample from the student, score tokens under a (toy) teac

Hard

Implement on-policy distillation: sample from the student, score tokens under a (toy) teacher, and apply the reverse-KL policy-gradient update.

Target interface
class TinyLM

Implement the function/class skeleton in the editor. Any correct approach is accepted.

Hints0 / 2
Reference solution
Your own code stays in the editor.