Skip to content

test(grpo): reproduce LOO dynamic-sampling group split - #3469

Open
gkaplun-nvidia wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
gkaplun-nvidia:test/grpo-loo-dynamic-sampling
Open

test(grpo): reproduce LOO dynamic-sampling group split#3469
gkaplun-nvidia wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
gkaplun-nvidia:test/grpo-loo-dynamic-sampling

Conversation

@gkaplun-nvidia

Copy link
Copy Markdown
Contributor

Summary

  • Adds a failing integration-level regression test for GRPO dynamic sampling with a leave-one-out (LOO) baseline.
  • Runs through the real grpo_train() path with one prompt and four generations.
  • Covers [1, 0, 0, 0] (single success), [1, 1, 1, 0] (single failure), and [1, 1, 0, 0] (balanced control).
  • Expects every non-uniform prompt group to reach the next training stage intact.
  • Test only: no production fix is included.

Observed behavior

LOO produces response-specific standard deviations. When exactly one response differs, that response sees three identical siblings, receives a zero LOO standard deviation, and is removed by the current row-wise std != 0 filter. The remaining three identical responses are cached and backfilled from another rollout batch.

As a result, [1, 0, 0, 0] becomes [0, 0, 0, 0], while [1, 1, 1, 0] becomes [1, 1, 1, 1]. The balanced [1, 1, 0, 0] case already passes because every leave-one-out subset remains diverse.

The test observes the final batch immediately after dynamic sampling. It does not prescribe whether maintainers fix the statistics calculation, the filtering logic, or another part of the implementation.

Verification

  • Ruff format/check: pass.
  • Six existing DAPO dynamic-sampling tests: pass.
  • Balanced control: pass.
  • Single-success and single-failure regressions: fail as expected, each missing its unique reward.

Run:
uv run pytest -q tests/unit/algorithms/test_grpo.py::test_grpo_train_dynamic_sampling_with_loo_keeps_prompt_group_intact

Exercise dynamic sampling through grpo_train with one prompt and four responses across single-success, single-failure, and balanced reward distributions. Every non-uniform prompt group should reach training intact.

The one-outlier cases currently fail because the leave-one-out standard deviation causes the unique response to be filtered out and the batch to be backfilled with identical responses. The balanced case is a passing control. This is intentionally a test-only reproducer; no production fix is included.

Signed-off-by: gkaplun <gkaplun@nvidia.com>
@gkaplun-nvidia
gkaplun-nvidia requested a review from a team as a code owner August 3, 2026 12:58
@copy-pr-bot

copy-pr-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant