Repository navigation
[Feat] paged-experts: AWQ, compressed-tensors, MXFP4, NVFP4, W8A8 and block-INT8 experts - #45787
Conversation
… block-INT8 experts New expert formats for paged experts: - on the Marlin runner: AWQ int4, compressed-tensors W4A16/W8A16, compressed-tensors NVFP4 (weight-only), MXFP4 (gpt-oss) and ModelOpt NVFP4; - on the triton runner: compressed-tensors FP8 (per-channel or block, dynamic activations), W8A8 FP8, W8A8 INT8 and block INT8. To support them, paged experts now derives what it needs from the layer instead of naming it per format: the expert tensors are the per-expert parameters (as EPLB finds them), and the runner contract (triton masking or Marlin compaction, and whether the post-load step repacks) follows from the runner the base method builds. A format names only tensors its runner never reads or that serve other runners. The repack runs K experts at a time with the layer's state reset per chunk, and is checked on one extra chunk. Also: - per-expert biases are paged; stacked checkpoint tensors go to the native loader; - the host store starts from the values the base method created, so what a loader leaves unwritten (MXFP4 Marlin padding) matches the GPU; - the gather kernel copies rows of any even size, for NVFP4's 2-byte global scales; - the paged break skips its waves while breakable prefill capture records it, as the routing ids are not computed yet then; warmup and replay run them; - the e2e test gets a gpt-oss-20b MXFP4 case.
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
|
Could we initialize the unused slots in the final For compressed-tensors NVFP4, when I reproduced this in an isolated CPU harness using this PR's
Please fill the unused rows with a valid expert's data, including its quantization metadata, and add a regression test with a non-divisible expert count. The scale validation for real checkpoint experts should remain intact. |
…8A8 and block-INT8 experts Pad a short last repack chunk with real experts. The repack runs the base method's post-load step K experts at a time. In a short last chunk (E % K != 0), the rows past it kept the values the base method created, which are torch.empty for most schemes. A step that validates every row then rejected a valid checkpoint: compressed-tensors NVFP4A16 raised "gate and up projections ... differ" for the unused rows, although every expert's gate and up global scales matched. The rows now hold experts from the start of the store, with all their tensors (weights and scales); they are discarded after the step as before.
|
Thanks, good catch! Fixed. The Regression test |
BBuf
left a comment
There was a problem hiding this comment.
Thanks for the fix! The partial-chunk case now passes the isolated CPU repro, and invalid checkpoint scales are still rejected. Let’s wait for CI.
|
/tag-and-rerun-ci |
|
/rerun-failed-ci |
[Feature] Paged Experts: AWQ, compressed-tensors, MXFP4, NVFP4, W8A8 and block-INT8 experts
Motivation
This PR aims at improving Paged Experts' (#42557) format compatibility. It currently only supports unquantized, block-FP8 and GPTQ experts.
These formats will be supported:
--moe-runner-backend marlin--moe-runner-backend marlin, runs W4A16FP8-dynamiccheckpoints)--quantization w8a8_fp8)--quantization w8a8_int8)Modifications
Derived formats (
formats.py,runners.py). #42557 declares each format by hand: which tensors are loaded and paged, whether the post-load step repacks, which runner contract applies. Adding the five Marlin formats in that style showed it fails silently:_w13_deinterleaved, compressed-tensorsis_marlin_converted), or every chunk after the first stayed in the checkpoint layout;Paged experts now derives these from the layer, as SGLang already does elsewhere (EPLB's
filter_moe_weight_param_global_expert; the runner backend as execution contract):w13_*/w2_*parameter with one row per local expert. Tensors sized for all experts (_sglang_require_global_experts) stay whole on the GPU. Biases, zero points and kernel padding need no code.--moe-runner-backend.supportscheck (8–19 lines), plus anunpagedorfreedtuple for three of them and a runner route for compressed-tensors W4A16.formats.pyis 340 lines for twelve formats (main: 184 for three; the declared version: 389 for eight). The four triton formats were added after the refactor as a test of it; they needed one shared fix, letting the triton contract find a runner held on the layer's scheme.Loading (
method.py):weight_loaderproperty) are redirected through_weight_loader.test_host_store_starts_from_the_created_valuesfails without it.applycalls the kernel directly and sums the top-k outputs.Prefill capture: the paged break skips its waves while a breakable graph captures it (a
capture_stub), since the routing ids are not computed yet then; warmup and replay run them as before. Without it, gpt-oss-20b paged an out-of-range expert id at capture and failed to start.Kernel (
paged_experts.cuh): the gather copies rows of any even byte size (16-, 4- or 2-byte loads). NVFP4 on Marlin keeps one bf16 global scale per expert, a 2-byte row.Runner output: the top-k sum is trimmed to the input's hidden size (MXFP4 Marlin pads it, 2880 → 3072 on gpt-oss-20b).
Accuracy Tests
Repack, byte oracle. The real post-load step on a full layer vs K experts at a time through
_repack: byte-identical in all 8 cases (AWQ; compressed-tensors int4 symmetric, asymmetric, act-order, and int8; compressed-tensors NVFP4 with and without w4a4 input scales; MXFP4).Paged vs unpaged, 4-layer test models (E=32, top-4, K=8; prompt and greedy decode logprobs, without deterministic inference; RTX 5070 Ti):
--quantization w8a8_fp8)Marlin is not batch-invariant, and on SM90+ not run-to-run reproducible, so its formats are judged against controls with one tensor deliberately not paged:
GSM8K (200 questions), RTX 5070 Ti 16 GB:
--moe-runner-backend marlin)Speed Tests and Profiling
Output tok/s, paged, RTX 5070 Ti 16 GB:
Weight load on the Marlin runner grows by the independence check, one extra repack chunk per layer: 32.2 → 37.4 s on Qwen3-30B-A3B-GPTQ-Int4.
CI
test_paged_experts.pygets a fourth case, gpt-oss-20b MXFP4 on the Marlin runner (compared like GPTQ). It covers what no other real checkpoint does: stacked checkpoint tensors, per-expert biases, and padding by the runner (host store init, output trim).openai/gpt-oss-20bis already used by six registered tests.est_timegoes from 360 to 450 s; the 360 s was measured (313 s warm on an H100), the new case's ~90 s is an estimate. Other new coverage: the CPU unit test (23 tests, 15 on main) and the kernel test (2- and 6-byte rows).Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ⏳ Run #39951056279
Latest PR Test (Extra): ❌ Run #39951056293
Latest PR Test (AMD ROCm 10): ❌ Run #39951056248