Add IcePop Masking - #24
Open
Crystalcareai wants to merge 3 commits into
Open
Conversation
- Introduced IcePop configuration options (icepop_enabled, icepop_alpha, icepop_beta) in ClippedPGLossFn and CISPOLossFn. - Implemented masking logic based on engine mismatch ratio to enhance stability. - Added diagnostics for the fraction of tokens masked due to engine mismatch.
…integration - Updated token masking logic to incorporate IcePop mask in loss calculations. - Ensured consistent use of token_mask_for_loss in both loss functions to improve stability and accuracy.
| icepop_mask, | ||
| original_mask, | ||
| global_normalization_factor=global_valid_toks, | ||
| ).item() |
There was a problem hiding this comment.
Bug: IcePop fraction metric breaks aggregation across microbatches
The icepop_fraction_masked metric is computed as 1.0 - masked_mean(...), which breaks the expected aggregation pattern. Per the code comment, metrics are designed to be summed across microbatches to get the true global value. All other metrics return masked_mean(...) directly, so summing gives the correct global mean. However, 1.0 - masked_mean(...) adds a constant 1.0 per microbatch, causing the aggregated result to be N - global_fraction_not_masked instead of the expected 1 - global_fraction_not_masked. The metric should return the fraction NOT masked directly (without the 1.0 -), letting the caller invert after aggregation if needed.
Additional Locations (1)
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.
Adds IcePop stabilization from Ring-1T (arXiv:2510.18855) to both ClippedPG and CISPO loss functions.
What it does
Masks out tokens where the engine mismatch ratio π_train/π_infer falls outside configurable bounds [alpha, beta] (default [0.5, 2.0]).
Why hard masking vs soft weighting
We discard tokens entirely rather than downweighting them because:
Configuration
Monitoring
Logs
icepop_fraction_maskedmetric to track what fraction of tokens are being discarded.Note
Adds IcePop-based token masking to ClippedPG and CISPO losses, exposes config knobs, logs masking diagnostics, and provides an example training config.
rlkit/algorithms/loss_functions.py):exp(prev_logprobs - generation_logprobs)is outside[icepop_alpha, icepop_beta].ClippedPGLossFnandCISPOLossFn; affectsmaskand sequence-leveltoken_mask_for_loss.icepop_fraction_maskedmetric.engine_mismatch_ratioin CISPO forsampling_importance_ratio.rlkit/config/rl/loss.py):icepop_enabled,icepop_alpha,icepop_betatoClippedPGLossConfigandCISPOLossConfig.token_level_losstoCISPOLossConfig.examples/configs/rl/reverser/qwen3_0.6B_2gpu_icepop.yamldemonstrating CISPO + IcePop settings and training setup.Written by Cursor Bugbot for commit dbb78e7. This will update automatically on new commits. Configure here.