Skip to content

Add native MXFP8 QAT and shared weight rounding - #4095

Open
nxphi47 wants to merge 2 commits into
exp/v7-fp8-qat-b300from
feat/mxfp8-qat-sr
Open

nxphi47 wants to merge 2 commits into
exp/v7-fp8-qat-b300from
feat/mxfp8-qat-sr

Conversation

@nxphi47

@nxphi47 nxphi47 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Add native MXFP8 QAT for dense/grouped projections and routed experts. Forward uses DeepGEMM per-32 MXFP8 GEMMs; backward uses BF16 GEMMs with the forward-rounded weights for input gradients and original BF16 activations for weight gradients.

Add deterministic Triton stochastic weight rounding keyed by step, tensor identity, and global expert offset. Reuse the same weight sample for backward and activation-checkpoint replay. Activations remain nearest-rounded. The vLLM compatibility patch uses that same per-32 cast only in online dense/expert weight loading, including checkpoint reload; serving draws fresh streams independently from training. Add explicit configuration and reject incompatible blockwise-FP8 options for MXFP8.

Stacked on #4092. The kernel submodule pins PrimeIntellect-ai/prime-kernels#19; the release wheel does not yet include MXFP8, so the pinned kernel source must be installed using the repository's source-build workflow.

Validation completed:

  • 14 kernel tests, 25 MXFP8 trainer tests, 17 existing FP8-rounding regression tests, and 2 inference-cast tests passed.
  • Three distributed tests passed on two GPUs, covering FSDP, split-token inputs, and expert shards.
  • Real vLLM dense/MoE model loading, generation, and layerwise checkpoint reload passed for RN and SR; 22 weight casts were checked on each initial load and again on each reload.
  • Lint and whitespace checks passed.

Draft pending full-model integration validation. Optimizer and reduction dtypes are unchanged.

@nxphi47
nxphi47 marked this pull request as ready for review October 14, 2026 19:43
mikasenghaas added a commit that referenced this pull request Oct 14, 2026
The MXFP8 part of #4095 (stacked on #4092 @ 8b7f7eb) on main, without the
blockwise FP8 QAT and FP8 stochastic-rounding work it is stacked on:

- MXFP8 QAT for dense projections and routed experts: DeepGEMM per-32 MXFP8
  forward, BF16 backward that reuses the forward-rounded weight for input
  gradients and the BF16 activations for weight gradients.
- Deterministic stochastic weight rounding keyed by optimizer step, logical
  weight and global expert index, so FSDP shards, CP token splits, expert
  shards and activation-checkpoint replay all draw the same weight sample.
- inference.mxfp8_stochastic_weight_rounding: vLLM's online MXFP8 loader casts
  weights with the same per-32 stochastic cast; activations stay nearest.
- deps/prime-kernels at prime-kernels#19 (680681711) for the Triton per-32
  MXFP8 quantizer. Its release wheel does not ship it yet: install from source
  with PRIME_KERNELS=mxfp8.

Co-authored-by: Phi <phi@primeintellect.ai>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant