Skip to content

Add native routed expert LoRA slots and independent expert factors - #47

Merged
kailash109 merged 2 commits into
spindle-miles-v0.2.0from
codex/native-routed-expert-lora
Nov 17, 2026
Merged

kailash109 merged 2 commits into
spindle-miles-v0.2.0from
codex/native-routed-expert-lora

Conversation

@kailash109

@kailash109 kailash109 commented Nov 17, 2026 •

Copy link
Copy Markdown

Native multi-LoRA previously rejected routed experts because slots assumed contiguous token ranges. Carry slot IDs through Megatron's all-to-all dispatcher and apply each adapter to its expert-major rows. Support independent factors per expert and the existing shared-outer layout, mask padded ranks along the correct 3-D tensor axes, and freeze shared router bias using the same helper as Bridge.

This is the first half of the split of #46. It contains the generic expert implementation and its gated/ungated tests, without Nemotron model registration, model provider, or checkpoint conversion. The separate Nemotron Nano PR #48 depends on this branch. Merge this PR first; then retarget #48 to spindle-miles-v0.2.0. GPT-OSS is unchanged.

Validation:

  • Repository pre-commit checks pass across the split changes.
  • The standalone expert native-adapter suite passes (218 tests), and the TP2/EP2/ETP1 two-H200 regression passes (69.6 seconds in the split validation run). The regression covers gated/ungated experts, independent/shared-outer factors, mixed ranks, recomputation, tenant isolation, collective export/checkpoint mapping, and frozen router bias.
  • Before splitting, the same implementation passed all 243 adapter tests and the two-H200 regression (51.9 seconds). The split only replaces the GPU test's Nemotron-specific up-only descriptor with an equivalent generic fixture.

The Nano full-model score-repeatability failure from #46 is tracked on the separate Nano PR; it is not presented as a passing end-to-end result for this generic change. Generated results are excluded.

CI timing: tests/fast-gpu/test_lora_native_experts.py uses stage-b-2-gpu-h200, num_gpus=2, est_time=180 as an upper bound. The development timing above was measured on Modal; registered CI runner timing remains unmeasured. No shared CI rerun has been requested.

nanjiangwill and others added 2 commits November 17, 2026 22:06
Native LoRA adapted Qwen3.5/3.6 MoE's attention, Gated DeltaNet and shared
expert, but not its routed experts. The shared-outer grouped-expert spec Inkling
and Kimi K3 use attaches to Megatron's grouped experts of any model; only how
targets name the experts was theirs. GroupedExpertsSpec now names the expert
leaves the converter gives (w1/w3/w2) and whether targets name one expert, and
the adapters export under those leaves. PackedGroupedExpertsSpec covers HF
models that pack their experts in experts.gate_up_proj and experts.down_proj,
with gate_proj/up_proj/down_proj leaves, as Qwen3.5/3.6 MoE does. A spec without
a fixed target layout gives the pattern its expert targets sit under, so the
target check accepts them.

--experts-shared-outer-loras and --expert-tensor-parallel-size 1 are required
only once the targets reach the routed experts (a fixed layout always does), so
attention-only Qwen3.5/3.6 MoE runs work as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants