Two fixes to FlashInfer's b12x W4A16 MoE kernels
- Date
- Lane
- L1Desk-scale inference
- Kind
- Upstream
- Preregistration
- Not preregistered
- Authors
- Stephen J. Ronan, MD, RonanLabs
- Receipts
- 1 linked sources
Summary
FlashInfer merged two of our fixes to the experimental b12x W4A16 MoE path: one stops unrouted (-1) routes from adding garbage rows, the other re-biases the MXFP4 scale exponent so low-scale weights no longer underflow and silently drop rows.
Headline numbers
0.99999
Cosine vs reference with unrouted (-1) routes, after PR 6294
On main8 of 8 failed
With PR 62948 of 8
New test, 8/8 cases pass; on main 8/8 fail (all-NaN, or cos 0.29); GeForce RTX 5080, SM120
91of 1,629 rows
MiMo-V2.6-Pro layer 1 rows below cosine 0.999 before PR 6317; 0 after
Below cosine 0.999 before PR 631791 rows
After0 rows
Scale: 0 to 1,629 rows
Real MXFP4 checkpoint, RTX PRO 6000 Blackwell, same code in standalone b12x
The problem
We run a W4A16 expert sidecar on an RTX PRO 6000 Blackwell next to two DGX Stations, using the b12x SM120 MoE kernels from Local Inference Lab, which are now part of FlashInfer. Two bugs in the experimental b12x W4A16 path turned up there. Both PRs were merged on 2026-10-28.
Fix 1: unrouted routes (PR 6294)
PR 6294 fixes issue 6293. Our sidecar sends -1 for every route it does not own. On the route-packed path, FC2 never writes rows for those slots, but the map-free branch of W4A16TopKSumKernel still summed every slot. With NaN bytes in the scratch buffer the output was all NaN. With zeroed scratch, cosine against the reference fell to about 0.29.
The fix reads the route id in the map-free sum and skips ids below zero, the same "negative id means not routed" contract FlashInfer already uses elsewhere. The new test fails 8 of 8 cases on main and passes 8 of 8 on the branch at cos 0.99999. We first hit it at DeepSeek-V4-Pro shapes, but the issue shows it does not depend on shape.
Fix 2: scale underflow (PR 6317)
PR 6317 fixes issue 6316. On the BF16 path with MXFP4 weights, the kernel kept nonzero weights in normal BF16 range only for E8M0 scale bytes 121 to 247. Real checkpoints sit at about 100 to 130. MiMo-V2.6-Pro's early MoE layers use bytes 111 to 117, so some rows lost part or all of their expert contribution, with no NaN or Inf. The aggregate cosine could still read 0.99999, which is why the existing tests never caught it.
The fix changes the scale bias from 7 to 71, the compensation from 2^119 to 2^55, and the scale-byte clamp from 247 to 183. Weights are now normal BF16 for bytes 57 to 183, with no added instructions. On MiMo-V2.6-Pro, layer 1 went from 91 of 1,629 rows below cosine 0.999 to 0. End to end in vLLM, the issue reports 33,574 rows below 0.999 before the fix and 0 after.
This bug cost us a number. Our first full-precision MiMo run read 107.5 and failed its quality check on long prompts, and we withdrew it (write-up).
Status
Both PRs are merged. The FP16 activation path has the same class of scale problem and was left for a follow-up. A smaller FC1 limit below about byte 104 also remains, outside every checkpoint we have measured.