Skip to content

feat(draft): add tensor-parallel DFlash body - #3723

Merged
yuki-97 merged 90 commits into
NVIDIA-NeMo:mainfrom
seonjinn:seonjinn/draft-cotrain-dflash-body-v2
Nov 3, 2026
Merged

yuki-97 merged 90 commits into
NVIDIA-NeMo:mainfrom
seonjinn:seonjinn/draft-cotrain-dflash-body-v2

Conversation

@seonjinn

@seonjinn seonjinn commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds a checkpoint-compatible tensor-parallel DFlash body.
  • Uses block-only attention with deterministic block planning.
  • Fails synchronously before projection when ranks disagree on input shape or topology.

Supported contract

  • Supported: TP1/TP2/TP4 with CP1.
  • Checkpoint ownership and TP forward/gradient paths are covered.
  • CP>1, draft-body sequence parallelism, and full PP integration are out of scope.

Validation

  • Exact head: d43a5b6cd82bfd348289a112fa02708765cd130e
  • Exact-head Ruff lint, import-order, and format checks passed.
  • All completed GitHub checks pass.

Prior GPU evidence

  • Prior stacked-head suite: 56 focused tests passed. External 4×GB200 coverage exercised TP2, TP4, TP2×PP2, malformed-input, and CP-rejection paths; TP2×PP2 is external evidence, not a unit-test topology.

Dependencies / Remaining

#3715 adds training integration; #3744 adds generation/refit integration. CP-local attention requires a separate design.

Reapply the intended DFlash-only net delta from ef405c8 onto NVIDIA main 36b5999. The original signed series spans fe8a7fa..ef405c8.

Signed-off-by: seonjinn <[email protected]>
Document the per-rollout sample_id contract, reject live CP>1 on the
default config path, anchor the device-mismatch regex, run the TP tests
through distributed_test_runner, and restore the parallelism scope in
the design doc.

Signed-off-by: seonjinn <[email protected]>
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 8176428

copy-pr-bot Bot pushed a commit that referenced this pull request Oct 18, 2026
@seonjinn

Copy link
Copy Markdown
Contributor Author

Merged latest main (d3d0cc7) to fix the "PR branch is up to date" check. The previous L0_Unit_Tests_Models_4 failure was tests/unit/models/policy/test_utils.py::TestStreamWeightsViaIPC::test_stream_weights_via_ipc_zmq_impl_non_contiguous: the spawned ZMQ server did not report ready within the 30 s queue timeout, then the job hung until cancel. This PR does not touch nemo_rl/models/policy/, so this is an unrelated flake. Rerunning CI.

@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 96110ac

@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test bfbd6d7

The DFlash body rejects a TP size that does not divide its heads, KV
heads, hidden, or intermediate size. The error now names the TP size and
each failing dim, so a user can pick a valid TP layout. A TP4 test covers
a two-head config.

Signed-off-by: seonjinn <[email protected]>
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 6542b23

copy-pr-bot Bot pushed a commit that referenced this pull request Oct 22, 2026
yuekaizhang
yuekaizhang previously approved these changes Oct 28, 2026

@yuekaizhang yuekaizhang 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 the draft co-training refit/transport stack across #3723/#3726/#3744/#3750/#3757. All findings from this review are resolved (see individual threads), CI is green. Approving.

@sharonyu-115 sharonyu-115 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.

LGTM — no actionable findings at 6542b23.

Adds the standalone DFlash draft body, deterministic block planning, block attention, and tensor-parallel checkpoint support. The team review found no remaining correctness or repository-guideline issues.

Validation results and limits
  • 51 CPU tests passed, 8 skipped, using the pinned MCore source in an isolated harness that bypassed repository fixtures/plugins.
  • Additional CPU attention-mask checks passed across 9 shapes and 54 blocks. Pinned Ruff lint, import-order and format checks passed.
  • The GitHub checks include successful Megatron unit-test jobs. CI:Lfast is appropriate for this PR's scope.
  • No local GPU/CUDA/NCCL execution or target-GPU performance measurement was available. Four-rank tests can skip in two-GPU CI; green job status alone does not establish TP4 execution. Full pre-commit was unavailable because optional-submodule dependencies were missing from the isolated checkout.

Generated by Codex using review-pr-team.

sharonyu-115
sharonyu-115 previously approved these changes Oct 29, 2026

@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.

Thanks for addressing the previous review feedback.

Scope: fix commits 8176428 through a3adb52, checked against the previous review threads, plus a static scan of the changed files.

Checked:

  • Anchor scheduling preserves sample identity across batch permutations and slicing; the per-rollout ID contract is documented.
  • The default constructor rejects live context parallelism greater than one before building projections.
  • Tensor-parallel projection gradients and nested checkpoint metadata follow the pinned Megatron contracts.
  • Block visibility restricts attention to the same sample's prefix and the current draft block.

Remaining comments are on:

  • Replacing source-text efficiency checks with a runtime query-projection check.
  • Moving benchmark tests to the tools test directory while preserving their coverage.
  • Removing unused DFlashBatchPlan fields, their unused computation, and self.parallel_config.

nit

  • Docstring pointers to the #3757 training callers of DFlashBody and build_dflash_batch_plan.

Unit-test results are from 6542b23; the current merge head has metadata checks only.

Comment thread nemo_rl/models/megatron/draft/dflash.py Resolved
Comment thread nemo_rl/models/megatron/draft/dflash.py Resolved
@seonjinn
seonjinn dismissed stale reviews from sharonyu-115 and yuekaizhang via cd84135 November 2, 2026 22:15
@seonjinn

seonjinn commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

@yuki-97 I addressed all six inline comments in cd84135 and replied in each thread. The source-text checks were replaced with a runtime q_proj input-shape check; benchmark tests moved to tests/unit/tools; unused plan/body fields and their computation were removed; and both #3757 caller pointers were added. The latest main was merged. Local Ruff, format, syntax, and diff checks passed; Lfast has not yet run on this head.

@yuki-97

yuki-97 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

/ok to test cd84135

@yuki-97
yuki-97 enabled auto-merge (squash) November 3, 2026 06:24
@yuki-97
yuki-97 merged commit 96f5dab into NVIDIA-NeMo:main Nov 3, 2026
90 checks passed
seonjinn added a commit to seonjinn/RL that referenced this pull request Nov 3, 2026
seonjinn added a commit to seonjinn/RL that referenced this pull request Nov 3, 2026
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.

5 participants