Repository navigation
[WS1][CUDA][Qwen3-Next] Batch-invariance matrix for the full model, 97/97 cells bitwise (RFC #428 stack 8/11) - #544
Conversation
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]>
…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 Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Signed-off-by: Wenbo Ji <[email protected]>
tools/validation/models/plot_qwen3_next_batch_invariance.py draws, from the published evidence only, one panel per cell family (concurrency, chunk boundaries, interference, packing); a cell is green when tokens, logits, logprobs and every layer digest are bitwise equal to its reference. Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
1d5242e to
27515f8
Compare
Signed-off-by: Wenbo Ji <[email protected]>
…xt gate scripts The scripts moved from ci/ to ci/scripts/ with the repository refactor but still resolved the root one directory up, so the preflight operator gates looked for the runner under ci/. Signed-off-by: Wenbo Ji <[email protected]>
…anch Signed-off-by: Wenbo Ji <[email protected]>
Per the layout review on RL-Align#549, this branch's own files move the way RL-Align#549 already moved them: the BI cases and manifest to rl_engine/validation/models/qwen3_next/, the BI runner to tools/validation/models/qwen3_next/, with imports and tests following. The BI plot moves to the Qwen3-Next benchmark PR, and the committed BI evidence is replaced by the summary RL-Align#549 already publishes (ZIP release attachment, SHA-256, tested commit, commands). Signed-off-by: Wenbo Ji <[email protected]>
|
Replies to the nine OpenCodeReview summary items:
|
Signed-off-by: Wenbo Ji <[email protected]>
|
Replies to the three OpenCodeReview summary items:
|
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]>
…) into RL-Align#544 Signed-off-by: Wenbo Ji <[email protected]>
| if actual != expected: | ||
| raise ValueError("Worker imported a different CUDA binary than its stage built") |
There was a problem hiding this comment.
expected comes from the archived record, whose path is str(binary) built from Path(source).absolute() in archive_provider_binary (no symlink resolution), while imported_provider_identity() returns str(Path(filename).resolve(strict=True)). Whenever the workspace/build root is reached through a symlinked component (macOS /tmp → /private/tmp, container bind mounts, symlinked install trees), the same binary yields two different path strings, so this check raises "Worker imported a different CUDA binary than its stage built" even though the digests already match. Compare the content identity (sha256), and only treat paths as distinct when the expected path really resolves elsewhere.
Suggestion:
| if actual != expected: | |
| raise ValueError("Worker imported a different CUDA binary than its stage built") | |
| if actual["sha256"] != expected["sha256"]: | |
| raise ValueError("Worker imported a different CUDA binary than its stage built") |
…in the provider job, RL-Align#503 bias grad gate) into RL-Align#544 Signed-off-by: Wenbo Ji <[email protected]>
| for name, pinned in ( | ||
| ("transformers", "5.17.0"), | ||
| ("triton", "3.7.1"), | ||
| ("flashinfer-python", "0.6.18.post1"), | ||
| ): | ||
| assert version(name) == pinned, f"{name} {version(name)} != {pinned}" |
There was a problem hiding this comment.
This block hard-asserts exact provider versions (transformers==5.17.0, triton==3.7.1, flashinfer-python==0.6.18.post1), but those exact pins live only in the new [project.optional-dependencies] qwen3-next extra. The base transformers dependency is now the range >=5.13.1,<=5.17.0 and the cuda extra allows flashinfer-python>=0.6.0,<0.7, so any install that does not explicitly request the qwen3-next extra (e.g. pip install -e .[cuda,vllm], or a constraints-free resolve) can legitimately land on a different in-range version and hard-fail this assertion for every PR touching the watched paths, regardless of code correctness. Ensure the install step in this job installs the qwen3-next extra (or otherwise pins these versions) before this assertion runs, otherwise the gate is environment-coupled rather than evidence of the intended runtime.
There was a problem hiding this comment.
Intended. The job installs nothing: it runs on a self-hosted runner that holds the audited Qwen3-Next runtime, and the step is there to fail when that runtime drifts. A different in-range version is a different runtime than the one the evidence was produced with, so failing is the expected result.
Fixed in |
|
|
||
| if not native_tile_stats_available(): | ||
| raise RuntimeError("Qwen3-Next logprob requires rebuilt CUDA tile-stat kernels") | ||
| selected, lse, entropy = CudaVocabParallelLogprobOp().apply_with_entropy( |
There was a problem hiding this comment.
apply_with_entropy is imported from the CUDA backend (CudaVocabParallelLogprobOp in rl_engine/backends/cuda/logprob/vocab_parallel_logp.py), but a repo search finds the method only defined in rl_engine/reference/logprob/vocab_parallel_logp.py. If the CUDA op does not inherit/implement apply_with_entropy (and accept num_vocab_tiles, validate, with_entropy_grad, deterministic), every Qwen3-Next training/rollout logprob call raises AttributeError/TypeError at runtime. Please confirm the CUDA class actually exposes this exact signature before merging.
There was a problem hiding this comment.
CudaVocabParallelLogprobOp subclasses VocabParallelLogprobOp (rl_engine/backends/cuda/logprob/vocab_parallel_logp.py:116) and inherits apply_with_entropy with that signature from rl_engine/reference/logprob/vocab_parallel_logp.py:683. The CUDA class sets use_native_tile_stats to its CUDA tile kernel, which the inherited path calls.
Signed-off-by: Wenbo Ji <[email protected]>
…rovider job, #503 bias grad gate) into #549 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]>
…10-29). Includes Run A/B reports, logs, and operators collection failure bundle for B200 review.
…e (2026-10-29). Run A/B reports, logs, and operators collection bundle under pending/h100-qwen3-next-543-544/.
… evidence. Operators and layers passed; L2 failed on Megatron load_checkpoint signature; timeout reruns attached.
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
Stage
biafter a passedl2, under the same certified provider profile: 97 pinned cells (rl_engine/validation/models/qwen3_next/qwen3_next_bi_cases.py,qwen3_next_bi_manifest.json), compared bitwise on response tokens, BF16 logits, FP32 logprobs, the embedding and every layer, sub-node and state digest.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.
Replay: variable-length THD packing with a traced target.
Reports:
bi-matrix.jsonnames each failing cell's first divergent layer, sub-node and family; the chain report gains abatch_invariancesection.gtest: bitwise judgments compare raw bits (signed zero, NaN/Inf and dtype count) instead of
allclosewith zero tolerance (rl_engine/validation/operators/forward_invariance.py); the dense Qwen3-8B gtest suite still passes.Layout as reviewed on [WS1][CUDA][Qwen3-Next] TP distributed logprob parity: fixed reduction order, selected-token logprob exact across NCCL settings (RFC #428 stack 9/11) #549: the BI runner is
tools/validation/models/qwen3_next/qwen3_next_batch_invariance.py; the BI plot is in the benchmark PR ([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 is a release ZIP.Prior art & reuse decision
N/A for a kernel: this PR adds a test matrix over the providers of #503-#543. The scheduler pinning reuses vLLM 0.30.0's scheduler (
long_prefill_token_threshold, chunked prefill) rather than a custom engine; the cell judgments reuse WS1'sforward_invariancecomparison.Results (B200, TP4, official checkpoint)
One panel per cell family; a cell is green when the target's tokens, logits, logprobs and every layer digest are bitwise equal to its reference (concurrency N = 1 has no "last" position).
preflightlayersl2bi, full suiteThe quick suite (5 cells, including 64 concurrent requests) passed first as calibration. Summary, tested commit and commands:
reports/experiments/qwen3_next/qwen3-next-batch-invariance-b200.md; raw stage records andbi_matrix.jsonZIP (SHA-2569312770b…54634), measured at759755e.Status
c49419ae, on top 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 (85675a74). 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.c49419ae): the four-GPU guards accept four B200, H100 or H200 GPUs, so the H100 run needs no local patch. The full 97-cellbisuite on 4 × H100 at this head has not run yet: at the previous head (81be0811plus the allowance as a patch)preflightstopped inrollout-smokewith the same FlashInfertrtllmall-reduce abort as [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 (preflight-own-head), andbineeds a passed chain up tol2. H200: not available to us.90c09164, 4 × B200): preflight, layers and l2 passed (L2 artifacts bitwise identical to the original chain) and thebiquick suite passed 5/5 cells, including 64 concurrent requests. The full 97-cell suite was then rerun on the same commit: 97 / 97 cells bitwise (13 / 13, 10 / 10, 66 / 66, 8 / 8; no failed cell), raw results ZIP (bi/bi_matrix.json,figure-bi.png), SHA-256cf67f9b7…b1ca.biattempt stopped at artifact assembly because a state-shape check admitted only the four L2 prompt lengths (759755efixes it); every stage was then rerun on the fixed commit.27515f8b); they pass in CI. The launcher/storage runtime is standard-library-only (dfb1cedd).History
c49419ae): the Hopper allowance of the four-GPU guards and [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. Of this PR's own files the merge changesqwen3_next_run.pyandqwen3_next_runtime.py(the guard) and the provider workflow's fork notice, which now passes the PR's repository and SHA throughenvinstead of expanding them in the shell (2b64780b, fromtest-qwennextthrough [WS1][CUDA][Qwen3-Next] MoE route/combine contract with a batch-invariant grouped expert GEMM (RFC #428 stack 5/11) #503).pull_requestpaths were missing Qwen3-Next modules that its checks import; merged [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 additions and addedrl_engine/distributed/algorithms/collectives.py, which the batch-invariance request check reaches through the native rollout (db1eb37f). Workflow-only change; shared infrastructure such asrl_engine/opsandrl_engine/platformsstays out of the filter.349d6ba0. 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] Full-model chain: vLLM rollout vs VIME recompute, raw-bit through two updates and a reload (RFC #428 stack 7/11) #543's new headd243839f, ineb04b15f. One conflict, in the provider workflow's pytest step: [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 now also runs this PR's check modules.Tests
python -m pytest -q tests/models/qwen3_next/test_qwen3_next_bi_cases.py tests/validation/common/test_tensor_identity.py tests/models/qwen3_next/test_qwen3_next_chain_report.py \ tests/models/qwen3_next/test_qwen3_next_evidence_redaction.py tests/validation/operators/test_forward_invariance.py tests/validation/operators/test_gradient_invariance.py python -m pytest -q tests/models/qwen3_next/check_qwen3_next_bi_requests.py # imports vLLM python tools/validation/models/qwen3_next/qwen3_next_run.py --stage bi --previous <l2 run> --bi-suite {quick,full} ...ci.yml+ digest + forward-invariance testscheck_qwen3_next_bi_requests.pyScope
CUDA, TP4 × EP1. The rollout profile caps a cell at 64 requests and 1040 tokens per sequence (prompt 1025 is out of range).
Results (H100 / Hopper, TP4 + batch-invariance CI subset)
Run on validation commit
91b77274plus2a8f18e4. 4 × NVIDIA H100 80GB, torch 2.13.0+cu130, vLLM 0.30.0, NCCL 2.29.7, checkpoint revision9c7f2fbe. Raw data:hopper-qwen3-next/pr544.At the time of this run the four-GPU preflight was gated on B200 (
topology_mismatch: requires exactly four B200 GPUs), so commit2a8f18e4(the Hopper allowance from #557) was applied locally on top of the PR head; nothing else differs. Sincec49419aethe allowance is part of this PR (from #543); the full 97-cell run at the new head is pending (see Status). Build flags:KERNEL_ALIGN_FORCE_SM90=1 KERNEL_ALIGN_DET_GEMM_SM90=1 TORCH_CUDA_ARCH_LIST=9.0. For full-modell2on 4 × H100, local validation commits load Megatron recompute without DDP / optimizer (no giant FP32 grad buffer). These commits are for Hopper evidence only and are not merged upstream; patches are underpr_assets.preflightlayers(all layer and scheduler gates)l2bi(--bi-suite quick, CI batch-invariance matrix)See
chain/.