Skip to content

fix(sc): SWE PPO fixes for token capture and Megatron critic memory - #4776

Merged
yuki-97 merged 19 commits into
mainfrom
biguo-swe-ppo-fixes
Nov 3, 2026
Merged

yuki-97 merged 19 commits into
mainfrom
biguo-swe-ppo-fixes

Conversation

@bg51717

@bg51717 bg51717 commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

What does this PR do ?

Fixes and small features needed to run SWE PPO on the single controller with token capture: lower Megatron critic memory, keep Gym rollout metrics and termination rates on the capture path, and support the malformed think-tag penalty on the capture path.

The fp32 logits-storage reuse for the chunked logprob grad moved to #4973. The shared echo/capture think-tag predicate is tracked in #5008.

Changes

Rebased on main. Each commit can be reviewed on its own; the later ones address review feedback.

  1. fix(value): clear transient Megatron caches after critic training.
    With megatron_cfg.clear_memory_caches_before_refit, the policy worker already released the RoPE cache and the MoE dispatcher routing tensors; the Megatron value worker never did. The logic moves into megatron.common.clear_transient_megatron_caches, which the policy's offload_before_refit and the critic's finish_training both call under the same flag. The exemplar configs now list the flag for the policy and the critic.

  2. fix(sc): keep Gym rollout metrics on the token-capture path.
    The capture path commits finalized rows without a PromptGroupRecord, so per-group Gym metrics never reached W&B. generate_for_finalization now returns them next to the reassembly request and _finalize_with_actor attaches them to the committed meta, the same ROLLOUT_METRICS sidecar the echo path uses. A retry that re-dispatches only the unsealed siblings logs no metrics for that group rather than an under-count.

  3. feat(capture): support the malformed think-tag reward penalty.
    reward_penalties.penalize_malformed_think_tag was rejected with token capture. The finalizer now checks each verified (carry, generation) span: a token-ID check when think-tag IDs are configured or each tag is a single token, plus a decoded-string check. The finalizer actor gets the policy tokenizer and the resolved tags only when the penalty is on. Gym's message-level has_malformed_thinking flag is not used on capture.

    • Setup rejects a half-resolved think-tag ID pair and fewer than two env.nemo_gym.thinking_tags; a finalizer built without a tokenizer fails the run instead of rejecting every row.
    • The think-tag rules are persisted in the rollout recovery settings, so a resume with different tags or IDs is rejected; the error names the config paths to change.
  4. fix(capture): report termination rates from finalized rows.
    Receipt completions carry a placeholder truncated=False, so capture always logged truncation_rate=0. The rates now come from the finalized rows, with the same rule as the TRUNCATED training column (max_seq_len for ordinary rows, Gym's truncation for Forest rows), counted once per rollout.

Usage

token_capture:
  enabled: true
reward_penalties:
  penalize_malformed_think_tag: true   # tags come from env.nemo_gym.thinking_tags, default <think>/</think>
value:
  megatron_cfg:
    clear_memory_caches_before_refit: true   # now also applies to the Megatron critic

Forest training still rejects reward penalties.

Testing

  • Unit tests (GB200 and CPU, at ffdd950): test_config_v2.py, tests/unit/single_controller, tests/unit/data_plane, tests/unit/experience, test_grpo.py, test_config_validation.py, the NeMo-Gym environment tests and the touched Megatron worker tests, in the default, NeMo-Gym, mcore and vLLM lanes.
  • End to end on GB200, at ffdd950: grpo_async_gym_single_controller.sh with ++token_capture.enabled=true ++reward_penalties.penalize_malformed_think_tag=true, and grpo_async_gym_single_controller_context_compaction.sh (Forest). Both pass their metric checks and log the Gym rollout metrics and termination rates every step.

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you run the unit tests and functional tests locally? Visit our Testing Guide for how to run tests
  • Did you add or update any necessary documentation? Visit our Document Development Guide for how to write, build and test the docs.

@copy-pr-bot

copy-pr-bot Bot commented Oct 18, 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.

@bg51717 bg51717 added the CI:L1 Run doctests, unit tests, and functional tests label Oct 18, 2026

@bg51717 bg51717 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Five independent fixes for SWE PPO on the single controller with token capture:

  • fp32 logprob grad reuses the logits storage (model_utils.py). It works for a single consumer, but it crashes backward when another autograd node saved the same logits or a view of them (inline).
  • Critic clears transient Megatron caches. The helper move is byte-identical for the policy. The critic reads value.megatron_cfg, not policy.megatron_cfg (inline).
  • Gym rollout metrics on the capture path. The lifecycle is sound: the entry is popped before any await, and the abort path cleans up. One test assertion is vacuous (inline).
  • token_capture.nan_generation_logprobs. The pinned Gym already rejects non-finite logprobs at staging, so this branch is unreachable (inline).
  • Malformed think-tag penalty on capture. The per-(carry, generation) check matches the echo path's (user, assistant) pairs. The new thinking_tags field has no effect, and the reference config is out of sync, which breaks test_config_v2 (inline).

PR description

  • Usage: the critic flag is value.megatron_cfg.clear_memory_caches_before_refit, not policy.megatron_cfg (see the inline comment on megatron_value_worker.py).
  • Memory claims (commits 1-2): the ~12 GiB figure is an estimate. Could you add torch.cuda.max_memory_allocated() for one step before and after: on the fp32_lm_head + chunked + CP config for commit 1, and on the critic with the flag on and off for commit 2?

Lint: pre-commit run --all-files passes. taplo-format was skipped because it has no aarch64 build, and the PR touches no TOML.

Reviewed with six agents (RL, bug finder, tests, design, devil's advocate, leader). Findings are read from source, not measured; no GPU was available, so the suggested tests were collected but not run.

Generated by Claude Code

Comment thread examples/configs/grpo_math_1B.yaml Resolved
Comment thread nemo_rl/distributed/model_utils.py Resolved
Comment thread nemo_rl/algorithms/grpo.py Resolved
Comment thread nemo_rl/experience/reward_penalties.py Resolved
Comment thread nemo_rl/experience/reward_penalties.py Resolved
@bg51717
bg51717 force-pushed the biguo-swe-ppo-fixes branch from 7e61e44 to 08f4fd4 Compare October 20, 2026 01:34
@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Oct 20, 2026
@bg51717

bg51717 commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

/ok to test 08f4fd4

@bg51717
bg51717 force-pushed the biguo-swe-ppo-fixes branch from 08f4fd4 to 97e2386 Compare October 20, 2026 06:14
@bg51717

bg51717 commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

/ok to test 97e2386

@bg51717
bg51717 marked this pull request as ready for review October 21, 2026 06:41
@bg51717
bg51717 requested a review from yuki-97 October 21, 2026 07:00

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all 25 changed files and their directly affected loss, finalization, replay, and recovery paths.

The earlier shared-logits backward issue is addressed by the opt-in reuse flag and the new shared-storage regressions. The half-resolved tag guard, abort-path cleanup assertion, finalizer tokenizer wiring, and guide updates are also present in the current source.

The inline comments identify a recovery-compatibility gap, incorrect newly published truncation metrics, and two nonblocking verification/guideline items. The extracted cache helper retains the policy behavior and gives the critic a shared implementation.

Validation was source-only: tests, linters, GPU memory measurements, and independent agent review were not executed in this read-only environment.


Inline comments (escaped v1):

  • nemo_rl/experience/reward_penalties.py line 240: 1 action item, please fix in this PR.
    TL;DR — recovery records the new penalty flag but not its tag rules, so a restart can silently reinterpret saved rollouts.

    AI-1 — [BUG] Persist the active think-tag rules (confidence: 98)

    PR-introduced: the checkpoint projection now accepts the malformed-tag penalty, but retains only enabled flags, unwanted IDs, and effort settings. For example, save with the penalty enabled and think_open=1, think_close=2, then resume with think_open=3, think_close=4: both projections are identical, so the restore compatibility check succeeds. Yet finalization reads those IDs and the resolved strings, changing which unfinished rows receive zero reward while already-finalized rows retain their old rewards.

    Action: extend the projection, serialization/parser, and compatibility comparison to include the resolved open/close ID pair (or explicitly no ID check) and resolved tag strings only while this penalty is active. Feed the same resolved rules used by the finalizer into controller checkpoint settings and bootstrap normalization; reading only the raw penalty block misses inferred IDs and environment-derived strings. Preserve the versioned reader contract with an explicit version/migration decision rather than silently defaulting missing active rules. This requires coordinated schema/wiring edits, not a safe one-line patch.

    Acceptance — proposed, not run: round-trip an enabled (1,2) configuration, then require compatibility against (3,4) and expect a field-specific ValueError; repeat with changed resolved strings and with ID-check versus string-only mode. Unchanged rules must resume successfully. Keep disabled think-tag fields irrelevant, and retain the existing unwanted-ID normalization and inactive-option assertions.

  • nemo_rl/experience/rollout_manager.py line 2441: 1 action item, please fix in this PR.
    TL;DR — forwarding the whole receipt metrics dictionary publishes truncation=0 and natural termination=1 even for truncated capture rows.

    AI-1 — [BUG] Source truncation metrics from finalized rows (confidence: 97)

    This PR introduces publication of pre-existing placeholder values: receipt completions always set truncated=False, and metric construction turns that into three termination-rate keys. The new capture sidecar attachment sends these values to step logging. For a healthy captured rollout whose rebuilt length equals the configured maximum, the canonical truncation field is true, but the published global and agent truncation rates remain zero.

    Action: omit placeholder-derived termination rates from receipt-side metrics and produce the global and per-agent rates from finalized rows using the same canonical truncation predicate. Preserve Gym timing/routing metrics and the echo path's real completion-based rates. The treatment of rejected placeholder rows needs an explicit denominator decision; do not simply infer truncation from unverified manifest lengths.

    Acceptance — proposed, not run: finalize two valid rows, one at the maximum length and one below it; logged truncation_rate, natural_termination_rate, and the agent truncation rate should each be 0.5. An all-truncated valid group should report 1, 0, and 1. Keep the existing echo mixed-completion assertions, plus the new Gym timing sidecar preservation assertion.

  • nemo_rl/models/value/workers/megatron_value_worker.py line 1041: 1 action item.

    AI-1 — [GUIDELINE] Avoid adding a consumer-side default (confidence: 100)

    PR-introduced: this new flag read supplies False at the consumer, contrary to the repository's optional-config convention. The field is optional, so a truthiness check without a fallback preserves the behavior:

            if self.cfg["megatron_cfg"].get("clear_memory_caches_before_refit"):
    

    Action: use this replacement in the critic branch; no broader policy-worker refactor is needed. Missing and explicit-false flags must skip clearing, while true must clear after offload without changing the earlier eval/offload order.

    Acceptance — source reasoning, not executed: retain the true/false event-order assertion; an absent flag must follow the same no-clear branch as false. Verify the suggestion before adopting it.

  • nemo_rl/distributed/model_utils.py line 315: 1 action item.
    TL;DR — the memory savings are plausible from source, but the supplied review material still has no measured before/after peak.

    AI-1 — [PERF-EVIDENCE] Add measured memory results (confidence: 95)

    For these PR-introduced memory optimizations, the description provides an allocation estimate and reports successful runs, but not quantitative peak-memory comparisons. The fp32 storage-reuse branch and critic cache-clearing branch address different memory lifetimes, so one successful run does not quantify both benefits.

    Action: add a small results table with identical model, sequence lengths, TP/CP, packing, and precision settings: peak allocated memory for fused-packed fp32 chunked backward with reuse disabled/enabled; and critic allocated memory after training/offload plus the following-stage peak with cache clearing disabled/enabled. Include a step-time comparison to expose any cache-rebuild cost. This is a nonblocking evidence request, not a claim that the optimizations fail.

    Acceptance — measurements requested, not performed here: provide actual values and the measurement boundaries, with peak counters reset for each comparison. Preserve the leaf/storage-reuse assertions and shared-logits/narrow-view gradient parity checks; do not broaden reuse to obtain a larger measured saving.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

@bg51717

bg51717 commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

/ok to test 96ec8a3

@bg51717

bg51717 commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

Replies to the review:

  • nemo_rl/experience/reward_penalties.py (think-tag rules): Fixed in c3977d5: the recovery settings now record the think-tag IDs and tag strings while the penalty is enabled, and a mismatch fails the resume check. Older sidecars can't have this penalty enabled (it used to raise), so version stays 1.
  • nemo_rl/experience/rollout_manager.py (truncation metrics): Fixed in 3e4558f: receipt metrics no longer emit the placeholder termination rates; the finalizer counts valid rows at max_seq_len (the TRUNCATED predicate), and the rates are pooled over valid rows like the penalty rates.
  • nemo_rl/models/value/workers/megatron_value_worker.py: Applied in 9f2cbfb, thanks.
  • nemo_rl/distributed/model_utils.py (memory results): These numbers are estimates for now.

@yuki-97 yuki-97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bringing the malformed think-tag penalty to token capture with a per-span check that matches the echo path rule for rule, and getting the capture path's Gym rollout metrics into W&B, close two real gaps for SWE PPO on the single controller; the Megatron critic now also releases the same transient caches as the policy.

Thanks for running grpo_async_gym_single_controller.sh with token capture both with and without the think-tag penalty, and for the extensive self-review.

Scope: whole PR, at 96ec8a3

Checked:

  • Capture think-tag check — per-span ID and string rules match the echo path case by case; only Gym's message-level flag is absent, as the guide says.
  • Think-tag sources — resolver, finalizer and recovery settings all read get_nemo_gym_thinking_tags, so resume compares the rules the finalizer applies.
  • clear_transient_megatron_caches — identical to the removed policy block; every cleared attribute is rebuilt on the next forward at Megatron-LM 3e95097.
  • Capture metrics lifecycle — stored and popped with no await in between, aborts pop, no double attach.
  • reuse_logits_storage — only the fused packed path enables it, and a consumer that saved the logits through autograd fails loudly.

Remaining comments are on:

  • reuse_logits_storage: documenting the overwritten logits, and moving that commit to its own PR
  • capture metrics that cover only the re-dispatched siblings on a retry
  • think-tag precondition errors that are swallowed or surface late
  • clear_memory_caches_before_refit missing from the exemplar YAMLs

nit, not blocking merging — the PR body still says "Four independent commits" and does not mention the think-tag rules now persisted for resume or the termination rates now computed from finalized rows. No shipped config sets fp32_lm_head: true, so the reported end-to-end run does not exercise the in-place grad write.

Comment thread nemo_rl/experience/rollout_manager.py Resolved
Comment thread nemo_rl/experience/rollout_manager.py Resolved
Comment thread nemo_rl/experience/reward_penalties.py Resolved
Comment thread docs/guides/single-controller.md Resolved
Comment thread nemo_rl/experience/rollouts.py Resolved
Comment thread nemo_rl/experience/reward_penalties.py Resolved

@terrykong terrykong left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR conflicts with main — please rebase first.

What works well: the per-span think-tag check matches the echo rules; capture metrics go to W&B; there is one shared cache-clear helper (clear_transient_megatron_caches in megatron/common.py, next to the helpers both workers already import); has_malformed_think_tag is a pure function that takes decode, so it is easy to unit test; and the finalizer loads the tokenizer only when the penalty is on.

Summary of comments:

  1. (C1) Reply on yuki's split question: agree to split; 3 asks for the new PR.
  2. (C2) Nit: the resume error names the wrong config path.
  3. (C3) Reply on the follow-up thread: one more case for the shared predicate.

Optional (not an inline): a small test that the finalizer actor loads the tokenizer (RolloutReassemblerActor.__init__ → get_tokenizer). The actor is # pragma: no cover, but a break there fails loudly at startup, so this is optional.

Verified: lint passes on all changed files; the merge commit 96ec8a3 matches a clean re-merge; CPU unit tests for the reward-penalty, recovery, reassembler and new logprob tests pass. Megatron worker tests and all GPU tests were not run.

Visual explainer: https://terrykong.github.io/gh-pages-poc/terryk/pr-4776-think-tag-capture.html
Visual explainer: https://terrykong.github.io/gh-pages-poc/terryk/pr-4776-logits-reuse.html

Generated by Claude Code

Comment thread nemo_rl/experience/reward_penalties.py Resolved
Comment thread nemo_rl/distributed/model_utils.py Resolved
Comment thread nemo_rl/experience/reward_penalties.py Resolved
bg51717 and others added 12 commits October 31, 2026 02:09
With megatron_cfg.clear_memory_caches_before_refit the policy worker
releases the RotaryEmbedding lru_cache and the MoE dispatcher routing
tensors (whose probs keep the activation-recompute context alive). The
Megatron value worker never did, so a critic trained with recompute on
variable-length SWE rollouts kept both resident across its CPU offload.

Move that logic into megatron.common.clear_transient_megatron_caches; the
policy worker's _clear_rope_and_moe_dispatcher_caches now calls it, and
MegatronValueWorkerImpl.finish_training calls it under the same flag after
the offload.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
On the echo path TQReplayBuffer.commit stores each PromptGroupRecord's
rollout_metrics in the replay metadata (the ROLLOUT_METRICS sidecar), and the
train pump merges them into the step metrics. On the token-capture path the
finalizer builds the rows and the controller commits them with
commit_finalized, which has no PromptGroupRecord: RolloutManager
.generate_for_finalization discarded the record returned by run_rollout, so
every per-group Gym metric (agent and verifier timings, error types,
evaluation completion, effort-shaping and routing metrics) was silently
missing from W&B for capture runs.

RolloutManager now keeps each dispatched group's rollout_metrics keyed by
group_id (dropped again if the dispatch is abandoned), and
SingleControllerActor._finalize_with_actor pops them before any await and
attaches them to the committed meta's extra_info under ROLLOUT_METRICS, the
same sidecar the echo path writes. The finalizer's own meta is not mutated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
Token capture rejected reward_penalties.penalize_malformed_think_tag. Check
it in finalize_capture_reward over the verified (carry, generation) spans,
the capture equivalent of the echo path's (user, assistant) pairs:

- Tag-ID check: when think_open/think_close are single tokens, the prompt
  delta sets the expected tag counts in the generation.
- String check: the decoded generation must hold no open tag and at most
  one close tag.

The finalizer actor gets the policy tokenizer and the resolved tags only
when the penalty is on. Gym's message-level has_malformed_thinking flag has
no capture source and is not checked. Setup now rejects a half-resolved
think-tag ID pair, so both paths fail the same way.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
The malformed-think-tag penalty runs at finalization, like the unwanted-token
penalty whose IDs are already part of CaptureRewardSettings. Record the
configured think-tag IDs and the resolved tag strings while the penalty is
on, and reject a resume whose rules differ. Version-1 sidecars could not
enable this penalty before (capture rejected it), so the version stays 1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
Receipt completions carry a placeholder truncated=False, so the forwarded
receipt metrics always logged truncation_rate=0 and
natural_termination_rate=1 on the capture path. Drop those keys in receipt
mode; the finalizer now counts valid rows at max_seq_len (the TRUNCATED
predicate), and the rates are pooled over valid rows like the penalty
rates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
Read the NotRequired clear_memory_caches_before_refit flag without a
fallback, and take the reassembler's thinking_tags from the resolved
config only when the think-tag penalty is on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
…equest

generate_for_finalization now returns (request, rollout_metrics) and
_finalize_with_actor takes the metrics as an argument, replacing the
_capture_rollout_metrics side-channel dict and its pops. Metrics are kept
only when the successful attempt dispatched every sibling: a retry of the
unsealed siblings alone would under-report the group in the
ROLLOUT_METRICS sidecar.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
- finalize_capture_reward raises RuntimeError when built without decode
  or tags, so the per-row ValueError handler cannot turn a mis-wired
  finalizer into reward_processing rejects.
- resolve_reward_penalty_config rejects fewer than two thinking tags at
  setup instead of skipping the ID pair.
- Drop the now unreachable RolloutReassembler constructor check.
- The half-set think-tag ID error names both fixes: set both IDs or omit
  both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
require_compatible now names reward_penalties.*, env.nemo_gym.thinking_tags
and env.nemo_gym.effort_levels.*, the paths a user edits, instead of the
internal penalties./effort./thinking_tags names.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
…onfigs

Add the field (default false) under policy.megatron_cfg in grpo_math_1B and
ppo_math_1B and under value.megatron_cfg in ppo_math_1B, mirrored in the
reference configs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
Drop the one-line _clear_rope_and_moe_dispatcher_caches wrapper on the
policy worker; offload_before_refit calls the shared helper, as the critic
already does. The wrapper's tests duplicated the helper's, except the
best-effort case, which now targets the helper. The critic comment no
longer claims it always trains with activation recompute.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
… ID check runs

Label each finalizer count prefix pooled by the capture reward aggregation,
and note in the single-controller guide that configured think-tag IDs also
enable the ID check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
bg51717 and others added 2 commits October 31, 2026 02:52
…and termination rates

RolloutReassembler._truncated_flags is now the only truncation rule: Forest
rows use their rollout's Gym-reported truncation, ordinary rows count when
they fill max_seq_len. The termination counts are taken per rollout over the
same rows as the reward observations, so Forest groups, which have several
rows per rollout, now report termination rates too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
The Forest recovery checkpoint test passes thinking_tags to
CaptureRewardSettings.from_configs, and the Forest retry test's fake
run_rollout returns a record, as the real one does, now that capture
reads its rollout metrics.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
@bg51717
bg51717 force-pushed the biguo-swe-ppo-fixes branch from 96ec8a3 to ffdd950 Compare October 31, 2026 15:23
@bg51717

bg51717 commented Oct 31, 2026

Copy link
Copy Markdown
Member Author

/ok to test ffdd950

@bg51717 bg51717 added CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) and removed CI:L1 Run doctests, unit tests, and functional tests labels Oct 31, 2026
@bg51717

bg51717 commented Oct 31, 2026

Copy link
Copy Markdown
Member Author

/ok to test ffdd950

@yuki-97 yuki-97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge blockers — please rebase on main and resolve conflicts.

Thanks for addressing the previous review comments.

Scope: fix commits c0c4d70 through ffdd950, checked against the previous review threads, plus a scan of the changed files for new issues.

Checked:

  • generate_for_finalization now returns metrics explicitly, and partial sibling retries omit incomplete group statistics.
  • Think-tag cardinality and ID-pair errors fail during setup; a missing finalizer decoder propagates RuntimeError.
  • Forest termination counts and the training TRUNCATED column share one predicate, with rates counted once per logical rollout.

Remaining comments are on:

  • A rebase collision leaves the finalizer and controller both writing ROLLOUT_METRICS, so Gym receipt metrics overwrite verified token metrics. Consolidate assembly and writing in the controller, with each metric having one source.

nit

  • An echo-path thinking-tag check that the new setup check makes unreachable.
  • clear_memory_caches_before_refit still missing from the other root exemplars' policy blocks.

Generated by Codex

Comment thread nemo_rl/algorithms/single_controller.py Resolved
Comment thread nemo_rl/experience/rollouts.py Resolved
Comment thread examples/configs/grpo_math_1B.yaml Resolved
bg51717 and others added 4 commits November 3, 2026 00:09
The finalizer wrote verified token metrics into ROLLOUT_METRICS and the
controller then replaced the list with the Gym rollout metrics, dropping the
generated-token statistics. The finalizer now returns its token metrics on
FinalizedGroup, receipt mode no longer emits total-token metrics, and the
controller merges the two disjoint sets into one sidecar, failing the commit
if both report the same key.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
Setup already rejects thinking tags without an open and close pair, so
apply_reward_penalties only receives validated tags.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
…egatron exemplars

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
@bg51717

bg51717 commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

/ok to test 8659913

@bg51717
bg51717 requested a review from yuki-97 November 3, 2026 11:03
@yuki-97
yuki-97 merged commit 93e2791 into main Nov 3, 2026
93 checks passed
@yuki-97
yuki-97 deleted the biguo-swe-ppo-fixes branch November 3, 2026 13:16
yfw added a commit that referenced this pull request Nov 18, 2026
Main gained #4776, which adds a thinking_tags argument to
RolloutReassembler and RolloutReassemblerActorConfig for the malformed
think-tag reward penalty. This branch added an argument with the same name
for the message-level detector, and the auto-merge kept both. Both resolve
to env.nemo_gym.thinking_tags or the default, so one argument now serves
both checks: setup sets it when the think-tag penalty or a message-level
penalty is on.

Other conflicts: _spinup_gym keeps main's rollout-recovery arguments, and
the single-controller guide keeps main's reflowed text and drops its
"remain unsupported with capture" sentence for the new paragraph.

Also:
- Pin Gym to c3e5931262, NVIDIA-NeMo/Gym#5447 merged with Gym main. It
  descends from main's pin 9e2e5d0ad0, and Gym's dependencies and version
  did not change, so uv.lock stays valid.
- Every check reads the active algorithm block, so PPO gets the same
  support. Add a PPO validation test, and name both blocks in the guide.
- Shorten three in-function comments to two lines.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yi-Fu Wu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants