Skip to content

[Example] Benchmark DCP on Nemotron Math v3 - #5811

Closed
ilml wants to merge 1 commit into
NVIDIA:pull-request/5681from
ilml:codex/dcp-nemotron-math-v3-example
Closed

[Example] Benchmark DCP on Nemotron Math v3#5811
ilml wants to merge 1 commit into
NVIDIA:pull-request/5681from
ilml:codex/dcp-nemotron-math-v3-example

Conversation

@ilml

@ilml ilml commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a runnable fixed-CP versus Dynamic Context Parallelism benchmark using the normal pretrain_gpt.py training stack.
  • Support both the built-in variable-length mock workload and nvidia/Nemotron-SFT-Math-v3 through the new variable-length dataset loader.
  • Run both cases with the same model, global batch, seed, dataset, checkpoint, and --cuda-graph-impl none.
  • Require complete iteration/timing records, align every iteration and consumed-sample count, compare loss trajectories, and report average, median, trimmed-mean, and samples-per-second throughput.
  • Write a credential-safe reproducibility manifest with the commit, topology, software/GPU versions, data/checkpoint identity, and benchmark controls.

This draft provides the reproducible harness. It does not claim current Nemotron Math v3 loss-parity or throughput results yet; those require a complete GPU run from this rebuilt stack and an immutable dataset snapshot.

Compared cases

Case Relevant flags
Fixed-CP baseline --sequence-packing-scheduler dp_balanced --context-parallel-size N
Dynamic CP --dynamic-context-parallel --sequence-packing-scheduler default_dynamic_cp --min-dynamic-context-parallel-size N --context-parallel-size N

Both cases use --use-varlen-dataset, --calculate-per-token-loss, --max-seqlen-per-dp-cp-rank, the single dataloader, and CUDA graphs disabled.

User-facing controls

Environment variable Purpose
DATASET_PATH / TOKENIZER_MODEL Select Nemotron Math v3, another supported dataset, or a local Parquet/JSON/JSONL snapshot and its chat-template tokenizer. If unset, the benchmark uses mock data.
LOAD_PATH Loads the same Megatron distributed checkpoint into both cases; otherwise both start from the same seeded initialization.
GPUS_PER_NODE, TP_SIZE, CP_SIZE, PP_SIZE Configure the topology. The current harness deliberately supports one node only.
MAX_SEQLEN_PER_DP_CP_RANK Set the packed-token capacity per scheduler rank.
MIN_DYNAMIC_CONTEXT_PARALLEL_SIZE Set the minimum DCP group size, subject to the DP x CP topology constraints.
TRAIN_ITERS / WARMUP_ITERS Control run length and the timing warmup excluded from throughput statistics.
CASE_ORDER Run baseline_first or dcp_first to expose order-dependent effects.
LOSS_ATOL / LOSS_RTOL / CHECK_LOSS_PARITY Configure loss comparison tolerances and whether out-of-tolerance finite losses fail. Missing, duplicate, skipped, NaN, or sample-misaligned iterations always fail.
ANALYZE_ONLY=1 Recompute the report from existing logs without launching training or overwriting the manifest.

Stack and attribution

Current limitations

  • One node only; multi-node log and TensorBoard collection is intentionally rejected.
  • Dense models and the single dataloader only for DCP.
  • Megatron FSDP and CUDA graphs are unsupported.
  • Transformer Engine 2.9 or newer is required.
  • The default prompt format uses full-sequence causal loss rather than assistant-only masking.

Validation

  • bash -n examples/dynamic_context_parallel/benchmark_dcp.sh
  • git diff --check
  • Synthetic complete-log analysis covering timings, samples/second, alignment, and loss parity
  • Failure-path checks for missing iterations, invalid DCP topology/capacity, and invalid Transformer Engine determinism settings
  • Reproducibility-manifest smoke test
  • Signed commit verified locally: 55095561c62188742de2a1051f281ac689843cc8

Real GPU training was not run in the available host environment because PyTorch is not installed there. The PR remains a draft pending a recorded Nemotron Math v3 run.

@copy-pr-bot

copy-pr-bot Bot commented Jul 14, 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.

@ilml

ilml commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 2ca3f72

@ilml
ilml marked this pull request as ready for review July 14, 2026 18:57
@ilml
ilml requested review from a team as code owners July 14, 2026 18:57
@ilml
ilml marked this pull request as draft July 14, 2026 19:16
@ilml
ilml marked this pull request as ready for review July 14, 2026 19:20
@ilml
ilml marked this pull request as draft July 14, 2026 20:05
@ilml ilml changed the title [examples] Benchmark DCP on Nemotron-SFT-Math-v3 [Example] Benchmark DCP on Nemotron Math v3 Jul 14, 2026
@ilml
ilml force-pushed the codex/dcp-nemotron-math-v3-example branch from 2ca3f72 to 9571b3a Compare July 14, 2026 20:35
@ilml
ilml changed the base branch from pull-request/5771 to pull-request/5681 July 14, 2026 20:35
@ilml

ilml commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 9571b3a

@ilml

ilml commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 514e7e2

@copy-pr-bot
copy-pr-bot Bot force-pushed the pull-request/5681 branch from e967c97 to 241584a Compare July 14, 2026 20:38
@ilml
ilml force-pushed the codex/dcp-nemotron-math-v3-example branch from 514e7e2 to 1ca1090 Compare July 14, 2026 20:38
@ilml

ilml commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 1ca1090

Add a reproducible fixed-CP versus dynamic-CP benchmark for variable-length THD training. Support mock data and Nemotron-SFT-Math-v3, compare aligned loss trajectories, report sample throughput, and record a credential-safe run manifest.

Co-authored-by: xiaoyao0115 <1804647152@qq.com>
Signed-off-by: ilml <tolong@nvidia.com>
@copy-pr-bot
copy-pr-bot Bot force-pushed the pull-request/5681 branch from 241584a to 96f3e6a Compare July 14, 2026 21:37
@ilml

ilml commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 5509556

@ilml
ilml force-pushed the codex/dcp-nemotron-math-v3-example branch from 1ca1090 to 5509556 Compare July 14, 2026 21:37
@ilml
ilml marked this pull request as ready for review July 14, 2026 21:55
@copy-pr-bot
copy-pr-bot Bot deleted the branch NVIDIA:pull-request/5681 July 21, 2026 17:45
@copy-pr-bot copy-pr-bot Bot closed this Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants