trl icon indicating copy to clipboard operation
trl copied to clipboard

Proposal: audit zero-advantage group filtering under imperfect rewards

Open GBX-Max1220 opened this issue 1 month ago • 9 comments

Following Quentin’s suggestion, I’m opening a separate proposal related to #7609 for feedback from @AmineDiro and others.

I’d like to investigate how imperfect rewards affect which prompt groups survive zero-advantage filtering.

At commit 8248639, _score_group drops groups with no scorable rewards or zero reward standard deviation. The implementation also distinguishes reward across all scored groups from reward_kept for retained samples.

A verifier error could turn an otherwise constant-reward group into a retained group, or make a genuinely mixed group appear constant and be filtered out. I’d like to measure this selection effect separately from any downstream training effect.

Proposed first step

A small CPU-only simulation using fixed groups with known binary correctness labels. Apply controlled false-positive and false-negative rates to obtain observed rewards, then compare filtering decisions under oracle and noisy rewards.

I would report:

Groups retained only because of reward errors, and groups incorrectly filtered out.

Retention rates across underlying correctness levels and group sizes.

Oracle versus observed rewards, before and after filtering.

The number of generated groups needed to obtain a given number of retained groups.

I would start with independent errors as a simplifying assumption and state that limitation explicitly. Unscorable rewards would remain separate from incorrect answers.

This would be an analysis harness, with no trainer changes initially. It would not establish gradient bias or an effect on final model quality.

Would this be useful for AsyncGRPO? Are there particular reward-error patterns or diagnostics you would prioritize?

GBX-Max1220 avatar Oct 15 '26 09:10 GBX-Max1220

I’d pin the filtering implementation first. In current _score_group, constant rewards produce zero advantages, but the function constructs samples instead of dropping the group. I haven’t run the current trainer. Your harness should state explicitly which filtering policy it models.

For the binary, fully scorable case, there’s a useful exact baseline. Let n >= 2 be group size, k the number truly correct, a the false-positive rate and b the false-negative rate. Under independent errors, the probability of surviving a zero-variance filter is

1 - (1-b)^k * a^(n-k) - b^k * (1-a)^(n-k)

The subtracted terms are the probabilities that every observed reward is one or zero. I checked this against exhaustive enumeration for group sizes 2 through 8. That validates the formula, not trainer behavior.

I’d prioritize within-group error correlation next. Four truly correct completions with independent 10% false negatives survive this filter 34.38% of the time. If the same error flips the entire group together, the marginal false-negative rate is still 10%, but retention is zero. Verifier accuracy alone therefore cannot predict the selection effect.

Keep unscorable outcomes outside this binary control, as you proposed, and report retention by true group composition before drawing any training conclusions.

IlyaKhalafi avatar Oct 18 '26 19:10 IlyaKhalafi

  1. I’d pin the filtering implementation first. In current _score_group, constant rewards produce zero advantages, but the function constructs samples instead of dropping the group. I haven’t run the current trainer. Your harness should state explicitly which filtering policy it models. For the binary, fully scorable case, there’s a useful exact baseline. Let n >= 2 be group size, k the number truly correct, a the false-positive rate and b the false-negative rate. Under independent errors, the probability of surviving a zero-variance filter is

    1 - (1-b)^k * a^(n-k) - b^k * (1-a)^(n-k)
    

    The subtracted terms are the probabilities that every observed reward is one or zero. I checked this against exhaustive enumeration for group sizes 2 through 8. That validates the formula, not trainer behavior. I’d prioritize within-group error correlation next. Four truly correct completions with independent 10% false negatives survive this filter 34.38% of the time. If the same error flips the entire group together, the marginal false-negative rate is still 10%, but retention is zero. Verifier accuracy alone therefore cannot predict the selection effect. Keep unscorable outcomes outside this binary control, as you proposed, and report retention by true group composition before drawing any training conclusions.

Thanks, Ilya — that’s an important correction. I checked the pinned _score_group path too: constant rewards produce zero advantages, but the function doesn’t drop the group. I’ll keep the filtering analysis explicitly hypothetical rather than describe it as current TRL behavior.

Your correlated-error example also makes the distinction clear: verifier accuracy alone doesn’t tell us which groups would survive a filter. For a small follow-up, I’d separate independent versus shared errors and report retention by true group composition, keeping unscorable cases separate.

GBX-Max1220 avatar Oct 19 '26 09:10 GBX-Max1220

TRL_Group_Error_Control_20261021.zip

Thanks, Ilya—I ran the small follow-up you suggested, keeping zero-variance filtering explicitly hypothetical.

Your 34.38% example reproduces. Across true group compositions, the same marginal verifier accuracy gives different retention rates under independent versus shared errors. One caution: in the symmetric shared-error control, mixed groups always survive, including the 10% where every label flips. Higher retention therefore doesn’t necessarily mean a better signal.

I also executed the pinned _score_group function with controlled rewards and mocked rollout objects: constant-reward groups still return samples with zero advantages. This was not a trainer run.

I’ve attached the AI-assisted script and results. Is there an existing set of grouped completions with independently checkable outcomes that you’d recommend for a small empirical follow-up?

GBX-Max1220 avatar Oct 21 '26 06:10 GBX-Max1220

I'd start with OpenR1-Math-Raw at revision 8d393c2. Its generations field keeps completions grouped by problem, alongside reference answers and separate verifier outputs. Keep whole groups with at least two completions. For this pilot, skip proof questions, check reference answers independently, and treat null verifier results as unscorable.

A concrete candidate is train row 250000. Both completions answer A for the circle question. The tangency conditions give x^2 = 8(y - 1), a parabola, so their final answers can be checked independently. Its stored llama_verification labels are [true, false], and math_verify_answer labels are [true, true]. Under your hypothetical filter, the Llama labels would retain this group even though both final answers are correct.

Use that as a worked example, then estimate rates from an independently labelled sample of whole groups. Treat the stored correctness flags as verifier predictions. Raw also has length and reasoning format filters that should be reported with the results.

IlyaKhalafi avatar Oct 21 '26 07:10 IlyaKhalafi

Hi Ilya, I followed your suggestion and checked whole problem groups from the pinned OpenR1-Math-Raw revision.

The pilot covers 30 groups / 66 completions. After excluding unresolved or incomplete problems, the main comparison contains 27 groups / 60 completions. Against frozen AI-reviewed labels—not human gold—the stored llama_verification labels change the keep/drop decision for 9 of those 27 groups under the hypothetical “keep mixed-reward groups” rule.

One useful counterexample: in G024, the reviewed labels are [0,1], while the stored verifier labels are [1,0]. Both retain the group, but assign reward to opposite completions. So selection agreement alone can hide a reward-direction disagreement.

I’ve attached the report, per-case results, and reproduction script. This is an offline comparison; I haven’t run training.

Would it be more useful to focus next on group-selection changes or reward-direction disagreements within retained groups?

4. I'd start with OpenR1-Math-Raw at revision 8d393c2. Its generations field keeps completions grouped by problem, alongside reference answers and separate verifier outputs. Keep whole groups with at least two completions. For this pilot, skip proof questions, check reference answers independently, and treat null verifier results as unscorable. A concrete candidate is train row 250000. Both completions answer A for the circle question. The tangency conditions give x^2 = 8(y - 1), a parabola, so their final answers can be checked independently. Its stored llama_verification labels are [true, false], and math_verify_answer labels are [true, true]. Under your hypothetical filter, the Llama labels would retain this group even though both final answers are correct. Use that as a worked example, then estimate rates from an independently labelled sample of whole groups. Treat the stored correctness flags as verifier predictions. Raw also has length and reasoning format filters that should be reported with the results.

Verifier_Comparison_G001_G030_20261022.zip

GBX-Max1220 avatar Oct 21 '26 19:10 GBX-Max1220

I would focus next on reward direction within retained groups, while keeping the selection comparison alongside it.

G024 shows why keep/drop agreement is insufficient. Its vectors [0, 1] and [1, 0] produce opposite centered rewards despite both retaining the group. For each jointly retained group, compare the centered reward vectors and report reversed or tied pairwise rankings.

Your primary llama table has only one jointly retained group, G024. After an independent second review of the provisional labels, I would add more independently checkable mixed-correctness groups before estimating how common these reversals are. Keep that targeted sample separate from the existing pilot so its selection-flip rate stays interpretable.

I also checked the G024 weighting argument. Number rows and columns from 1. Give cells in an odd row and odd column weight −2 and all others +1. The 5×7 board totals −1, while every L-tromino totals 0 or 3. Covering each cell k times would require total weight −k, so uniform positive coverage is impossible.

Keep the reviewed labels provisional and distinguish this offline reward disagreement from evidence of training harm.

IlyaKhalafi avatar Oct 22 '26 06:10 IlyaKhalafi

6. I would focus next on reward direction within retained groups, while keeping the selection comparison alongside it. G024 shows why keep/drop agreement is insufficient. Its vectors [0, 1] and [1, 0] produce opposite centered rewards despite both retaining the group. For each jointly retained group, compare the centered reward vectors and report reversed or tied pairwise rankings. Your primary llama table has only one jointly retained group, G024. After an independent second review of the provisional labels, I would add more independently checkable mixed-correctness groups before estimating how common these reversals are. Keep that targeted sample separate from the existing pilot so its selection-flip rate stays interpretable. I also checked the G024 weighting argument. Number rows and columns from 1. Give cells in an odd row and odd column weight −2 and all others +1. The 5×7 board totals −1, while every L-tromino totals 0 or 3. Covering each cell k times would require total weight −k, so uniform positive coverage is impossible. Keep the reviewed labels provisional and distinguish this offline reward disagreement from evidence of training harm.

Thanks, Ilya—especially for independently checking the G024 proof. I’ll compare centered rewards and reversed/tied pairwise rankings within jointly retained groups, alongside the selection results.

I’ll arrange a second review of the provisional labels first, then keep any targeted mixed-correctness sample separate from the original pilot. The conclusions will remain about offline reward disagreement, without claiming training harm.

GBX-Max1220 avatar Oct 22 '26 15:10 GBX-Max1220

6. I would focus next on reward direction within retained groups, while keeping the selection comparison alongside it. G024 shows why keep/drop agreement is insufficient. Its vectors [0, 1] and [1, 0] produce opposite centered rewards despite both retaining the group. For each jointly retained group, compare the centered reward vectors and report reversed or tied pairwise rankings. Your primary llama table has only one jointly retained group, G024. After an independent second review of the provisional labels, I would add more independently checkable mixed-correctness groups before estimating how common these reversals are. Keep that targeted sample separate from the existing pilot so its selection-flip rate stays interpretable. I also checked the G024 weighting argument. Number rows and columns from 1. Give cells in an odd row and odd column weight −2 and all others +1. The 5×7 board totals −1, while every L-tromino totals 0 or 3. Covering each cell k times would require total weight −k, so uniform positive coverage is impossible. Keep the reviewed labels provisional and distinguish this offline reward disagreement from evidence of training harm.

Thanks, Ilya. The second AI review agreed with G024’s provisional labels [0,1]. It also found C02’s original proof invalid despite its correct final answer. Prior context had exposed the case, so this was not a blind review or human-gold validation.

For G024—the only jointly retained group in the primary llama comparison—the single pair reverses order, with no tie. Treating the stored labels as the sole binary reward, replay through the pinned _score_group function changes advantages from approximately [-1,+1] to [+1,−1]. Both reward vectors remain nonconstant.

I’ve attached the review and replay materials. This confirms the conditional advantage-sign reversal, not training harm or its prevalence. Any additional mixed-correctness groups will stay separate from the original pilot.

TRL_G024_Second_AI_Review_20261023.zip

TRL_Advantage_Direction_Replay_20261022.zip

GBX-Max1220 avatar Oct 22 '26 16:10 GBX-Max1220

Thanks for the write-up. One status update for the thread: #7609 has since merged, so the filter is no longer hypothetical. On main, zero-variance groups are dropped:

https://github.com/huggingface/trl/blob/0735a10bd1d3f102f8683d4f09ea2c156b7f2ccb/trl/experimental/async_grpo/async_rollout_worker.py#L1266-L1272

That said, this is an offline study of verifier noise rather than a change to TRL. The trainer only ever sees observed rewards, so there is no oracle it could correct against, and frac_reward_zero_std together with reward vs reward_kept already show what the filter is doing during a run.

The issue tracker isn't a good home for an ongoing research thread, so I'll close this. If the analysis points to something concrete TRL should change please open a focused issue for it.

qgallouedec avatar Nov 02 '26 15:11 qgallouedec