Repository navigation
Conversation
`hit_max_tokens` (and therefore the `truncated` field consumed by `grpo.overlong_filtering`, plus the `truncation_rate` metric) only tested whether the full sequence reached `vllm_cfg.max_model_len`. With the usual configuration where `max_new_tokens` is below the context length, a rollout cut by the per-call generation cap was never flagged, so overlong filtering silently trained on incomplete rollouts and `truncation_rate` reported 0. The Responses API already reports this case: NeMo Gym returns the response with `status: incomplete` (`incomplete_details.reason: max_output_tokens`). Treat that as truncated as well, keeping the context-length check. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: adithyare <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Detection must check the incomplete reason specifically and needs regression coverage.
1 open finding
What changed in this PR
Updates NeMo Gym rollout postprocessing to recognize output-cap truncation.
Changes:
- Treats incomplete Responses API results as truncated.
- Preserves context-length truncation detection.
| File | Description |
|---|---|
nemo_rl/experience/rollouts.py |
Extends Gym rollout truncation detection. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| "hit_max_tokens": sum(len(m["token_ids"]) for m in r["message_log"]) | ||
| == max_total_tokens_per_sample, | ||
| == max_total_tokens_per_sample | ||
| # also truncated when a model call hit max_output_tokens (Responses API status) |
This branch has not been deployed
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 does this PR do?
hit_max_tokensin_postprocess_single_nemo_gym_grouponly tested whether the whole sequence reachedvllm_cfg.max_model_len. In the common configuration wherepolicy.generation.max_new_tokensis below the context length, a rollout cut by the per-call generation cap was never markedtruncated, so:grpo.overlong_filtering: truesilently kept training on incomplete rollouts, andtruncation_rate/natural_termination_ratemetrics reported 0 / 1 for them.The Responses API already reports this case: NeMo Gym returns the response with
status: incompleteandincomplete_details.reason: max_output_tokens. This PR also treats that status as truncated, keeping the existing context-length check. One file, three lines.How was it tested?
status: incompleteis flagged; a context-filling rollout is still flagged.truncation_ratelogged 0; with this change they are flagged andoverlong_filteringmasks them.🤖 Generated with Claude Code