Repository navigation
[WS1][CUDA][Qwen3-Next] EP4 distributed logprob parity: expert-parallel MoE, full-model L2 bitwise on TP4 x EP4 (RFC #428 stack 10/11) - #557
Conversation
…rouped expert GEMM RFC RL-Align#428 moe_route_combine_contract (CUDA). - Routing: FP32 router through the pinned vLLM batch-invariant GEMM, a fixed-order softmax, stable descending argsort (ties go to the lower expert id) and FP32 renormalisation of the ten selected weights. - Experts: per-route gate_up and down projections through vLLM 0.30.0's fused_moe Triton kernel with the batch-invariant tile passed explicitly (BLOCK 64/64/32, SPLIT_K=1); no routed-weight multiply and no sum inside the kernel, so every (token, route) row has one writer. Bitwise equal to the previous per-expert GEMM loop at TP4 and TP1 widths; fails closed if VLLM_TRITON_USE_TD is enabled. - Combine: ten ordered FP32 multiply-adds and one BF16 cast; no atomics. - Backward: per-expert pinned GEMMs into one dense gradient buffer; dx is summed in ascending expert order. - TP4 block: HF load/export for all 512 experts, replicated router and shared-expert gate, Megatron-style copy/reduce autograd boundaries moved into qwen3_next_tp.py. - Prior-art runner and plot comparing HF transformers, vLLM fused_moe (BI=0/1) and FlashInfer cutlass_fused_moe; TP4 real-weight gate script. Signed-off-by: Wenbo Ji <[email protected]>
Prep for RFC RL-Align#428 full_model_chain; serves the gdn_state_bridge row. - GDN: packed recurrent prefill/decode through the pinned vLLM 0.30.0 provider with an explicit state boundary (qwen3_next_gdn.py), the depthwise causal convolution with cache handoff (qwen3_next_conv.py), their combined shared core (qwen3_next_provider.py) and the TP4 block with HF GQA-interleaved weight mapping (qwen3_next_tp_gdn.py), now on the shared TP boundaries in qwen3_next_tp.py. - Attention: the deterministic CUDA attention kernel accepts head dim 256 (ROCm stays 128) and validates backward inputs; shared_attention and TP4FullAttention with the KV head replicated on each rank pair, partial RoPE at absolute positions and explicit per-slot KV state. - Real-weight TP4 gates for GDN (layer 0) and attention (layer 3), sharing scripts/qwen3_next_gate_common.py with the MoE gate. Signed-off-by: Wenbo Ji <[email protected]>
…nce (B200, 2e950f3) Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
Compares RL-Kernel's deterministic attention with torch SDPA, vLLM FlashAttention-2 (num_splits auto and 1), vLLM's Triton unified attention and FlashInfer's ragged prefill: batch, chunked-prefill and decode invariance, backward repeatability, accuracy against FP64 and latency. Signed-off-by: Wenbo Ji <[email protected]>
…nce (B200, 9e6c4f2/6517077) Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
RFC RL-Align#428 full_model_chain (CUDA). - Engine adapters: the native vLLM rollout (exact-prefill scheduler, paged KV, traced response rows), the VIME/Megatron replay and training actor, engine weight import/export and the logprob adapter, all on the shared TP4 providers. - Stage runners (preflight, layers, l2, train1, train2, train) with the validated acceptance contract (version 4) and scripts/qwen3_next_run.py, a launcher that works inside any four-GPU allocation: each stage gets a clean clone, an immutable run.json identified by a fresh execution_id, and refuses a predecessor that did not pass or pins another identity. Scheduler-independent helpers live in scripts/qwen3_next_runtime.py. - Sub-node digests: both engines observe the normed mixer input, the mixer output, the normed MLP input, the selected expert ids and the MoE output of every layer, plus the embedding; the first divergence names the layer and sub-node. - scripts/qwen3_next_chain_report.py writes a ChainGateReport-compatible report (schema qwen3-next-chain-v1, compatible with ws1-c10-c11-v5) with first_drift_family/layer/cell; scripts/qwen3_next_publish_evidence.py publishes a chain's records without site paths, hosts or users. - Native rollout caps raised to 64 sequences, 16384 batched tokens and a 4 GiB KV budget so the batch-invariance matrix runs under the same certified profile; the exact-prefill scheduler still fixes every chunk. - The operator-case registry is regenerated from collection by scripts/qwen3_next_operator_cases.py. - Packaging: transformers may be 5.13.1-5.17.0; a qwen3-next extra pins the audited runtime. Signed-off-by: Wenbo Ji <[email protected]>
RFC RL-Align#428 batch_invariance_ci (CUDA). - Stage bi (after a passed l2, same certified profile): 97 pinned cells in rl_engine/testing/qwen3_next_bi_cases.py / qwen3_next_bi_manifest.json. concurrency (1-64 requests, target first or last), interference (companion content, lengths, arrival during prefill/decode, generation lengths), chunk boundaries (prompts 63-1024 around 64/128/528/1024, chunk 64/128, first chunk 1/63/65, compared with the replay recompute) and replay THD packing (1-7 neighbours, target first or last). A quick CI subset runs one cell per family plus 64 concurrent requests. - Native rollout: version 2 requests run one traced target next to untraced companions; the exact-prefill scheduler admits each request at its arrival step, pins the target's planned chunk at every step and fails on any preemption; the trace records only the target. - Replay: packed_layout() packs variable-length neighbours with the traced target in one THD batch. - bi-matrix.json names each failing cell's first divergent layer, sub-node and layer family; the chain report gains a batch_invariance section, and the evidence publisher takes the bi run with --also. - gtest: bitwise judgments compare raw bits (signed zero, NaN/Inf and dtype now count), not allclose with zero tolerance. Signed-off-by: Wenbo Ji <[email protected]>
…lout profile Batch-invariance chunk cells use prompts such as 129 tokens; the state-shape check only admitted the four L2 lengths, which their own validators already pin. Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
Editable sources, base interpreters and build directories in package metadata now keep only their last path component; cgroup paths keep only their file name. The leftover check matches absolute paths only, so package paths such as vllm/.../cpu/data/ are not flagged, and any mention of the batch scheduler blocks publication. Signed-off-by: Wenbo Ji <[email protected]>
…r-art runner - Megatron-core 0.16 MoELayer with Transformer Engine grouped GEMM and fused permute, configured as VIME runs Qwen3-Next (FP32 softmax router, top-10, all-to-all dispatcher), including its backward. - SGLang 0.5.21 Triton fused_moe in default and deterministic-inference mode. sgl_kernel cannot load next to torch 2.13, so its two kernels on this path are replaced by SGLang's own Triton moe_sum_reduce and JIT moe_align_block_size; any other sgl_kernel call fails loudly. - --only and --merge combine reports from different Python environments. Signed-off-by: Wenbo Ji <[email protected]>
…ured (B200, c58816b) Every library in the reuse table is now measured: Megatron-core 0.16 + TE 2.16 as VIME configures Qwen3-Next, and SGLang 0.5.21 in default and deterministic-inference mode. The TP4 gate evidence is unchanged (2e950f3, identical MoE code). Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
…gatron-core attention Add three engines to the attention prior-art runner: - FlashAttention-4 (CuTe DSL) varlen as vendored by vLLM, forward and backward. - Transformer Engine DotProductAttention on THD-packed sequences, in inference mode (cuDNN fused) and in training mode (on SM100 TE has no fused head-dim-256 backward and falls back to its unfused path). - Megatron-core's local DotProductAttention, one launch per sequence. The backward check now compares the target's dq/dk/dv alone against the same sequence packed first and last, so engines with a packed backward are checked for batch invariance rather than repeatability. A prefill/decode crash is recorded per candidate without skipping its other checks. --only and --merge combine reports from different Python environments. Signed-off-by: Wenbo Ji <[email protected]>
The decode and forward+backward latency sections are keyed by candidate directly, the prefill section by size first; merge them at any depth. Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
…p as E402-exempt The gate scripts insert the repo root into sys.path before importing rl_engine and tools, which flake8 reports as E402. Mark those imports with noqa, as the other tools/ scripts do. Signed-off-by: Wenbo Ji <[email protected]>
…p as E402-exempt The gate scripts insert the repo root into sys.path before importing rl_engine and tools, which flake8 reports as E402. Mark those imports with noqa, as the other tools/ scripts do. Signed-off-by: Wenbo Ji <[email protected]>
Annotate the latency samples and accept the default-argument lambdas used as timed calls. No behaviour change. Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
… runner Annotate the latency samples and accept the default-argument lambdas used as timed calls. No behaviour change. Signed-off-by: Wenbo Ji <[email protected]>
Merge the migrated TP4 mixers (and through them the refactored test-qwennext) and move the full-model chain into the new layout: - model-level TP4 pieces (embedding, engine weights, logprob, sub-node observations) into rl_engine/models/qwen3_next/; - vLLM adapters and the native rollout into rl_engine/integrations/engines/rollout/vllm/; - VIME providers into rl_engine/integrations/orchestrators/vime/providers/ and the native VIME lifecycle (recompute, training, workers, profile) into rl_engine/integrations/orchestrators/vime/experiments/qwen3_next/; - the provider identity into rl_engine/integrations/common/; - chain report, L2/case fixtures and manifests into rl_engine/validation/models/; - stage runners and the launcher into tools/validation/models/, CI scripts into ci/scripts/, tests into tests/models/qwen3_next/. Imports point at canonical modules; the provider-source digest list names the canonical RMSNorm backend instead of its compatibility alias. Recorded contract identities (e.g. sample_counter_owner) are unchanged. Signed-off-by: Wenbo Ji <[email protected]>
…nce matrix Merge the migrated full-model chain and move the batch-invariance work into the new layout: the case generator and manifest into rl_engine/validation/models/, the stage runner into tools/validation/models/, its tests into tests/models/qwen3_next/. The raw-bit comparison for bitwise judgments now lives in the canonical rl_engine/validation/operators/forward_invariance.py (the old module is a compatibility alias). The evidence README gives the commands in the current layout and says where the runners were at the measured commit; no measured file changed (SHA256SUMS verified). Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
…ouched The published chain evidence is a byte-exact copy covered by SHA256SUMS; a pytest JUnit XML without a final newline would otherwise be rewritten by end-of-file-fixer and break the checksum. Same treatment as reports/archive/. Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
…ouched Signed-off-by: Wenbo Ji <[email protected]>
The autograd backward of combine_routes summed grad * expert_output over H with torch.sum, whose reduction order depends on the batch shape, so the route-weight gradient stopped being batch-invariant from 16 rows up. Add a custom autograd Function that sums H with fixed_order_row_sum, and a test that compares the first 8 rows alone against the same rows inside larger batches. Signed-off-by: Wenbo Ji <[email protected]>
Provider job, chain preflight (failed at rollout-smoke), logprob prior art over 13 NCCL settings, EP matrix at 2c699e3, RL-Align#557 gates at f935bf3, RL-Align#549 parity at 30c0e5a, RL-Align#543/RL-Align#544 preflight at their own heads. Redacted. Signed-off-by: Wenbo Ji <[email protected]>
…note The empty-token branch of _SharedLinear.backward returned a zero bias gradient whenever a bias was present; gate it on needs_input_grad[2] like the non-empty branch. The shared_moe docstring said the forward has no host synchronisation, but stable_top10_routes checks the router logits for finite values on the host; say so. Signed-off-by: Wenbo Ji <[email protected]>
Flink-ddd
left a comment
There was a problem hiding this comment.
The layout follows #497, but Hopper validation is still incomplete. Please fix the known batch-dependent combine_routes backward reduction, cover the router and combine path in the EP4 gradient tests, and run full EP4 rollout and replay parity on four H100 and H200 GPUs using the submitted code before merging.
… gpu probe Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit a705d28) Signed-off-by: Wenbo Ji <[email protected]>
…RL-Align#543 Signed-off-by: Wenbo Ji <[email protected]>
…GPUs only Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
…) into RL-Align#544 Signed-off-by: Wenbo Ji <[email protected]>
…) into RL-Align#549 Signed-off-by: Wenbo Ji <[email protected]>
…) into RL-Align#557 Signed-off-by: Wenbo Ji <[email protected]>
…ine_routes The EP4 MoE gate compared only the routed experts on fixed routes. Each token count now also runs the whole routed block end to end (shared_moe_ep: shared_router, stable_top10_routes, the experts and combine_routes) against shared_moe (EP1) on the same weights, bitwise: the output, route indices and weights, the input gradient, the router weight gradient and the owned experts' weight gradients. The router weight gradient must be non-zero and identical on every rank. The four new case ids are mandatory in the layer contract. Signed-off-by: Wenbo Ji <[email protected]>
…, EP4 router/combine gate) into RL-Align#551 Signed-off-by: Wenbo Ji <[email protected]>
A report with "passed": "false", 1 or null exited 0 or 1 as if judged; it is now a malformed report (exit 2), like the other structural checks. Signed-off-by: Wenbo Ji <[email protected]>
The vLLM attention-metadata test imported vLLM at collection time under a test_ name, so a default pytest run over tests/ failed collection without vLLM and broke the no-optional-framework import check with it. It is now check_qwen3_next_vllm_attention_metadata.py. The provider step also runs check_qwen3_next_native_rollout.py, check_qwen3_next_engine_metadata.py and check_qwen3_next_vllm_model_contract.py, which no job ran before; the chain doc no longer lists the attention-metadata test as needing VIME. Signed-off-by: Wenbo Ji <[email protected]>
…n#543 Signed-off-by: Wenbo Ji <[email protected]>
…in the provider job, RL-Align#503 bias grad gate) into RL-Align#544 Signed-off-by: Wenbo Ji <[email protected]>
…in the provider job, RL-Align#503 bias grad gate) into RL-Align#549 Signed-off-by: Wenbo Ji <[email protected]>
…in the provider job, RL-Align#503 bias grad gate) into RL-Align#557 check_qwen3_next_vllm_model_contract.py stays only in this PR's four-GPU step, which already runs it. Signed-off-by: Wenbo Ji <[email protected]>
| python3 - <<'PY' | ||
| import torch | ||
| assert torch.cuda.device_count() >= 4, "the real-model check needs four GPUs" | ||
| PY | ||
| python3 -m pytest -q -rs tests/models/qwen3_next/check_qwen3_next_vllm_model_contract.py \ | ||
| tests/models/qwen3_next/check_qwen3_next_vllm_real_model.py |
There was a problem hiding this comment.
Unlike the preceding "Check pinned providers" step, this new step runs pytest directly without the fail-closed skip detection (tee to a log + grep -Eq '^SKIPPED|[0-9]+ skipped' + grep -Eq '[0-9]+ passed' + set -o pipefail). The only guard is the device_count >= 4 assertion. check_qwen3_next_vllm_model_contract.py drives every test through tests.models.qwen3_next.vllm_real.real_vllm_config, and if that helper (or vLLM availability/dtype/kernel support) causes these modules to skip, pytest exits 0 on an all-skipped run and the job reports a green "real model" validation that never executed. The step's own comment says it should fail instead of reporting a pass that did not run them, but nothing enforces that for skips. Apply the same log+skip-grep guard used in the previous step.
Suggestion:
| python3 - <<'PY' | |
| import torch | |
| assert torch.cuda.device_count() >= 4, "the real-model check needs four GPUs" | |
| PY | |
| python3 -m pytest -q -rs tests/models/qwen3_next/check_qwen3_next_vllm_model_contract.py \ | |
| tests/models/qwen3_next/check_qwen3_next_vllm_real_model.py | |
| set -o pipefail | |
| log="$RUNNER_TEMP/real-model-pytest.log" | |
| python3 -m pytest -q -rs tests/models/qwen3_next/check_qwen3_next_vllm_model_contract.py \ | |
| tests/models/qwen3_next/check_qwen3_next_vllm_real_model.py | tee "$log" | |
| if grep -Eq '^SKIPPED|[0-9]+ skipped' "$log"; then | |
| echo "::error::a real-model check was skipped" | |
| exit 1 | |
| fi | |
| grep -Eq '[0-9]+ passed' "$log" |
There was a problem hiding this comment.
Fixed in the follow-up #740 (ecd28a81), since this PR is merged. The step now uses the provider step's guard: set -o pipefail, a tee'd log, fail on any skip, and at least one pass required. Checked with stubbed pytest output: all passed exits 0; one skip, all skipped, a failure and no tests collected all exit non-zero.
Fixed in |
…, real smoke, RL-Align#543/RL-Align#544/RL-Align#557 chains, RL-Align#544 bi 97 cells, step 5 Signed-off-by: Wenbo Ji <[email protected]>
…RL-Align#495 and RL-Align#491 at their current heads Signed-off-by: Wenbo Ji <[email protected]>
Provider job, chain preflight (failed at rollout-smoke), logprob prior art over 13 NCCL settings, EP matrix at 2c699e3, RL-Align#557 gates at f935bf3, RL-Align#549 parity at 30c0e5a, RL-Align#543/RL-Align#544 preflight at their own heads. Redacted. Signed-off-by: Wenbo Ji <[email protected]>
…, real smoke, RL-Align#543/RL-Align#544/RL-Align#557 chains, RL-Align#544 bi 97 cells, step 5 Signed-off-by: Wenbo Ji <[email protected]>
…, real smoke, RL-Align#543/RL-Align#544/RL-Align#557 chains, RL-Align#544 bi 97 cells, step 5 Signed-off-by: Wenbo Ji <[email protected]>
What
rl_engine/models/qwen3_next/qwen3_next_ep.py): expert parallel 4 over the TP4 group, expert tensor parallel 1. Rank r owns experts[128r, 128r + 128)at full width; attention, GDN, embedding, LM head and the shared expert stay TP4.all_gather, which is a byte copy with no arithmetic.combine_routes(FP32, route order) locally.enable_expert_parallelwith linear placement;SharedVLLMMoEuses the EP path and checks that vLLM'sexpert_mapis exactly[128r, 128r + 128).expert_model_parallel_size4,expert_tensor_parallel_size1.SharedVIMEEPMoEasserts that the expert-parallel rank equals the TP rank, and the HF loader returns only local experts.qwen3_next_run.py --ep {1,4}records the topology inrun.json, and every later stage checks it. Thelayersstage runs the new EP4 MoE gate (moe_ep) in place of the TP4 MoE gate.docs/operators/qwen3-next-distributed-logprob.md): new EP section, one row per cross-rank point.VllmConfigfrom vLLM's own config classes (tests/models/qwen3_next/vllm_real.py), andcheck_qwen3_next_vllm_real_model.pybuilds RL-Kernel's wrapper around vLLM's actualQwen3NextForCausalLMon four real ranks at EP1 and EP4 (weights allocated, not loaded): drift rejected before any model memory is allocated; 48 layers hold the shared classes and shapes; the routed-expert parameters keep vLLM's native weight loaders; at EP4 vLLM's ownexpert_mapequals[128r, 128r + 128)and every expert is held once. Both run inpreflight's device guards, which previously ran only the multi-GPU guard.tools/validation/models/qwen3_next/, the comparison benchmark in [WS1][CUDA][Qwen3-Next] Comparison benchmarks and plots for the Qwen3-Next stack: MoE, attention, logprob, EP (RFC #428 stack 11/11) #551, raw evidence as a release ZIP.Prior art & reuse decision
Measured on the same layer-0 weights and replicated input, EP4 under 13 NCCL settings and EP1, 4 × B200, 1024 tokens (summary, runner in #551, measured at
45719cb3):qwen3_next_ep(this PR, both engines)fused_experts+expert_map+ vLLM's all-reduce (default orVLLM_BATCH_INVARIANT=1)all_reducecutlass_fused_moewithep_size/ep_rank+ vLLM's all-reduceFusedMoE, EP ranks combined bytensor_model_parallel_all_reduce(fused_moe_triton/layer.py:1597)sgl_kerneldoes not load next to torch 2.13, and the only machine available for the follow-up check has 2 B200 (EP4 needs 4); same structure as vLLMMoELayer, alltoall / allgather dispatchertorch.use_deterministic_algorithms(True), alltoallradixark/miles@23d3d38)miles/kernels/moe/fused_experts{,_bwd}.py(SGLang forward, own backward), imported unmodified; layer-0 weights at EP1, 20 launchesdx,dWgate/up,dWdown equal the first in 1 / 20 launches (BF16tl.atomic_add);dxprobe rows 0 / 10 batch cellsvolcengine/verl@e5a627c)verl/); Megatron-core, HF/FSDP or VeOmni for training, vLLM/SGLang for rolloutBatch invariance: 8 probe tokens alone vs inside batches of 8 / 64 / 256 / 1024 at the first, middle and last position, on the output and (backward) the input gradient.
Decision: write our own EP4 path, reusing the #503 MoE contract and RL-Kernel's fixed-order collective.
tl.atomic_add, and over 20 identical launches on the real weightsdx,dWgate/up anddWdown equal the first in only 1 of 20 (measured, EP1 as Miles has no EP kernel path); at EP1 it is 15× faster than our EP1 path (10 vs 158 ms forward + backward, 1024 tokens); RL-Kernel's EP4 forward + backward is about 53 ms (2.3 + 51).Results (4 × B200, official checkpoint, TP4 × EP4)
EP4 evidence summary and raw results (ZIP) (SHA-256
4b1e8c93…7bca). Measured at1c4ae265from clean clones in the same environment as the TP4 × EP1 chain.preflightlayersl2Chain-gate report:
config_fingerprint.ep4, 16 cells,passed: true,first_drift: null.EP4 MoE gate, every rank, bitwise:
hf-load-export-each-expert-onceep4-vs-ep1-chunk-reorder-train-{8,64,256,1024}empty-rank-participationEP4 is not TP4 × EP1.
qwen3-next-moe-ep4-v1), and parity means rollout and replay both run it.Status
62487710, on top of [WS1][CUDA][Qwen3-Next] TP distributed logprob parity: fixed reduction order, selected-token logprob exact across NCCL settings (RFC #428 stack 9/11) #549 (e8195782). CI is green on this head: lint, unit-tests, docs, DCO and the bot review pass;providerandws1-gtestskip because no self-hosted runner is attached.train*stages). The training actor and export fail closed on EP4; follow-up PR.preflightandgpu_probeaccept exactly four B200, H100 or H200 GPUs (a705d287); the same change is now in [WS1][CUDA][Qwen3-Next] Full-model chain: vLLM rollout vs VIME recompute, raw-bit through two updates and a reload (RFC #428 stack 7/11) #543, which this PR merges.combine_routesbackward: the batch-dependenttorch.sumover H in its autograd backward is replaced in [WS1][CUDA][Qwen3-Next] MoE route/combine contract with a batch-invariant grouped expert GEMM (RFC #428 stack 5/11) #503 by a fixed-order row sum (e514d42f, with a batch test incheck_qwen3_next_forward.py), merged here through [WS1][CUDA][Qwen3-Next] TP distributed logprob parity: fixed reduction order, selected-token logprob exact across NCCL settings (RFC #428 stack 9/11) #549.combine_routes(62487710): the EP4 MoE gate now also differentiates the wholeshared_moe_ep(router,stable_top10_routes, the experts,combine_routes) and compares it bit for bit withshared_moeon one GPU with all 512 experts: the output, the route indices and weights,dx, the router weight gradient (also required non-zero and identical on every rank) and the owned experts' weight gradients, at 8, 64, 256 and 1024 tokens. The four case idsep4-vs-ep1-router-combine-backward-{8,64,256,1024}are mandatory in the layer contract.f935bf3a(no patch) the Qwen3-Next suites passed (871 passed, 0 skipped) and the six gates passed on 4 × H100 (gates-f935bf3a); that gate predates the router /combine_routescases. The full-model EP4 chain (preflight,layers,l2) cannot run yet:preflightstops inrollout-smokewith the FlashInfertrtllmall-reduce abort described in [WS1][CUDA][Qwen3-Next] Full-model chain: vLLM rollout vs VIME recompute, raw-bit through two updates and a reload (RFC #428 stack 7/11) #543, which is being diagnosed on H100. H200: not available to us.90c09164, 4 × B200): preflight, layers (withmoe_ep) and l2 passed, 16/16 raw-bit, and the 32 L2 artifacts are bitwise identical to the1c4ae265run; the standalone EP4 MoE gate passed on all four ranks. The full batch-invariance suite then ran at EP4: 97 / 97 cells bitwise (same cell definitions as at EP1), raw results ZIP, SHA-2566d072754…58a9. EP4 training stays fail-closed, so no EP4 training stage is claimed. At17ba4a4cthe EP4preflightpassed again with the new device guards (27 tests, 0 skipped, 0 failed).History
d73ef817), which brings [WS1][CUDA][Qwen3-Next] MoE route/combine contract with a batch-invariant grouped expert GEMM (RFC #428 stack 5/11) #503's fixed-ordercombine_routesbackward and [WS1][CUDA][Qwen3-Next] Full-model chain: vLLM rollout vs VIME recompute, raw-bit through two updates and a reload (RFC #428 stack 7/11) #543's copy of the Hopper allowance; the EP4 MoE gate differentiates through the router andcombine_routes(62487710, four new mandatory cases).a705d287and the comparison at58aa50c7. The raw files record2a8f18e4and77d59a59, the ids these commits had before the branches were rewritten; each pair has the same tree. An earlier version also reported a full-model EP4 chain run on H100 that was made with local changes that are not part of this PR; that result is withdrawn, its raw files are removed from thepr_assetsbranch (2c0aba6d), and the chain is listed as not run on H100. The FlashInfer CUTLASS row of the H100 comparison, which showed [WS1][CUDA][Qwen3-Next] MoE route/combine contract with a batch-invariant grouped expert GEMM (RFC #428 stack 5/11) #503's single-GPU (non-EP) numbers instead of an EP4 measurement, is now marked as not measured. The RL-Kernel backward batch-invariance cell has footnote ¹: the stockcombine_routesbackward was not batch invariant from batch 16 upward in [WS1][CUDA][Qwen3-Next] MoE route/combine contract with a batch-invariant grouped expert GEMM (RFC #428 stack 5/11) #503's H100 diagnostics.pull_requestpaths were missing Qwen3-Next modules that its checks import; merged the additions of [WS1][CUDA][Qwen3-Next] Full-model chain: vLLM rollout vs VIME recompute, raw-bit through two updates and a reload (RFC #428 stack 7/11) #543 and [WS1][CUDA][Qwen3-Next] Batch-invariance matrix for the full model, 97/97 cells bitwise (RFC #428 stack 8/11) #544; this PR's own logprob-kernel and rollout-bridge entries are kept once (88c4f02e). Workflow-only change; shared infrastructure such asrl_engine/opsandrl_engine/platformsstays out of the filter.6dc9d410triggers the provider job oncsrc/cuda/logprob/**and the vLLM rollout bridge. The fixes of the PRs below it are merged in; new head65eaae4d. Kernel arithmetic is unchanged, so the measured results stand.test-qwennextafter [WS1][CUDA][Qwen3-Next] C1: zero-centred RMSNorm references and CUDA kernel (RFC #428 stack 2/4) #467 landed (c382dd4b), through [WS1][CUDA][Qwen3-Next] TP distributed logprob parity: fixed reduction order, selected-token logprob exact across NCCL settings (RFC #428 stack 9/11) #549's new headfe6ed386, in85297004. One conflict, in the provider workflow: the pinned-provider step takes [WS1][CUDA][Qwen3-Next] C6: GDN decode-step goldens and recurrent/conv state contract (RFC #428 stack 4/4) #469's fail-closed skip check, and this PR's four-GPU vLLM model step follows it unchanged.Tests
python -m pytest -q tests/models/qwen3_next/test_qwen3_next_ep.py tests/models/qwen3_next/test_qwen3_next_chain_report.py TRITON_F32_DEFAULT=ieee torchrun --nproc-per-node 4 tools/validation/models/qwen3_next/qwen3_next_ep_moe_check.py \ --checkpoint <ckpt> --output <dir> python tools/validation/models/qwen3_next/qwen3_next_run.py --stage all --until l2 --ep 4 \ --runs-root <runs> --checkpoint <ckpt> --cuda-home <cuda-13.0> --python <venv>/bin/pythonci.yml(includes the newtest_qwen3_next_ep.py) + digest testspreflightdevice guards at EP4 (multi-GPU + contract + real model)mkdocs build --strictScope
CUDA, TP4 × EP4 × ETP1 × CP1, one node of four B200, rollout and replay up to L2. EP training, other EP sizes, ROCm and multi-node are out of scope.
Results (4 × H100; no full-model run)
4 × NVIDIA H100 (driver 580.173.02 in the gates run), torch 2.13.0+cu130, vLLM 0.30.0, NCCL 2.29.7. The comparison run does not record the Megatron-core version.
Tests and gates, at
a705d287on this PR's branch (not rerun at the head88c4f02e).gates/info.txtand the EP4 MoE, TP4 attention, TP4 GDN and TP4 MoE gate files record2a8f18e4, the id of this commit before the branch was rewritten. Both ids have the tree4102963e2673c15b8a5e807f7ea4223173630370;git rev-parse a705d287^{tree}gives it. The GDN engine adapter and TP4 embedding / LM head gate files record no commit.gates/pytest.logis a quiet-mode log (progress marks and the final line) and does not record the command line.tests/models/qwen3_next/test_*.pyandcheck_*.pygates/pytest.log,gates/info.txtadapter,ep_moe,tp_attention,tp_gdn,tp_head,tp_moe(each gate also hasrank-1.jsontorank-3.jsonand a.login the same folder)The EP4 MoE gate (script at
a705d287; its rank files record the pass status and output hashes, not the individual comparisons) checks bit for bit, at 8, 64, 256 and 1024 tokens, that the EP4 routed-expert rows (beforecombine_routes), their input gradientdxand each rank's own experts'dWequal the same experts evaluated on one GPU (EP1) on the same routes. For the EP4 block alone it checks that the full batch equals the concatenated chunks, that reordered tokens give the reordered output, that the first row alone matches, and that the training forward equals the no-grad forward. Ata705d287the gate did not compare the combined block output with EP1 and did not differentiate throughcombine_routesor the router; since62487710it does (see Status), which has not run on H100 yet.Not run on H100 yet: the full-model EP4 chain (
preflight,layers,l2: vLLM rollout against VIME recompute) with this PR's code.Comparison with existing implementations (same runner and columns as "Prior art & reuse decision" above). Layer-0 MoE with the checkpoint's layer-0 weights on one fixed random 1024-token input: EP4 on four GPUs under each of the 13 NCCL settings of #549, and EP1 on one GPU. Measured at
58aa50c7, which is on the #551 branch (that branch contains this PR's head88c4f02e), with #551's EP benchmark runner (moe_ep_candidates.py,qwen3_next_moe_ep_prior_art.py). The report records77d59a59, the id of this commit before the branch was rewritten. Both ids have the tree67a6c5c8a30c1351b05beb9b9f509976f8dff45c;git rev-parse 58aa50c7^{tree}gives it. The EP4 == EP1 and backwarddx/dWequalities of RL-Kernel appear as flags inep_matrix/report.jsonundercandidates.rl_kernel_ep(ep4_equals_ep1,backward.dx_ep4_equals_ep1,backward.dw_ep4_equals_ep1).In the "Fwd NCCL-setting invariant" column, the number in parentheses is the count of distinct EP4 outputs across the 13 NCCL settings.
qwen3_next_epfused_experts+ vLLM all-reducefused_experts+ vLLM all-reduce,VLLM_BATCH_INVARIANT=1(identical outputs)fused_experts+ NCCLall_reduceMoELayer, alltoallMoELayer, allgatherMoELayer, alltoall,torch.use_deterministic_algorithms(True)MoELayer, allgather,torch.use_deterministic_algorithms(True)¹ Measured on one fixed random input with the stock
combine_routes, as it was from58aa50c7until #503'se514d42fwas merged in. Its autograd backward reduces the route-weight gradient over the hidden dimension withtorch.sum. In #503's H100 diagnostics (results.txt), on synthetic inputs, that reduction was not batch invariant from batch 16 upward and madedxdiffer. This cell therefore holds for the measured input only. Sincee514d42fthe backward sums H withfixed_order_row_sum; this cell was measured before that change.² The JIT build of FlashInfer 0.6.18.post1's
fused_moe_90module failed at link time on the H100 machine (/usr/bin/ld: cannot find -lnvrtc,Ninja build failed; seecandidates.flashinfer_cutlass_ep.unavailableinep_matrix/report.json). #503's H100 run linked it through alibnvrtc.sosymlink, which this run did not have. The candidate is therefore recorded as unavailable, and this table has no FlashInfer numbers.Batch invariance: the probe of 8 tokens is compared alone and inside batches of 8, 64, 256 and 1024 tokens, at the first, middle and last position (cell
1024@508is the 1024-token batch with the probe at position 508), on the output and, for the backward, on the input gradient. With vLLM's all-reduce (default andVLLM_BATCH_INVARIANT=1), vLLM differs only in the 1024-token batch (cells1024@0,1024@508and1024@1016); with NCCLall_reduceit differs in every cell except8@0.Latency: the benchmark runner takes one warm-up call, then the median of 20 timed forward calls at 1024 tokens and, for the second number, the median of 5 timed forward + backward calls. The EP4 value in the table is the largest of the four ranks' values (
latency_us_ep4in the report), in the run with default NCCL settings. The published run files hold rank 0 only. Report:ep_matrix/report.json; run files:ep_matrix/runs/.