Skip to content

feat: NCCL-Reshard refit merge PR (final) - #2971

Merged
terrykong merged 5 commits into
mainfrom
youngeunk/new-refit-downsize
Jul 29, 2026
Merged

terrykong merged 5 commits into
mainfrom
youngeunk/new-refit-downsize

Conversation

@youngeunkwon0405

@youngeunkwon0405 youngeunkwon0405 commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do ?

The same feature as #2808, but reducing the target scope to the dominant parameters only for the sake of the code, better sustainability, and expandability.

Slides (NV-internal)

https://docs.google.com/presentation/d/1O_B_yhHNl1ftj-lvyOsFmc3JMrYWRwBwbxOZ2qcNKw0/edit?slide=id.p#slide=id.p

Figjam diagram: https://www.figma.com/board/gCWl55AMYqs8QDz3zUnWzo/Nemo-RL?node-id=239-660&t=3FrnXGperomkER8o-1

DGX-H100 - xferdtensor_python_impl (fallback path)

Test Backend Mapping xferd frac Refit time KL range
30b Megatron -> vLLM EP4xTP2xDP2 -> TP4xDP4 95.0% 1.13s-1.53s 0.0018-0.0030
30b Megatron -> vLLM EP4xTP2xPP2 -> TP4xDP4 95.0% 0.74s-1.17s 0.0016-0.0032
30b Megatron -> vLLM EP8xPP2 -> TP2xDP8 95.0% 1.21s-1.52s 0.0017-0.0032
30b Megatron -> vLLM EP8xPP2 -> TP8xDP2 95.0% 0.74s-1.00s 0.0015-0.0028
30b Megatron -> vLLM TP2xCP2xEP8 -> TP4xDP4 95.0% 1.02s-1.45s 0.0017-0.0028
30b (FP8) Megatron -> vLLM EP4xTP2xPP2 -> TP2xDP8 93.0% 3.19s-4.04s 0.0057-0.0106
30b (FP8) Megatron -> vLLM EP8xPP2 -> TP2xDP8 93.0% 3.20s-4.30s 0.0056-0.0102
30b (FP8) Megatron -> vLLM EP8xDP2 -> TP2xDP8 93.0% 2.90s-4.00s 0.0057-0.0098
30b (gen EP) Megatron -> vLLM EP4xTP2xDP2 -> TP4xEP4xDP4 95.0% 1.00s-1.60s 0.0018-0.0030
30b (gen EP) Megatron -> vLLM EP4xTP2xPP2 -> TP4xEP4xDP4 95.0% 0.81s-1.35s 0.0017-0.0031
235b Megatron -> vLLM TP4xPP8xEP16 -> TP8xDP16 96.6% 1.81s-1.98s 0.0038-0.0079
235b (gen EP) Megatron -> vLLM TP4xPP8xEP16 -> TP8xEP8xDP16 96.6% 2.31s-2.73s 0.0042-0.0081
dsv3 Megatron -> vLLM PP16xEP16 -> TP32xDP8 98.0% 2.39s-2.83s 0.0015-0.0023
dsv3 (gen EP) Megatron -> vLLM PP16xEP16 -> TP32xEP32xDP8 98.0% 3.27s-3.46s 0.0015-0.0025
nano-v3 Megatron -> vLLM EP8xTP2 -> TP4xDP4 94.5% 0.88s-1.02s 0.0008-0.0013
nano-v3 (gen EP) Megatron -> vLLM EP8xTP2 -> TP4xEP4xDP4 94.5% 0.84s-0.87s 0.0009-0.0013
super-v3 Megatron -> vLLM EP8xTP8xPP2xDP2 -> TP8xDP2 94.9% 1.59s-2.01s 0.0021-0.0038
super-v3 (gen EP) Megatron -> vLLM EP8xTP8xPP4xDP2 -> TP8xEP8xDP2 94.9% 1.46s-1.74s 0.0022-0.0039
qwen3.5-35b Megatron -> vLLM EP16xTP2xCP2 -> TP4xDP4 91.8% 0.81s-0.91s 0.0009-0.0011
qwen3.5-122b Megatron -> vLLM EP16xTP8xPP2 -> TP8xDP4 94.6% 1.34s-2.07s 0.0006-0.0009
qwen3.5-397b Megatron -> vLLM TP8xPP8xEP32 -> TP16xDP16 97.4% 1.97s-2.17s 0.0008-0.0010

DGX-GB200 (python_impl numbers)

Test Backend Mapping xferd frac Refit time KL range
4b Megatron -> vLLM DP8 -> DP8 66.9% 0.22s-0.26s 0.0006-0.0008
4b Megatron -> vLLM DP8 -> TP8 66.9% 0.21s-0.34s 0.0006-0.0008
4b Megatron -> vLLM TP2xDP4 -> TP4xDP2 66.9% 0.20s-0.29s 0.0006-0.0008
4b Megatron -> vLLM PP2xDP4 -> TP4xDP2 66.9% 0.24s-0.45s 0.0006-0.0008
4b Megatron -> vLLM PP4xDP2 -> TP4xDP2 66.9% 0.26s-0.42s 0.0006-0.0008
4b Megatron -> vLLM TP2xPP2xDP2 -> TP4xDP2 66.9% 0.25s-0.34s 0.0006-0.0008
30b Megatron -> vLLM EP8xPP2 -> TP2xDP8 95.0% 0.74s-0.98s 0.0016-0.0028
30b Megatron -> vLLM TP2xEP4 -> TP4xDP4 95.0% 0.46s-0.58s 0.0015-0.0031
30b Megatron -> vLLM TP2xPP2xEP4 -> TP4xDP4 95.0% 0.45s-0.65s 0.0017-0.0031
30b Megatron -> vLLM EP8xPP2 -> TP4xDP4 95.0% 0.56s-0.84s 0.0015-0.0031
qwen235b Megatron -> vLLM TP4xPP8xEP16 -> TP8xDP16 96.6% 1.79s-3.35s 0.0043-0.0079
dsv3 Megatron -> vLLM PP16xEP16 -> TP32xDP8 97.6% 1.93s-2.59s 0.0015-0.0024
ultra-v3 Megatron -> vLLM TP8xEP32xPP2 -> TP8xDP8 93.8% 2.32s 0.0004-0.0004

Issues

List issues that this PR closes (syntax):

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this

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.

Additional Information

  • ...

@youngeunkwon0405 youngeunkwon0405 self-assigned this Jun 27, 2026
@youngeunkwon0405
youngeunkwon0405 requested review from a team as code owners June 27, 2026 17:02
@youngeunkwon0405 youngeunkwon0405 added the Performance Related to improving performance label Jun 27, 2026
@youngeunkwon0405
youngeunkwon0405 requested a review from a team as a code owner June 27, 2026 17:02
@youngeunkwon0405 youngeunkwon0405 added the CI:L1 Run doctests, unit tests, and functional tests label Jun 27, 2026
@copy-pr-bot

copy-pr-bot Bot commented Jun 27, 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.

@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test 9ceff77

@youngeunkwon0405
youngeunkwon0405 force-pushed the youngeunk/new-refit-downsize branch from 9ceff77 to 232ae10 Compare June 27, 2026 17:13
@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test 232ae10

@youngeunkwon0405
youngeunkwon0405 force-pushed the youngeunk/new-refit-downsize branch from 232ae10 to d15dd19 Compare June 30, 2026 05:13
@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test 037ae16

@youngeunkwon0405
youngeunkwon0405 force-pushed the youngeunk/new-refit-downsize branch from cef3f9d to 1605032 Compare July 4, 2026 18:32
@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test 1605032

@youngeunkwon0405
youngeunkwon0405 force-pushed the youngeunk/new-refit-downsize branch from 1605032 to 1388e0b Compare July 4, 2026 22:35
@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test 1388e0b

@youngeunkwon0405
youngeunkwon0405 force-pushed the youngeunk/new-refit-downsize branch from f81da1f to c293e41 Compare July 6, 2026 23:36
@youngeunkwon0405
youngeunkwon0405 requested a review from a team as a code owner July 7, 2026 03:42
@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Jul 7, 2026
@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test df61d48

@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test 4739e3a

@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test 2cee864

@youngeunkwon0405
youngeunkwon0405 force-pushed the youngeunk/new-refit-downsize branch from 2cee864 to b2fee20 Compare July 7, 2026 18:39
@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test b2fee20

@youngeunkwon0405
youngeunkwon0405 force-pushed the youngeunk/new-refit-downsize branch from 097850d to c577374 Compare July 20, 2026 23:03
@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test c577374

@youngeunkwon0405
youngeunkwon0405 force-pushed the youngeunk/new-refit-downsize branch from c577374 to 1ea8fd8 Compare July 21, 2026 18:03
@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test 1ea8fd8

@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test 375aaae

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

Thanks for this — the reshard core is impressive work. We hand-traced the expert-mesh EP/TP rank mapping (against Megatron-LM's expert RankGenerator with ETP=1), the gen-side rank arithmetic, the bulk/misc partition, and the merged-param slice math, and found them correct. The pure-function planning seam in nccl_reshard_utils.py makes the metadata logic CPU-testable, the three-impl xferdtensor dispatch behind one contract is clean, and check_nccl_reshard_refit_support is an unusually thorough validator — I checked every requirement the design doc lists and all seven are backed by a real violation. The measured refit times and KL ranges in the description are much appreciated.

Most of the feedback is about the configuration and guard surface around the feature rather than the reshard itself:

  • How the transport is selected. Every existing refit transport is chosen by one enum, policy.generation.refit_transport; this adds a sixth as a boolean on a different config node. That makes it undiscoverable from docs/guides/refit.md, and makes nccl_reshard_refit: true + refit_transport: nixl expressible and unvalidated.
  • Where misconfigurations are caught. The validator is reached from exactly one place in grpo.setup(), so three combinations bypass it — and ppo.py / distillation.py / opd.py / single_controller.py validate nothing at all.
  • A present-day silent no-op. grpo_sync.py calls refit_policy_generation without forwarding the flag, so with data_plane.enabled: true setup builds the communicators and then every refit quietly falls back to the old path. The existing policy_generation.weight_synchronizer attribute — already used by the sparse and NIXL transports — would fix this with no change to grpo_sync.py.
  • Guards on the direct write into vLLM storage. The one other code path that writes straight into w13_weight rejects enable_eplb because "ownership can change after metadata exchange" — the same assumption this PR makes when it fixes the expert→rank map at setup, and it's unguarded here.
  • Docs. refit.md (the page users read to pick a transport) isn't updated, and the design doc's requirements list omits gen-side pipeline_parallel_size=1 and the MoE expert-naming constraint that the code enforces.

Also: one latent layer→PP-stage mapping bug for bare-layers.N models under PP>1, an unvalidated NRL_REFIT_NUM_STREAMS, a base-class that advertises half the reshard protocol to value/DTensor workers, and two test-coverage asks (the pure-CPU reshard geometry, and the config validator).

Two notes needing no action now: _restore_placement / restore_refit_info_placements are untested and would bundle naturally into a geometry test file; and NcclReshardWeightSynchronizer reads megatron_cfg/vllm_cfg keys directly where CollectiveWeightSynchronizer stays backend-agnostic — defensible while this is Megatron→vLLM only, worth revisiting if the DTensor path lands.

Review notes: 6 review agents. All analysis is static — no GPU environment was available, so nothing here was verified by execution; repo linters deferred to CI.

Generated by Claude Code

Comment thread nemo_rl/algorithms/grpo.py Resolved
Comment thread nemo_rl/algorithms/grpo.py Resolved
Comment thread docs/design-docs/nccl-reshard-refit.md Resolved
Comment thread docs/design-docs/nccl-reshard-refit.md Resolved
youngeunkwon0405 and others added 3 commits July 27, 2026 14:17
Signed-off-by: Youngeun Kwon <[email protected]>

Downsizing the implementation to make only support FFN params.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Youngeun Kwon <[email protected]>

optional parallel misc

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Youngeun Kwon <[email protected]>

Add vLLM expert-parallel (EP) support to nccl_xfer refit

Gen-side EP (EP == TP): build separate expert/non-expert dst meshes
mirroring the train src side -- experts shard by index (Shard(0)) over the EP
ranks, dense stays TP-sharded; gen-backend guard relaxed to allow
expert_parallel_size == tensor_parallel_size. The gen-side w13/w2 spec is
shape-driven so it needs no change. Validated golden at parity across
nano/30B(+/-PP)/super/235B/DSv3 (gen EP4-EP32).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Youngeun Kwon <[email protected]>

xferdtensor_python: exact-transfer reshard as the default fallback

Add xferdtensor_python (exact overlap P2P to one representative replica +
cached split-comm broadcast to DP replicas) and make it the default when
the real nccl.m2n.reshard op is unavailable. xferdtensor_golden (full
broadcast) is now selected only via NRL_XFERDTENSOR_GOLDEN=true.

Also release cached allocator blocks (synchronize + empty_cache) between
the bulk reshard and the misc broadcast on both the Megatron and vLLM
sides: the misc packed_broadcast allocates via NCCL cudaMalloc outside
PyTorch's caching allocator, and blocks still cached from the bulk
reshard starve that allocation on memory-tight configs (235B misc
headroom gen-side; DSv3 pp16ep16 train-side hang -> gen stuck in misc
recv -> PIPELINE_MODEL_PARALLEL watchdog SIGABRT).

Validated (default path, KL == golden, weight_sync vs ~7.7s broadcast):
4B tp2->tp4 / pp2->tp4 0.0004 @0.3s; 30B ep4tp2->tp4 0.0018 @1.1s;
nemotron-super 0.0021 @2.2s; 30B genEP noPP/PP (->TP4.EP4) 0.0018/0.0020
@1.0s; 235B tp4pp8ep16->tp8 @gpu_mem 0.85 0.0043 @1.9s (with
NRL_REFIT_BUFFER_MEMORY_RATIO=0.005); DSv3 pp16ep16->tp32 0.0018 @2.4s.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Youngeun Kwon <[email protected]>

update xferdtensor_python_impl

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Youngeun Kwon <[email protected]>

rename nccl_xfer_refit -> nccl_reshard_refit and migrate into the weight_sync framework

The reshard API's product name is nccl_reshard; rename the whole surface
to match: config key +policy.nccl_reshard_refit, worker methods
(nccl_reshard_refit / prepare_nccl_reshard_refit_info /
init_nccl_reshard_comm_group), env NRL_NCCL_RESHARD_REFIT_PARALLEL_MISC,
and the utils module.

Migrate the transport into nemo_rl/weight_sync/:
- add NcclReshardWeightSynchronizer + factory routing
  (create_weight_synchronizer(nccl_reshard_refit=True) for non-colocated)
- grpo setup bootstraps via weight_synchronizer.init_communicator()
  (init_collective + per-PP-stage bulk comm groups + refit metadata) and
  refit_policy_generation syncs via weight_synchronizer.sync_weights()
- move nccl_reshard_utils.py / xferdtensor.py / xferdtensor_python.py
  from nemo_rl/distributed/ to nemo_rl/weight_sync/ (unit tests mirrored
  to tests/unit/weight_sync/, pyrefly.toml updated)

Validated: 1102 unit tests; full 30-case CI matrix (L0 x13, gen-EP x6,
L1 235B/DSv3, FP8 x9) all at golden-parity KL through the framework path;
refit latency unchanged vs the pre-migration runs (235B 1.7-2.0s,
DSv3 2.3-2.7s vs ~8s broadcast).

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Youngeun Kwon <[email protected]>

reshard: stream-safe transfers, always-serial misc, misc-phase timers

- xferdtensor() gains an optional 8th 'stream' arg, forwarded to
  xferdtensor_python_impl and to nccl.m2n.reshard (raw stream handle,
  omitted when None so wheels without the kwarg keep working).  Both
  workers pass their active stream (gen: per-stage stream; train:
  nccl_reshard_stream = the current stream) so LocalParamSpec pre/post
  and the reshard communication are ordered on one stream — the real
  op's side-stream comm raced against pre/post (reported by the NCCL
  team); the Python impl now honors the caller's stream explicitly.
- Remove the NRL_NCCL_RESHARD_REFIT_PARALLEL_MISC opt-in: the bulk
  reshard and misc broadcast now always run serially (bulk -> misc).
  The overlap deadlocked nondeterministically (misc recv + PP watchdog)
  and was never used.
- Time the misc phase on both sides with a rank-0 print:
  '[nccl_reshard_refit] misc broadcast (train side) / misc recv+load
  (gen side)'.

Validated (python path): 1102 unit tests; L0 4B/30B smokes at reference
KL; L1 235B (KL 0.0044, weight_sync 1.70-1.88s; misc train 1.44s / gen
0.33-0.36s) and DSv3 (KL 0.0018, 2.27-2.59s, 10/10 steps; misc gen
0.73-0.92s).

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Youngeun Kwon <[email protected]>

remove accidentally-committed pytest result artifacts

tests/unit/unit_results.json and tests/unit/unit_results/*.json are
per-run pytest artifacts (each embeds the run's git SHA, which trips the
CI secret detector as a hex high-entropy string).  They were swept in by
a wholesale 'git add tests/' during the weight_sync migration.  Remove
them and gitignore the paths so they cannot be committed again.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Youngeun Kwon <[email protected]>

trim verbose comments in xferdtensor.py

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Youngeun Kwon <[email protected]>

docs: add nccl-reshard-refit design doc

Design doc for the experimental nccl_reshard_refit path: how to enable
it, the setup/refit execution flow and derived metadata, the misc path,
the backend-agnostic vs backend-dependent split and how to extend new
backends, and the xferdtensor transports (nccl4py m2n reshard +
xferdtensor_python_impl backup).

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Youngeun Kwon <[email protected]>

drop unnecessary changes

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Youngeun Kwon <[email protected]>

nccl_reshard_refit: fix refit deadlock on tied-embedding models

The misc packed_broadcast producer emitted the tied lm_head.weight while the
consumer's misc_meta dropped it (a legacy skip left over from when embeddings
took the bulk path). That extra param shifted the packed-broadcast buffer
boundaries so the producer issued more broadcasts than the consumer, deadlocking
the refit (both golden and python transports, any tied-embedding model, e.g.
Qwen3-0.6B). Embeddings now route to misc like every other non-FFN param and
vLLM re-ties lm_head on load, so drop the stale skip; producer and consumer
agree again. The functional smoke runs the default transport (xferdtensor_python
fallback when nccl.m2n is absent).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Youngeun Kwon <[email protected]>

support grouped-gemm moe (e.g., qwen3.5) and make the hf_name prefix more generic

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Youngeun Kwon <[email protected]>
Signed-off-by: Youngeun Kwon <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Youngeun Kwon <[email protected]>
@youngeunkwon0405
youngeunkwon0405 force-pushed the youngeunk/new-refit-downsize branch from 375aaae to e78f181 Compare July 28, 2026 03:31
Co-Authored-By: Terry Kong <[email protected]>
Signed-off-by: Youngeun Kwon <[email protected]>
@youngeunkwon0405
youngeunkwon0405 force-pushed the youngeunk/new-refit-downsize branch from e78f181 to aa341e6 Compare July 28, 2026 04:07
@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test aa341e6

@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

Hi @terrykong, thanks for your detailed review and comments. I have rebased the branch and addressed your comments in the new commit.

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

Re-checked the items that weren't fully closed by aa341e6. Details in the threads below.

Generated by Claude Code

Comment thread nemo_rl/algorithms/grpo.py Resolved
@youngeunkwon0405

Copy link
Copy Markdown
Contributor Author

/okay to test 0c59579

@terrykong
terrykong enabled auto-merge (squash) July 29, 2026 06:47
@terrykong
terrykong merged commit e40aa04 into main Jul 29, 2026
142 of 145 checks passed
@terrykong
terrykong deleted the youngeunk/new-refit-downsize branch July 29, 2026 06:47
terrykong added a commit that referenced this pull request Jul 30, 2026
…perts layout

The nccl_reshard refit path landed on main (#2971) while this branch was
open, so the rebase is the first time it meets vLLM 0.25.

_build_hf_to_gen_backend_mapping derives the generation-backend parameter
name from the HF name, producing

    model.layers.N.mlp.experts.w13_weight

but 0.25 hangs the fused-MoE weights off a nested submodule -- RoutedExperts
is an nn.Module assigned as MoERunner.routed_experts (vllm 0.25.1
fused_moe/runner/moe_runner.py:266), and RoutedExperts owns w13_weight /
w2_weight -- so named_parameters() actually reports

    model.layers.N.mlp.experts.routed_experts.w13_weight

The existing _to_vllm_name fallback indexes real names by their
layer-relative suffix, which differs by exactly that segment and so does not
match either. An unresolved grouped expert is a hard ValueError, so every MoE
model would fail to refit over nccl_reshard on 0.25.

Index the real names a second time with the '.routed_experts.' segment
dropped and consult that only after both existing lookups miss. On a
0.20-style model the extra index is identical to the existing one, so this is
a no-op there.

The mapping tests drive a synthetic named_parameters() and all used
0.20-style names, so none of them covered this; add one built from the 0.25
layout, which raises without the fix.

Signed-off-by: Terry Kong <[email protected]>
terrykong added a commit that referenced this pull request Jul 30, 2026
…perts layout

The nccl_reshard refit path landed on main (#2971) while this branch was
open, so the rebase is the first time it meets vLLM 0.25.

_build_hf_to_gen_backend_mapping derives the generation-backend parameter
name from the HF name, producing

    model.layers.N.mlp.experts.w13_weight

but 0.25 hangs the fused-MoE weights off a nested submodule -- RoutedExperts
is an nn.Module assigned as MoERunner.routed_experts (vllm 0.25.1
fused_moe/runner/moe_runner.py:266), and RoutedExperts owns w13_weight /
w2_weight -- so named_parameters() actually reports

    model.layers.N.mlp.experts.routed_experts.w13_weight

The existing _to_vllm_name fallback indexes real names by their
layer-relative suffix, which differs by exactly that segment and so does not
match either. An unresolved grouped expert is a hard ValueError, so every MoE
model would fail to refit over nccl_reshard on 0.25.

Index the real names a second time with the '.routed_experts.' segment
dropped and consult that only after both existing lookups miss. On a
0.20-style model the extra index is identical to the existing one, so this is
a no-op there.

The mapping tests drive a synthetic named_parameters() and all used
0.20-style names, so none of them covered this; add one built from the 0.25
layout, which raises without the fix.

Signed-off-by: Terry Kong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:L1 Run doctests, unit tests, and functional tests Documentation Improvements or additions to documentation Performance Related to improving performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants