Skip to content

Conversation

@hjh0119
Copy link
Collaborator

@hjh0119 hjh0119 commented Oct 28, 2025

  1. Provide an on-policy distillation script as described in https://thinkingmachines.ai/blog/on-policy-distillation/
  2. Align the forward/reverse KL terminology used in this blog with the documentation

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hjh0119, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Generalized Knowledge Distillation (GKD) framework by introducing a practical example for on-policy distillation and refining its documentation. The changes aim to provide clearer guidance on implementing advanced distillation techniques and to ensure the theoretical underpinnings, particularly regarding KL divergence types, are accurately represented and consistent with external research.

Highlights

  • On-Policy Distillation Script: A new example script, on_policy_distillation.sh, has been added to demonstrate how to perform on-policy distillation training using the swift rlhf framework, aligning with the methodology described in the Thinking Machines Lab blog.
  • GKD Documentation Clarification: The Generalized Knowledge Distillation (GKD) documentation (both English and Chinese versions) has been updated to correct and clarify the definitions and characteristics of Forward KL and Reverse KL divergences, ensuring consistency with the referenced research blog post. This includes revising the mathematical formulas and their associated properties (Mode-seeking vs. Mode-covering).
  • Beta Parameter Mapping Correction: The documentation now accurately maps the beta parameter values (0.0 and 1.0) to their corresponding KL divergence types (Forward KL and Reverse KL) within the context of Generalized Jensen-Shannon Divergence (JSD) interpolation.
  • On-Policy Distillation Usage Guide: New sections have been added to the GKD documentation to guide users on how to configure the --lmbda and --beta parameters to achieve On-Policy Distillation, with a direct reference to the newly provided example script.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the GKD documentation to align the Forward/Reverse KL divergence terminology with a recent blog post and adds a new example script for on-policy distillation. The changes in the documentation are a good correction. I've provided some suggestions to improve the clarity of the documentation by restoring some descriptive details that were removed. I've also suggested improvements to the new shell script to make it more user-friendly by adding explanatory comments for prerequisite steps and potentially problematic parameters. Overall, these are good additions.

@hjh0119 hjh0119 merged commit eacc0a1 into modelscope:main Oct 28, 2025
1 of 2 checks passed
@hjh0119 hjh0119 deleted the opd branch October 28, 2025 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants