Skip to content

feat(weight-sync): add ModelExpress trainer publishing#3259

Open
KavinKrishnan wants to merge 3 commits into
NVIDIA-NeMo:mainfrom
KavinKrishnan:kavink/split-3068-trainer
Open

feat(weight-sync): add ModelExpress trainer publishing#3259
KavinKrishnan wants to merge 3 commits into
NVIDIA-NeMo:mainfrom
KavinKrishnan:kavink/split-3068-trainer

Conversation

@KavinKrishnan

@KavinKrishnan KavinKrishnan commented Jul 17, 2026

Copy link
Copy Markdown

Overview

Adds trainer-side publication for a ModelExpress (MX) weight-refit backend. NeMo RL's WeightSynchronizer remains the owner of the refit lifecycle; this PR adds the policy operation that a future ModelExpressWeightSynchronizer will call.

The existing DTensor worker and the Megatron worker publish rank-local tensor ownership and topology metadata. Generation-side discovery, transfer, resharding, and installation remain separate reviews.

Changes

  • Adds publish_weights_for_model_express() to the policy interface and trainer workers.
  • Publishes native Tensor Parallelism (TP), Pipeline Parallelism (PP), and Expert Parallelism (EP) shards without gathering the full model on rank zero.
  • Describes global tensor geometry, rank coordinates, expert ownership, and Megatron-to-Hugging Face name mappings.
  • Requires the public ModelExpress publisher lifecycle; no private MX state is accessed.
  • Fails before publication for unsupported DTensor placements or unknown Megatron placement at TP greater than one.
  • Adds focused lifecycle, geometry, role-classification, and failure tests.
  • Adds the trainer-publication design and current implementation status to the documentation.

Architecture boundary

WeightSynchronizer                              [follow-up]
  -> policy.publish_weights_for_model_express() [this PR]
  -> generation discovery and transfer          [follow-up]
  -> inference reshard and install               [follow-up]
  -> global completion                           [follow-up]

This PR does not create a second orchestration path. Existing IPC, HTTP, and NCCL synchronizers are unchanged.

Scope

This PR does not add:

  • a user-facing ModelExpress refit configuration;
  • generation-worker discovery, transfer, or installation;
  • DTensorPolicyWorkerV2 / AutoModel publication;
  • Dynamo integration;
  • Kubernetes resources, recipes, or benchmark harnesses.

The future synchronizer will own user configuration and construct the internal publisher settings explicitly.

Current status

Partially aligned: rank-local publication is implemented and unit-tested for the existing DTensor worker and the Megatron worker. End-to-end refit requires the generation-worker adapter and the corresponding ModelExpress publisher, planning, and installer APIs.

ModelExpress dependencies

Relationship to #3068

This is the trainer-publication portion of #3068, separated by ownership and review scope. The umbrella remains a reference for the complete integration.

Test plan

  • 14 focused publication lifecycle, DTensor geometry, and Megatron classification tests
  • Ruff lint and formatting
  • Focused pyrefly check for new modules
  • Python compilation and Git whitespace checks
  • DCO sign-off
  • Full repository and GPU end-to-end tests through maintainer CI

@KavinKrishnan
KavinKrishnan requested review from a team as code owners July 17, 2026 00:12
@copy-pr-bot

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

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Jul 19, 2026
@KavinKrishnan
KavinKrishnan force-pushed the kavink/split-3068-trainer branch from 51546b1 to 8944e2c Compare July 19, 2026 06:43
Extract the trainer-side substrate from NVIDIA-NeMo#3068 so DTensor and Megatron workers can publish native shards without coupling the review to generation, deployment, or benchmark changes.

Signed-off-by: Kavin Krishnan <kavink@nvidia.com>
Use the shared WeightSynchronizer boundary, require the public publisher lifecycle, fail closed on unknown Megatron placement, and document the trainer publication contract.

Signed-off-by: Kavin Krishnan <kavink@nvidia.com>
@KavinKrishnan
KavinKrishnan force-pushed the kavink/split-3068-trainer branch from 8944e2c to 5fc0c0b Compare July 19, 2026 07:23
@KavinKrishnan
KavinKrishnan requested review from a team as code owners July 19, 2026 07:23
@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Jul 19, 2026
@KavinKrishnan KavinKrishnan changed the title feat(megatron): add ModelExpress rank-local publishing feat(weight-sync): add ModelExpress trainer publishing Jul 19, 2026
@KavinKrishnan

Copy link
Copy Markdown
Author

/ok to test 5fc0c0b

Document that the current trainer path covers the existing DTensor and Megatron workers while AutoModel DTensor publication remains follow-up work.

Signed-off-by: Kavin Krishnan <kavink@nvidia.com>
@KavinKrishnan

Copy link
Copy Markdown
Author

/ok to test 858bf2f

@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-request Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants