Skip to content

feat(sc): Add full per-step training data dump - #4347

Merged
ZhiyuLi-Nvidia merged 2 commits into
mainfrom
dmolinari/pr-sc-dump-train-data
Oct 3, 2026
Merged

ZhiyuLi-Nvidia merged 2 commits into
mainfrom
dmolinari/pr-sc-dump-train-data

Conversation

@d-molinari

Copy link
Copy Markdown
Contributor

What does this PR do ?

Enable logging of the full training batch for debug purposes.

Usage

Setting async_rl.log_full_train_data: true enables saving the training data as train_data_step<N>.jsonl.

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 Sep 29, 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.

@d-molinari
d-molinari requested a review from yfw September 29, 2026 21:10
@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Sep 29, 2026
Comment thread nemo_rl/algorithms/single_controller.py Resolved
@ZhiyuLi-Nvidia

Copy link
Copy Markdown
Contributor

Thank you @d-molinari. Just 2 tiny comments.

Looks great elsewhere.

@ZhiyuLi-Nvidia

Copy link
Copy Markdown
Contributor

DCO
DCOAction required after 1s — DCO

Could you try "To avoid having PRs blocked in the future, always include Signed-off-by: Author Name [email protected] in every commit message. You can also do this automatically by using the -s flag (i.e., git commit -s)."

Signed-off-by: Daniele Molinari <[email protected]>
@d-molinari

Copy link
Copy Markdown
Contributor Author

v2-swe-step4-training-row1-truncated.json
@ZhiyuLi-Nvidia this a truncated example of a real dump. It's pre prompt_ids fix so it has the final 0 padding

@ZhiyuLi-Nvidia ZhiyuLi-Nvidia added the CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) label Oct 2, 2026
@ZhiyuLi-Nvidia

Copy link
Copy Markdown
Contributor

LGTM thank you @d-molinari!

@ZhiyuLi-Nvidia
ZhiyuLi-Nvidia enabled auto-merge (squash) October 2, 2026 21:23
@ZhiyuLi-Nvidia

Copy link
Copy Markdown
Contributor

/ok to test 826781e

@ZhiyuLi-Nvidia
ZhiyuLi-Nvidia merged commit fb8396a into main Oct 3, 2026
95 checks passed
@ZhiyuLi-Nvidia
ZhiyuLi-Nvidia deleted the dmolinari/pr-sc-dump-train-data branch October 3, 2026 03:33
saumishr added a commit to saumishr/RL that referenced this pull request Oct 3, 2026
Resolves the conflict with NVIDIA-NeMo#4347 (full per-step training data dump).

The dump's two load-bearing pieces -- the pre_seq_error_sample_mask clone
and the add_chunk call -- sat inside the in-process advantage body this
branch relocates into advantage_stage.py, so git aligned them against
unrelated code and left an empty "ours" side on all three hunks. Keeping
either side verbatim would have dropped one of the two features.

main's hooks that survive the relocation (imports, the TrainDataDump the
controller owns, finish_step on the optimizer step) are untouched. The two
that moved now live in AdvantageComputer.run, which is the only code that
still holds the untruncated tensors: the controller stopped fetching them
when the computation moved off it.

Because the stage can run in a pool, TrainDataDump is now a sharded writer.
Each shard owns train_data_step<N>.jsonl.part-<shard_id> and finish_step
merges them in shard order, assigning idx across the merged file -- no
single writer sees every row, so no writer can number them. The controller
publishes a step it never wrote, which the previous row-counter guard
rejected. Sharding also moves the JSON serialization, which is the
expensive half of the feature, off the controller.

The dump's timing survives the move as a float on AdvantageOutcome and is
replayed into the controller's timer, so the train_data_dump metric still
reports when the work happened in an actor.

Two of main's assertions encoded behaviour this branch changed on purpose:
the estimator now receives the prompt-group key rather than the dense
prompt matrix, and a pump fixture needed the group_id tag this branch
makes mandatory. prompt_ids_for_adv returns to AdvantageConfig as a
dump-only column.

Verified locally in the CI container before pushing: 1553 passed in the
single-controller blast radius, and 4495 passed in a full
L0_Unit_Tests_Other with only this node's five known environmental
failures (no GPU, no RDMA, no HF access).

Signed-off-by: Saurabh Mishra <[email protected]>
ZhiyuLi-Nvidia pushed a commit that referenced this pull request Oct 27, 2026
… process

async_rl.log_train_data_to_wandb logs the same per-sample rows as
log_full_train_data (#4347) to W&B as the table train/train_data. Each
advantage-stage process logs the rows it just computed, from memory: no JSON
read-back, no tokenizer, no controller fetch.

- train_data_rows() is extracted from TrainDataDump.add_chunk, so the dump and
  W&B hold identical rows.
- WandbTrainData sits beside TrainDataDump with the same add_chunk arguments;
  one background thread attaches to the controller's run in W&B shared mode
  (x_primary=False, labelled by shard) and logs each chunk on the
  train/train_data_step axis. Array cells are JSON strings: wandb.Table
  type-checks every element of a list cell (minutes for a 1 GB step).
- Setup pins logger.wandb.id and makes the controller's run the shared-mode
  primary, since the advantage pool is built before the controller's
  wandb.init. Requires logger.wandb_enabled.

Replaces the per-step summary table from the earlier commits on this branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zhiyu Li <[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.

3 participants