You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds BalDRO (arXiv:2601.09172, nxZhai/BalDRO), accepted at The Web Conference 2026 (WWW 2026), as an unlearning plugin.
BalDRO-G selects forget samples using length-normalized NLL, while BalDRO-DV applies log-mean-exp aggregation to per-sample losses. Both variants support NPO, SimNPO, and SatImp.
Changes
src/trainer/unlearn/BalDRO.py: six trainers implementing BalDRO-G and BalDRO-DV.
src/trainer/__init__.py and configs/trainer/BalDRO/: trainer registration and six configurations.
community/methods/BalDRO/: TOFU/MUSE parameter-grid scripts, a run wrapper, and method documentation.
README.md: adds BalDRO to the available methods.
Usage
Run a TOFU parameter sweep from the repository root:
Individual trainers can be selected with trainer=BalDRO/<TrainerName>. See community/methods/BalDRO/README.md for the supported trainers and TOFU/MUSE scripts.
Before submitting
This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
1. Add BalDRO-G and BalDRO-DV trainers for NPO, SimNPO, and SatImp, with six trainer configurations and registry entries.
2. Add TOFU/MUSE parameter-grid scripts, a run wrapper, method documentation, and the main method listing.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical configuration inheritance errors prevent BalDRO training from starting, while selection and loss handling for empty-label sequences can produce NaN losses and gradients.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Zero-target rows can distort forget-loss aggregation and cause NaN NLL retain losses after subsampling, requiring filtering and empty-batch safeguards.
Exclude zero-target forget rows from DV aggregation
src/trainer/unlearn/BalDRO.py:51
Forget rows without valid shifted targets still enter DV aggregation; preprocessing permits these rows (src/data/utils.py:129–139). For DrNPO, they contribute the constant 2*log(2)/beta without a gradient, which can dominate the aggregation at small DV temperatures and suppress learning from valid rows. Filter out zero-target forget rows before computing per-sample losses, and reject batches with none remaining.
1. Filter invalid forget rows before DV aggregation and invalid NLL retain rows before group sampling; reject empty selections and preserve KL sampling.
2. Add regression tests for filtering, empty batches, and loss and gradient consistency; CPU tests and quality checks pass.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Retain sequences with no valid shifted targets are not filtered, diluting DRO gradients and potentially producing NaN for entirely masked batches under ordinary NLL retention.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Filter retain sequences with no valid shifted targets
src/trainer/unlearn/BalDRO.py:72
Retain sequences with no valid shifted targets are not filtered for NLL retention. With retain_dro=True, they enter the aggregation as zero-loss samples and dilute valid samples' gradients; with ordinary NLL retention, an entirely masked batch can produce NaN. Filter these rows before either retain-loss branch and reject batches with no valid retain targets, while leaving KL retention unchanged.
1. Filter NLL retain samples without valid shifted targets in BalDRO.py and reject batches with no valid retain targets, preserving KL retention.
2. Extend test_baldro.py to cover loss and gradient equivalence, empty-target rejection, and KL retention across all three DV trainers.
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
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.
What does this PR do?
Adds BalDRO (arXiv:2601.09172, nxZhai/BalDRO), accepted at The Web Conference 2026 (WWW 2026), as an unlearning plugin.
BalDRO-G selects forget samples using length-normalized NLL, while BalDRO-DV applies log-mean-exp aggregation to per-sample losses. Both variants support NPO, SimNPO, and SatImp.
Changes
src/trainer/unlearn/BalDRO.py: six trainers implementing BalDRO-G and BalDRO-DV.src/trainer/__init__.pyandconfigs/trainer/BalDRO/: trainer registration and six configurations.community/methods/BalDRO/: TOFU/MUSE parameter-grid scripts, a run wrapper, and method documentation.README.md: adds BalDRO to the available methods.Usage
Run a TOFU parameter sweep from the repository root:
Individual trainers can be selected with
trainer=BalDRO/<TrainerName>. Seecommunity/methods/BalDRO/README.mdfor the supported trainers and TOFU/MUSE scripts.Before submitting