feat(rl): add REINFORCE advantage estimator#2083
Open
EazyReal wants to merge 1 commit into
Open
Conversation
Add a plain `reinforce` advantage estimator: GRPO-style group-normalized advantages with the additive `-A*logpi` surrogate (`compute_reinforce_loss` in ppo_utils) -- no PPO/IS ratio, no clipping, gradient only through `log_probs`. Reuses the existing GRPO returns / group-normalization plumbing; only the surrogate differs. This is the on-policy base for layering off-policy importance-sampling corrections on top via the TIS hook (added separately). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0a6ea75 to
8f1c408
Compare
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.
What
Adds a plain
reinforceadvantage estimator: GRPO-style group-normalized advantages with the additive-A·logπsurrogate (compute_reinforce_loss) — no PPO/IS ratio, no clipping, gradient only throughlog_probs. Reuses the existing GRPO returns / group-normalization plumbing; only the surrogate differs fromgrpo.This is the on-policy REINFORCE base. Off-policy importance-sampling corrections layer on top via the existing TIS hook — see the companion PR (current-policy IS correction), which composed with
reinforcereproduces the CISPO surrogate.Changes
compute_reinforce_loss(ppo_utils.py);reinforcerouted through the GRPO returns path + group-normalization (loss.py,ray/rollout.py); added to--advantage-estimatorchoices/help (arguments.py) and thepolicy_loss_functiondispatch (loss.py), next to the other reinforce variants.Tests —
tests/test_reinforce.py(CPU,NUM_GPUS = 0)Pure-torch (like
test_chunked_gae.py); REINFORCE closed-form loss + gradient-only-through-log_probs.Relation to the CISPO estimator
CISPO already ships as a dedicated
--advantage-estimator cispo(#2067). This PR plus the companion current-policy IS correction express the same surrogate compositionally —reinforce+ that correction reproduces CISPO exactly (verified) — while the hook also enables other off-policy corrections. Both paths can coexist; if you'd prefer a single one, the composable form can subsume the dedicated estimator. Raising it for your preference. (miles counterpart: radixark/miles#1343.)🤖 Generated with Claude Code