Repository navigation
feat(opd): add optional advantage clipping - #814
Merged
Merged
Conversation
BobbyZhouZijian
requested review from
Benjamin-eecs,
MikeZheng777,
hanfeiyu and
quao627
as code owners
October 14, 2026 13:44
Contributor
|
looks good man |
MikeZheng777
enabled auto-merge (squash)
October 14, 2026 16:02
MikeZheng777
disabled auto-merge
October 14, 2026 16:05
This was referenced Oct 15, 2026
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.
Motivation
Sampled OPD uses the teacher/student log-probability difference directly as its gradient weight. Large differences can dominate an update. Add an optional fixed bound, following the clipping used by Reef's OpenClawRL OPD branch.
Changes
opd-advantage-clipthrough the shared Slime distillation settings. A positive value bounds the sampled reverse-KL advantage symmetrically before importance-sampling and sample weights.Documentation impact
Readers need to know how to enable clipping and how it changes training. Update
recipes/opd/README.mdanddocs/user-guide/recipes/opd.rstwith the default, supported representation, and a1.0example. Review both sections in context. See Verification for checks; the GPU training example was not executed.Compatibility and operational impact
The new option defaults to
0(disabled), preserving existing behavior. Other distillation families inherit the optional flag under their own prefix. Clipping requires sampled reverse KL with positive top-K and renormalized support. It changes the gradient, not the reported divergence. No persisted formats, wire rows, deployment topology, or dependencies change.Verification
.venv/bin/python -m mypy: passed for 378 source files.pre-commit run --all-files: passed.npm run check:docsindocs/site: passed.NO_PROXY=localhost,127.0.0.1 no_proxy=localhost,127.0.0.1 GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null .venv/bin/python -m pytest tests/ -n 4 --dist loadfile -q --durations=10: 6282 passed, 101 skipped, 3 warnings. Local HTTP tests require the localhost proxy bypass on this host.AI assistance
Codex inspected the existing objectives, implemented the option, added tests and documentation, and ran checks. The contributor remains responsible for reviewing and understanding the change.
Checklist
AGENTS.md.AGENTS.md.README.i18n.yaml, or do not affect README content.Review and merge
Reviewers are requested automatically from
CODEOWNERS. See the maintenance model for review and merge requirements.Need help on this PR? Tag
@codesmith-botwith what you need.