[skyrl-train] Add example for on-policy distillation#585
Merged
SumanthRH merged 19 commits intoNovaSky-AI:mainfrom Nov 6, 2025
Merged
[skyrl-train] Add example for on-policy distillation#585SumanthRH merged 19 commits intoNovaSky-AI:mainfrom
SumanthRH merged 19 commits intoNovaSky-AI:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds an example for on-policy distillation, which is a great addition. The core logic change to support a separate reference model path is correct. I've added a few comments to the new example files:
- In
main_on_policy_distill.py, I've suggested a refactoring for clarity and a change to the loss calculation to improve training stability. - In
run_on_policy_distill_math.sh, I've pointed out a misleading checkpoint path and a missing newline at the end of the file.
Overall, the changes look good and the example is very helpful.
skyrl-train/examples/on_policy_distillation/main_on_policy_distill.py
Outdated
Show resolved
Hide resolved
skyrl-train/examples/on_policy_distillation/run_on_policy_distill_math.sh
Outdated
Show resolved
Hide resolved
skyrl-train/examples/on_policy_distillation/run_on_policy_distill_math.sh
Outdated
Show resolved
Hide resolved
SumanthRH
reviewed
Oct 28, 2025
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
SumanthRH
reviewed
Oct 28, 2025
skyrl-train/examples/on_policy_distillation/run_on_policy_distill_math.sh
Outdated
Show resolved
Hide resolved
…00/SkyRL into on_policy_distillation
tyler-griggs
reviewed
Nov 4, 2025
Member
tyler-griggs
left a comment
There was a problem hiding this comment.
Can you add a README.md to this examples sub-directory with a brief overview of what is in this example and how to run it
skyrl-train/examples/on_policy_distillation/run_on_policy_distill_math.sh
Outdated
Show resolved
Hide resolved
Added a README for On-Policy Distillation with usage instructions and references.
Added details about On-Policy Distillation and reverse KL loss in the README.
Updated README.md to enhance explanation of On-Policy Distillation and provide quickstart instructions.
SumanthRH
approved these changes
Nov 6, 2025
li-boxuan
pushed a commit
to li-boxuan/SkyRL
that referenced
this pull request
Nov 23, 2025
Adds an example of extending the `RayPPOTrainer` to do on policy distillation by providing a custom `apply_reward_kl_penalty` function, a pass through advantage estimator, and using the `importance_sampling` loss function as detailed in the [thinky blog](https://tinker-docs.thinkingmachines.ai/losses#policy-gradient-importance_sampling). qwen3-4b-base <img width="1108" height="580" alt="image" src="https://github.com/user-attachments/assets/059dd495-3cdf-4df1-bf27-70e010e368e4" /> --------- Co-authored-by: Sumanth R Hegde <39546518+SumanthRH@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
dzorlu
pushed a commit
to fleet-ai/SkyRL
that referenced
this pull request
Feb 4, 2026
# Overview Adds an example of extending the `RayPPOTrainer` to do on policy distillation by providing a custom `apply_reward_kl_penalty` function, a pass through advantage estimator, and using the `importance_sampling` loss function as detailed in the [thinky blog](https://tinker-docs.thinkingmachines.ai/losses#policy-gradient-importance_sampling). ### distilling rl trained qwen3-4b-base (dapo recipe) back into qwen3-4b-base <img width="1108" height="580" alt="image" src="https://github.com/user-attachments/assets/059dd495-3cdf-4df1-bf27-70e010e368e4" /> --------- Co-authored-by: Sumanth R Hegde <39546518+SumanthRH@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds an example of extending the
RayPPOTrainerto do on policy distillation by providing a customapply_reward_kl_penaltyfunction, a pass through advantage estimator, and using theimportance_samplingloss function as detailed in the thinky blog.distilling rl trained qwen3-4b-base (dapo recipe) back into qwen3-4b-base