Repository navigation
Closed
Labels
algorithmexternalqa_rcca_donewhen RCCA finished for the issue, the qa will mark with this label .x-ss
Description
Open this issue to track the enhancement of adding on-policy knowledge distillation in NeMo RL, a distillation variation used by Qwen3, which follows the following procedure:
"On-policy Distillation: In this phase, the student model generates on-policy sequences for fine-tuning. Specifically, prompts are sampled, and the student model produces responses in either /think or /no think mode. The student model is then fine-tuned by aligning its logits with those of a teacher model (Qwen3-32B or Qwen3-235B-A22B) to minimize the KL divergence."
Training and program flow:
Core methodology (high level)
- Student generates on-policy rollouts for sampled prompts.
- Teacher(s) provide token-level targets (logits or probabilities) on the student’s generated trajectories.
- Optimize student with a distillation loss on those trajectories.
Implementation design - changes on core components
- New Distillation Algorithm Class (OnPolicyDistillation)
- Similar structure to GRPO algorithm in nemo_rl/algorithms/grpo.py
- Manages the overall training loop and orchestrates student-teacher interaction
- Leverages existing GRPO infrastructure for distributed training
- Distillation Loss Function (DistillationLossFn)
- Implements KL divergence loss between student and teacher logits
- Similar to ClippedPGLossFn in nemo_rl/algorithms/loss_functions.py
- Supports token-level masking to exclude prompt tokens from loss calculation
- Dual Policy Management
- Student Policy: Trainable, inherits from existing Policy class
- Teacher Policy: Fixed/frozen, separate instance or shared infrastructure
- Both can use the same underlying worker architecture (DTensor/Megatron)
Reacted by Terry Kong and Yuki Huang
Metadata
Metadata
Assignees
Labels
algorithmexternalqa_rcca_donewhen RCCA finished for the issue, the qa will mark with this label .x-ss
Activity
[-]On-policy distillation support[/-][+][Feature Request]On-policy distillation support[/+]euronymous-aithal commentedon Aug 13, 2025
@sharathts
terrykong commentedon Aug 14, 2025
Hi @sharonyu-115 . Thanks for sharing your design, and I think this is definitely a use-case you can easily enable with nemo-rl.
One thing you may need to consider is how to allocate resources. AFAICT, it's probably easiest if teacher and student aren't enforced to be colocated since that enforces things like divisibility of world size. So it's probably easiest to only allow colocation on the student and treat the teacher as a separate policy.
terrykong commentedon Aug 14, 2025
@YUki-666 i feel like as long as they aren't using async engine they probably don't need #895 , but i think
SPREADwill probably pose issues since the bundles will be spread out for student leaving an inefficient scheduling for both the student and teacher. wdyt?sharathts commentedon Aug 14, 2025
Thanks @sharonyu-115 for sharing the plan, looks great. Two minor comments:
yuki-97 commentedon Aug 15, 2025
yup, it's better to use
PACKin this case.add some infos:
SPREADfor now at here because of #895.placement_group_strategy="PACK"when initRayVirtualCluster.qiaochuz-nv commentedon May 5, 2026
QA RCCA Analysis
RCCA Status: Done
RCCA Category: covered
Test Action: none
Fix PR: #1006
Root Cause: fix PR includes upstream test coverage.
Trigger Config: [Feature Request]On-policy distillation support
Coverage Assessment:
Conclusion: RCCA classification completed for this closed NeMo-RL GitHub issue.