Repository navigation
[WS1][CUDA][MiniMax-H3] token_refiner_block: two refiner blocks over the strict operator rows (RFC #420 stack 4/7) - #570
Conversation
|
Warning Review limit reachedThis review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry. Next included review available in 59 minutes. View limit details
|
b9e6b1c to
67af796
Compare
…fixed-order Triton GEMM Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit 650e2148c6f0e5dcdef136537e0e62f745020273) Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit d099c0b)
Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit b41f868)
…il-closed test instead of a skip Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit 74e5b83)
…l keys Review finding (RL-Align#568): jointly permuting x and g changed dW/dbias because the token axis was reduced in call order. All projection ops (audio in/out, text context, Q/K/V) now take an optional logical_keys [T,2|3] (negative first column = padding); rows are reduced in ascending key order with padding dropped, active keys must be unique. Key format follows RL-Align#562. Adds the reviewer's repro plus permutation/padding tests for every row and Q/K/V. Co-authored-by: Yitao Wang <[email protected]> Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit d2941f0)
…ready ordered rows Follows the canonical-row design of RL-Align#562: the Q/K/V node of the block graph supplies (batch row, position) keys so its dW is reduced in logical order, and rows that already arrive in canonical order are reduced in place (same bytes, no gather of x and g). Co-authored-by: Yitao Wang <[email protected]> Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit 0da0583)
…pull request Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit eaba5efe3df971ea9d1a969f53e48f09e09ed176) Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit 7da0574)
Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit b45190d08fc033c7e63ad821d3918eb32dd454f6) Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit b5536d6)
Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit ad1925045b522772bf56f8468b23cca47f04156b) Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit f9041e8)
Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit b44540e)
…ody) Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit eab901b)
… weight loader, tests, doc Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit d12a6bb26566fae58a309e76916af9aae767d487) Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit b316869)
Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit 1e3a2ea)
Signed-off-by: Wenbo Ji <[email protected]> (cherry picked from commit 67af796)
…age import Signed-off-by: Wenbo Ji <[email protected]>
67af796 to
6de320d
Compare
…#570 Add a sanitized JSON replay of all six accuracy-test swiglu nodes on Hopper, with a cross-device reference to the B200 block=1/257 bound failure.
…#567 RL-Align#568 RL-Align#570 RL-Align#571 RL-Align#574 RL-Align#575 Test summaries (tests.json), runner outputs and figures measured on NVIDIA B200 (sm100), driver 580, CUDA 13.0, torch 2.13.0+cu130, MiniMax-H3@42ed227, clean trees at the PR heads eab901b, 3cf51bf, 6de320d, eb7840b, af3dcae and 4f7c5d1. Figures use B200 axis labels. No host names, paths or scheduler identifiers. Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
|
🔍 OpenCodeReview found 5 issue(s) in this PR.
📄
|
| @@ -0,0 +1,2346 @@ | |||
| { | |||
| "status": "frozen_ensemble_rule", | |||
| "rule": "relative_l2 <= k * max over provider configurations + floor; max_abs reported", | |||
There was a problem hiding this comment.
The declared rule references a floor that is never recorded in this file, and the stored bounds actually use two different implicit floors. Verifying every entry against factor_k = 2.6:
- forward node outputs use floor = 0.001:
nodes.block.00.007637028339181236 × 2.6 + 0.001 = 0.020856273681871214 ✓;nodes.audio_proj_in0.0 × 2.6 + 0.001 = 0.001 ✓;nodes.time_embedder0.0 → 0.001 ✓ - gradients / parameters use floor = 0.005:
nodes.block.0.grad0.8528404577370075 × 2.6 + 0.005 = 2.2223851901162193 ✓;parameter.norm_out.norm.weight0.011882855956542197 × 2.6 + 0.005 = 0.03589542548700971 ✓;input_gradients.audio_hidden_states0.20277222521992394 × 2.6 + 0.005 = 0.5322077855718023 ✓
So a consumer that reconstructs a bound from factor_k alone, or that assumes a single global floor, will disagree with bounds_relative_l2 on essentially every entry (nodes.block.* and any 0-valued forward node are off by 0.001; every .grad/parameter.*/input_gradients.* entry is off by 0.005), and the reconstructed check will accept/reject the wrong values. The floors must be recorded explicitly (and the rule string updated) so the frozen artifact is self-describing.
Suggestion:
| "rule": "relative_l2 <= k * max over provider configurations + floor; max_abs reported", | |
| "rule": "relative_l2 <= k * max over provider configurations + floor; max_abs reported", | |
| "floor_forward": 0.001, | |
| "floor_gradient": 0.005, |
|
@fusheng-ji The automated OCR review has completed. Please review and address all automated review bot findings, then push your updates. Maintainers will begin manual review after the bot findings have been addressed. |
|
please resolve conflicts first ,thx! @fusheng-ji |
…o feat/h3-projection-rows Signed-off-by: Wenbo Ji <[email protected]>
Signed-off-by: Wenbo Ji <[email protected]>
RL-Align#588) into feat/h3-token-refiner operator_trace.py and h3-operator-trace.md: take the merged RL-Align#567 version and reapply this branch's refiner stage on top. Signed-off-by: Wenbo Ji <[email protected]>
record_node filled the accumulator in from the row contract, and trace_call_from_resolution and the default split policy did the same, so a trace from block_observer always passed those checks: a run that accumulated in BF16 or used split-K would still verify as strict. They are now recorded only when the caller supplies them; an unset value is "not observed" and violations reports it. block_observer only learns the node name, so it also records the fallback state as not observed (None). violations(require_observed=False) and verify --allow-unobserved check the bindings alone, by explicit request; such a trace is not strict evidence. Reported by OpenCodeReview on RL-Align#567 after it merged. Signed-off-by: Wenbo Ji <[email protected]>
| topology: Mapping[str, Any] = field(default_factory=dict) # e.g. {"tp": 4, "cp": 2, "sp": True} | ||
| shapes: tuple[tuple[int, ...], ...] = () # input shapes, when known | ||
| fallback: bool = False # True if any fallback path was taken | ||
| fallback: bool | None = False # True if any fallback path was taken; None: not observed |
There was a problem hiding this comment.
The type now admits None ("nobody observed it"), but the constructor default is still False. OperatorCall instances created without an explicit fallback — e.g. record_node(path, status=..., backend=...) in the new tests, direct OperatorCall(...) construction, or a loads/from_dict path that omits falsy fields — therefore assert "no fallback taken" even though no operator reported anything. violations() then skips the fallback not observed branch, so the strict gate passes on an unobserved state, which is exactly what the change is meant to prevent. Make the unobserved state the default so only an explicit report can claim False:
fallback: bool | None = None # True if any fallback path was taken; None: not observedand confirm to_dict/loads round-trips None distinctly from False (otherwise a replayed trace silently claims an observed no-fallback).
There was a problem hiding this comment.
Fixed in #699, commit ff395298.
- Default:
OperatorCall.fallbacknow defaults toNone(not observed). Only an explicit report can claimFalse, andrecord_noderecordsfallbackonly if it is given. - Strict gate: an unrecorded fallback now fails
violations()with "fallback not observed". - Round trip:
Nonesurvivesdumps/loadsas distinct fromFalse. A dict written without the field reads back asNone.
The assertions are in test_h3_operator_trace.py.
…Align#574) into feat/h3-ws2-parallel Signed-off-by: Wenbo Ji <[email protected]>
What
Depends on #568 (projection rows) and, through it, #586 → #587 → #588 (the foundation).
token_refiner.blocks.0/1, 14 nodes each, no AdaLN, no RoPE, thenfinal_norm) as a node graph inh3_refiner.py, with forward and backward,provider and FP64 golden replays, and the same per-node comparison harness as the transformer block.
h3_rmsnorm,h3_qkv_gemm) or staysinterimfor rowsother contributors own (attention, SwiGLU, O / gate_up / down).
token_refinerstage;h3_weights.load_h3_tensorsreads real tensors from the sharded checkpoint.fingerprint.REFINER_NODES(checked by a test).Prior art & reuse decision
diffusers
MiniMaxH3TokenRefineris the reference graph; vLLM-Omni reuses its generic block, so there is no separate fused implementation to adopt. No new kernel is written here.Decision: compose existing rows; do not re-implement attention or the FFN GEMMs.
Results (H100 / Hopper)
Hopper pytest summary:
tests.json(132 collected, 132 passed @6de320dc, H100 sm90).Hopper test gate (PR head
6de320dc):test_h3_token_refiner.pyand the stacked files in Tests below — 132/132 pass on H100 pertests.json(includingtest_nodes_accuracy_repeat_batch_and_isolated[1-257]/swiglu). The six-case chained bound matrix isswiglu_tolerance_matrix.json(candidate ~0.0121 at block 1 / 257 tokens; provider chain matches on H100).Measured on NVIDIA H100 (93 GiB, sm90), driver 580, CUDA 13.0, torch 2.13.0+cu130, pinned
MiniMax-H3@42ed227weights, at head17d0e9e9(forward path unchanged, numbers not re-measured). Real block-0 weights, one block, forward.Numbers:
report.json. Repeat and batch invariance hold at every node. The first node that differs from theprovider is the
attentionnode. The time gap is almost entirely the interim bindings of rows other contributors own; the nodes this PR and the projection rows add are within about 2x of the provider.Results (B200 / Blackwell) — supplementary, not Hopper acceptance
Measured on NVIDIA B200 (179 GiB, sm100), driver 580.126, CUDA 13.0, torch 2.13.0+cu130, pinned
MiniMax-H3@42ed227weights, clean tree at6de320dc.One test fails on B200.
test_h3_token_refiner.py::test_nodes_accuracy_repeat_batch_and_isolated[1-257](block 1, 257 tokens), at theswiglunode: the candidate chain's relative error against the FP64 golden is 0.01211 and the bound is1.25 x provider + 1e-3 = 0.01116, with the provider at 0.00816. Result of the test file: 131 passed, 1 failed (132 collected);tests.json. The bound was not changed. On H100 the same case passes (candidate and provider chains both 0.012117; the six-case matrix isswiglu_tolerance_matrix.json).What a diagnostic on the B200 showed (separate runs, not part of the result above):
swigluerror is the same on both devices (0.01211 on B200, 0.012117 on H100); what differs is the provider chain (0.00816 on B200, 0.012117 on H100), which lowers the bound.swiglukernel is not less accurate than the provider: given the same input its error equals the provider's (0.00816), and on random BF16 input against FP64 it is more accurate (0.0017 against 0.0024) because it rounds once after FP32 math where the provider rounds twice.ffn_gate_upis equal for both chains (0.00818) andswigluis 0.01211 (candidate) against 0.00816 (provider). The direction is not systematic: block 0 with 257 tokens has the candidate below the provider (0.00829 against 0.01081) on the same device.Forward time of one refiner block (
report.json):Repeat and batch invariance hold in every case (
first_repeat_driftandfirst_batch_driftare none); the first difference from the provider is the interimattentionnode, as on H100.Status
e2db5d42. The branch merges the reworked [WS1][CUDA][MiniMax-H3] ws1_one_h3_block: block 0 node-by-node replay and diagnostics (RFC #420 stack 10a/10) #586 → [WS1][CUDA][MiniMax-H3] full-model qualification: thresholds, ensemble rule and reference manifest (RFC #420 stack 10b/10) #587 → [WS1][CUDA][MiniMax-H3] generation gate: 50-block generation compare and resume check (RFC #420 stack 10c/10) #588 base (carrying the review fixes of [WS1][CUDA][MiniMax-H3] timestep_sinusoid_h3: FP32 timestep features + shared H3 harness (RFC #420 stack 1/10) #483–[WS2][CUDA][MiniMax-H3] sp_norm_adaln: sequence-parallel norm/AdaLN/gated residual, byte-equal to WS1 (RFC #420 stack 9/10) #494 attest-h328894da1); this PR's own diff against [WS1][CUDA][MiniMax-H3] projection rows: audio in/out, text context and QKV on a fixed-order GEMM (RFC #420 stack 2/7) #568 is unchanged.pr_assets@ed888b31. Blackwell (B200) below is supplementary and is not a Hopper merge blocker.Hopper (merge gate): graph vocabulary pinned to the fingerprint; forward and backward on real weights; repeat/batch invariance on H100; refiner pytest 132/132 pass on H100 at head
6de320dc.B200 (supplementary): 131/132 pytest pass; one chained-graph
swiglubound fail (provider chain lower than on H100, not a worse candidate kernel — seeswiglu_tolerance_matrix.json). No bound was widened; not treated as blocking Hopper review.History
feat/h3-projection-rows), which is synced to [WS2][CUDA][MiniMax-H3] sp_norm_adaln: sequence-parallel norm/AdaLN/gated residual, byte-equal to WS1 (RFC #420 stack 9/10) #494's head and totest-h3after [WS1][CUDA][MiniMax-H3] timestep_sinusoid_h3: FP32 timestep features + shared H3 harness (RFC #420 stack 1/10) #483–[WS1][CUDA][MiniMax-H3] h3_rmsnorm: RMSNorm with fused AdaLN modulation (RFC #420 stack 5/10) #487 merged. Merge commits only, no force-push; every commit is signed off. The set of lines this PR adds over its parent is identical to the previous head (checked line by line).end-of-file-fixerandblack(24.4.2, the pinned version) failed on two files inherited fromtest-h3(reports/experiments/h3-sigma-schedule/benchmark-4090d.json,rl_engine/_C.pyi); both are fixed once at the bottom of the stack and merged up.pr_assetscommits pinned in earlier versions of this body no longer exist (that branch's history was rewritten); the links now point at the current commit that holds the same files. Only the commit id changed; numbers and the commits they were measured at are unchanged.Tests
python -m pytest tests/models/minimax_h3/test_h3_token_refiner.py tests/models/minimax_h3/test_h3_operator_trace.py \ tests/models/minimax_h3/test_h3_arch_fingerprint.py tests/models/minimax_h3/test_h3_projection_rows.py \ tests/models/minimax_h3/test_h3_one_block.py -q # 126 passedB200: same files, 131 passed, 1 failed (see Results (B200 / Blackwell)).
Measured on the synced branches (2 × NVIDIA RTX PRO 6000 Blackwell, sm120, pinned
MiniMax-H3@42ed227weights incl. block 0, each build compiled in place from the checked-out commit):672c1b36(#575, the top of this chain, contains this PR)pytest tests/models/minimax_h3672c1b36pytest tests/models/minimax_h3 tests/build tests/runtime/test_dispatch.py tests/validationSkips are environment only: no
matplotlib,diffusersorsglang; tests that need 4 or 8 GPUs (2 were visible); no full-transformer shard index; noVERL_OMNI_PATH. TheKERNEL_ALIGN_USE_FAST_MATH=1build was not run on these heads. The per-device results under Results were measured at the heads named there, before this sync.H100 (sm90) on the synced head
e2db5d42(evidence:tests.json, environment header and the raw pytest logs). H100-94GB, driver 580.173.02, CUDA 13.0, torch 2.13.0+cu130, triton 3.7.1, Python 3.12, pinnedMiniMax-H3@42ed227weights incl. block 0, 4 GPUs visible, extension built in place from this commit:pytest tests/models/minimax_h3 tests/build tests/runtime/test_dispatch.py tests/validationKERNEL_ALIGN_USE_FAST_MATH=1The one default-build failure is
tests/validation/operators/test_ws1_candidate_evidence.py::test_ws1_cuda_and_triton_candidate_runtime_provenance: it asks for the strict SM90 GEMM and this build was made withoutKERNEL_ALIGN_DET_GEMM_SM90=1("refusing naive fallback"). It fails the same way on the other test machine and is not an H3 test. The fast-math build has the same failure plusTestCuda::test_unsupported_device_is_refused_at_constructionintests/models/minimax_h3/test_h3_final_adaln_out.py(#489): with the H3 kernels excluded, the op constructor raises "rl_engine._Clacks the h3_det_linear_* / h3_rmsnorm_* ops" before the SM80 check the test expects. Default-build skips (6): the 8-GPU cases (4 GPUs here),sglangnot installed, ROCm-only, CI-only extension enforcement, and the SM90 log-prob backend not compiled; fast-math skips (611) are the H3 kernel tests the build leaves out.Scope / Known limitations
Evidence priority: maintainers reviewing RFC #420 on CUDA should use H100 sections and JSON under
pr_assets@ed888b31. B200 numbers document sm100 behaviour only.Strict mode is fail-closed: no TF32, no fast-math, no split-K; FP32 accumulation with one final rounding; unsupported shapes, dtypes and devices raise instead of falling back. Not part of this PR: video projections (#562), O / gate_up / down GEMMs (#554, #535), full attention (#553), ROCm, SGLang adapter, pipeline parallel. Replacing the interim bindings is tracked by those rows.