Skip to content

feat(ppo): add optional IcePop-style importance-ratio token filtering#1061

Closed
RedDreamer wants to merge 3 commits intoinclusionAI:mainfrom
RedDreamer:feat/icepop_masking
Closed

feat(ppo): add optional IcePop-style importance-ratio token filtering#1061
RedDreamer wants to merge 3 commits intoinclusionAI:mainfrom
RedDreamer:feat/icepop_masking

Conversation

@RedDreamer
Copy link
Copy Markdown
Contributor

Description

Implements IcePop masking based on the method described in Every Step Evolves: Scaling Reinforcement Learning for Trillion-Scale Thinking Model. (https://arxiv.org/pdf/2510.18855)

This change adds token-level discrepancy masking/clipping to mitigate training–inference mismatch during RL training, following the paper’s IcePop approach.

https://arxiv.org/pdf/2510.18855

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📝 Documentation update
  • ♻️ Refactoring
  • ⚡ Performance improvement
  • ✅ Test coverage improvement

Checklist

  • I have read the Contributing Guide
  • Pre-commit hooks pass (pre-commit run --all-files)
  • Relevant tests pass; new tests added for new functionality
  • Documentation updated (if applicable; built with ./docs/build_all.sh)
  • Branch is up to date with main
  • Self-reviewed via /review-pr command
  • This PR was created by a coding agent via /create-pr
  • This PR is a breaking change

Breaking Change Details (if applicable):

Additional Context


Need help? Check the Contributing Guide or ask in
GitHub Discussions!

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 introduces a significant enhancement to the PPO trainer by incorporating IcePop-style importance ratio token filtering. This feature aims to improve the stability and performance of reinforcement learning models by addressing the common issue of training-inference mismatch, ensuring that only tokens within a specified importance ratio range contribute to the loss calculation. The change provides new configuration options for fine-tuning this behavior.

Highlights

  • IcePop-style Importance Ratio Token Filtering: Implemented token-level discrepancy masking/clipping, known as IcePop masking, to mitigate training-inference mismatch during RL training, as described in the paper 'Every Step Evolves: Scaling Reinforcement Learning for Trillion-Scale Thinking Model'.
  • Configurable Filtering Parameters: Introduced new command-line arguments to enable and configure the importance ratio token filtering, including enable_importance_ratio_token_filtering, importance_ratio_lower_bound, and importance_ratio_upper_bound.
  • PPO Loss Function Integration: Integrated the new filtering logic directly into the PPO grpo_loss_fn, allowing for dynamic masking of tokens based on their importance ratio during loss calculation.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

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
Copy Markdown
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 introduces an optional IcePop-style importance-ratio token filtering mechanism. The changes include adding configuration parameters in cli_args.py, integrating these parameters into the PPO actor's logging and loss function (actor.py), and implementing the core filtering logic in a new helper function. The new feature enhances the PPO training process by mitigating training-inference mismatch. Overall, the implementation is clear and follows the described approach, but there are a couple of areas for improvement related to code clarity and potential unintended gradient flow.

Comment thread areal/trainer/ppo/actor.py Outdated
Comment thread areal/trainer/ppo/actor.py Outdated
@RedDreamer RedDreamer marked this pull request as draft March 19, 2026 07:19
RedDreamer and others added 2 commits March 19, 2026 15:20
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@RedDreamer RedDreamer marked this pull request as ready for review March 19, 2026 07:22
@ZiyiTsang
Copy link
Copy Markdown
Collaborator

ZiyiTsang commented Mar 19, 2026

Thanks for your PR, however,,
What is this different from PR #930? The MIS is already supported, if I am not mistaken..?

@garrett4wade
Copy link
Copy Markdown
Collaborator

garrett4wade commented Mar 19, 2026

Thank you for the contribution! While the ice pop feature is great, there are too many filtering approaches (going to be) implemented within AReaL and things are going wild. We'd better devise a unified and principled approach, rather than adding several new options for each type of filtering.

For more details, see #1052

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026

This pull request has been automatically marked as stale because it has not had recent activity within the last 14 days.

Please add a comment or push new commits to keep it active.

Thank you for your contribution!

@github-actions github-actions Bot added the stale label Apr 8, 2026
@garrett4wade
Copy link
Copy Markdown
Collaborator

This feature should have been integrated in #1088

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants