Repository navigation
feat(gym): do not capture tokens for validation rollouts - #5098
Conversation
653e967 to
b6b395a
Compare
|
/ok to test b6b395a |
b6b395a to
4380d94
Compare
|
/ok to test 4380d94 |
4380d94 to
00da814
Compare
|
/ok to test 00da814 |
pthombre
left a comment
There was a problem hiding this comment.
Thanks for this. The change is the RL half of NVIDIA-NeMo/Gym#5711 and it is done carefully: the setting is a plain keyword argument with the safe default, training rows are cleared rather than trusted, and the copied key name has a comment and a test that fails if Gym's name changes.
What the review checked:
- All three NeMo-Gym validation paths (GRPO, distillation, grpo_sync) pass
skip_token_capture=True, and no training path can send the mark. - RL writes the mark the way Gym reads it, at both the Gym commit this PR pins and the one
mainpins. - Removing any production line the PR adds makes one of the PR's tests fail (run in a light environment, not the locked one).
One small cleanup:
- (C1, C2) The
skip_token_capturekey in the result of a rollout that skipped token capture has no reader outside the test.
Generated by Claude Code
|
/ok to test 0d29049 |
Gym can now skip token capture for one rollout: a row with `_ng_skip_token_capture: true` makes none of that rollout's model calls carry the training tag, so RL's vLLM worker stages nothing for it in TransferQueue (NVIDIA-NeMo/Gym#5340). - GRPO and distillation validation mark their rows with `_ng_skip_token_capture: true` (`run_nemo_gym_rollout_sync(skip_token_capture=True)`). Rows RL trains on drop any leftover mark, so they are always captured; the single-controller rollout manager clears it the same way. - Under token capture, the Gym actor reads no ledger manifest for a row RL skipped. It returns the Environment Server's result with `receipt: None` and `skip_token_capture: True`. A row without the mark still needs its capture and is masked as before when it has none. No path runs validation with token capture today: only the single controller enables capture, and it has no validation loop. Synchronous validation never captures, so the mark changes nothing there yet. Signed-off-by: Zeyu Zhou <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Follow-up to the team review of the per-rollout skip: - The TransferQueue sync trainer's validation (`grpo_sync.validate_sync`) marks its rows: `SyncRolloutActor.rollout_to_tq` takes `skip_token_capture` and forwards it to `run_nemo_gym_rollout_sync`. - Tests for each forwarding step: sync to async, async to `_prepare_nemo_gym_rows`, the single controller's `_build_inputs`, and distillation's and grpo_sync's validation. - Comments say that training rows never skip capture, rather than that they are always captured. Signed-off-by: Zeyu Zhou <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sults No code reads the key in the Gym actor's result for a rollout RL skipped capture for; a caller that needs to know already holds the row and its `_ng_skip_token_capture` mark. Remove it with the docstring words that named it. Signed-off-by: Zeyu Zhou <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
0d29049 to
cceb2eb
Compare
|
/ok to test cceb2eb |
terrykong
left a comment
There was a problem hiding this comment.
Thanks for this. The RL half of Gym#5711 is small and safe. The default clears the mark on training rows, which matters because Gym's dataset prep keeps a row's skip mark (dataset_preparation.py). The copied key has a test that fails, not skips.
What we checked:
- Every Gym validation path passes the flag: grpo, distillation and grpo_sync. Async GRPO reuses grpo's validate.
- Gym reads the key at the row's top level, where RL writes it (episode_context.py).
- With capture off, the mark changes nothing (base_responses_api_agent.py).
- Every added line fails a test if reverted.
FYI, no action: the v1 batch builder reads input_message_log[0], so it can't use token-less results, captured or skipped. Nothing reaches it today: only the single controller turns capture on, and it has no validation loop yet. Whoever turns on validation with capture will need that consumer to read full_result.
Inline:
- (C3) Trim the
_skipped_capture_resultdocstring to three lines, ending with a pointer to #5044.
Visual explainer: https://terrykong.github.io/gh-pages-poc/terryk/pr-5098-validation-skips-capture.html
nemo-rl-review: kind=expert harness=claude-code/2.1.332 model=claude-opus-5-5 effort=medium review-pr-team=v3 reviewed=cceb2eb
Say what the helper returns and point single-controller validation to NVIDIA-NeMo#5044 and full_result, as suggested in review. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Zeyu Zhou <[email protected]>
|
/ok to test d75f961 |
|
/ok to test 457d683 |
…masked_reward_policy Main's #5098 added test_actor_forwards_the_token_capture_setting_to_the_gym_rollout with a SimpleNamespace grpo config that has no masked_reward_policy. On this branch rollout_to_tq passes exclude_infra_policy_kinds(cfg.grpo), which reads that field, so the test raised AttributeError after the merge of main. Real configs always carry it (GRPOConfig defaults it to exclude_infra), so the fake config gets the field rather than the read getting a default. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
What does this PR do ?
RL side of NVIDIA-NeMo/Gym#5711: validation rollouts are not token-captured.
It has no effect until validation runs with token capture on, which no RL path does yet.
Related: #5044 (item 1, "Training-time validation": the single-controller validation loop that will turn this on).
Problem
top_logprobsalternatives when set.Changes
run_nemo_gym_rollout_syncandrun_async_nemo_gym_rollouttakeskip_token_capture(defaultFalse):True,_prepare_nemo_gym_rowsmarks each row_ng_skip_token_capture: true, and Gym captures none of that rollout's model calls;False, it removes any leftover mark, so rows RL trains on never skip capture. The single-controller rollout manager clears it too.validate()and grpo_sync'svalidate_sync()passskip_token_capture=True;SyncRolloutActor.rollout_to_tqforwards it for grpo_sync.full_result, withreceipt: None. A row without the mark still needs its capture, and is masked as before when it has none.NEMO_GYM_SKIP_TOKEN_CAPTURE_KEYcopies Gym'sSKIP_TOKEN_CAPTURE_KEY_NAME, and a test checks that they match.Usage
No new configuration. Validation rollouts skip token capture.
Validation
_prepare_nemo_gym_rows(skip_token_capture=True), then the same Gym actor.examples/run_grpo_single_controller.py, through a test hooksimple_agent+ LLM judgesingle_agent_turnsimple_agent+ LLM judgesingle_agent_turn_legacysimple_agent+ LLM judgelegacy_agentverifiers_agentlegacy_agentsingle_agent_turnThe 8 skipped rollouts returned their reward with no model call captured, and kept their rollout prefix. The 16 training rollouts were captured as before, and the step trained.
🤖 Generated with Claude Code