Skip to content

NVFP4 on the fine-grained machinery - #49779

Draft
IlyasMoutawwakil wants to merge 19 commits into
fg-split/6-mxfp4from
fg-split/7-nvfp4
Draft

IlyasMoutawwakil wants to merge 19 commits into
fg-split/6-mxfp4from
fg-split/7-nvfp4

Conversation

@IlyasMoutawwakil

@IlyasMoutawwakil IlyasMoutawwakil commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

🤗 Transformers CI

What.

  • NVFP4Config and NVFP4HfQuantizer become a block-scaled format. Weights are E2M1 with an E4M3 scale per 16 and an
    fp32 global. This moves NVFP4 onto the shared kernels and loaders that FP8 and MXFP4 already use.
  • NVFP4 checkpoints, transformers saves included, use the ModelOpt key layout. The quantizer reads it per expert
    (GLM-5.2-NVFP4) and stacked per layer (vLLM).
  • The gate and up globals fold through FineGrainedWeightGlobals. A gate|up stack keeps one global, so the up ratio
    moves into the down global.
  • A weight-only checkpoint refuses quantized activations. It has no input_scale to run them with. The check is
    skipped when the load dequantizes, since a dequantized model runs no activation format.
  • NVFP4Config keeps main's positional modules_to_not_convert, so existing callers keep working.
  • The frozen integrations/nvfp4.py stays importable, with a FutureWarning. It goes in v5.25.
  • MuseSpark's input-scaled RMS norm fuses into the kernels' MoE chain. It scales by (1 + weight) and rounds to
    bf16 before the norm, so it gets its own kernel name. tiny-random-Muse-Spark-NVFP4 is its first user.

Behaviour change. A pre-quantized NVFP4 checkpoint on CPU dequantizes instead of raising.

Depends on. #49778.

How tested. tests/quantization/nvfp4, the NVFP4 tests
in tests/kernels and tests/integrations/finegrained, mixed FP8/MXFP4/NVFP4 plans, Qwen4-exp.

The comments and docstrings that say why each change exists are there for readability. Feel free to ask for any of them to go if it's self-evident.

🤖 Generated with Claude Code

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@IlyasMoutawwakil
IlyasMoutawwakil removed this pull request from stack #49781 October 20, 2026 13:41
@IlyasMoutawwakil IlyasMoutawwakil changed the title NVFP4 on the fine-grained machinery, with the producers' NVFP4 exports NVFP4 on the fine-grained machinery Oct 20, 2026
@IlyasMoutawwakil
IlyasMoutawwakil removed this pull request from stack #49788 October 20, 2026 16:25
IlyasMoutawwakil and others added 18 commits October 23, 2026 13:34
… NVFP4 exports

- NVFP4Config / NVFP4HfQuantizer become a block-scaled format: E2M1 weights
  with E4M3 group-16 scales and an fp32 global (two-level), in both modelopt
  layouts (per expert, stacked per layer) and compressed-tensors'; the gate|up
  halves' globals fold through FineGrainedWeightGlobals; a weight-only
  checkpoint refuses quantized activations; integrations/nvfp4 is frozen.
- shared_gate_up_activation_global: share the experts' gate_up activation
  global (max over all experts or over the rank's).
- The modelopt and compressed-tensors readers learn NVFP4 (incl. modelopt
  MIXED_PRECISION plans across formats).
- MuseSpark: its input-scaled RMS norm fuses into the kernels' chain, and its
  TP plan keeps experts with a post-expert norm whole.
- Tests: the NVFP4 suite, the producer readers and skip-lists, the NVFP4
  marshalling and conversion tests, mixed FP8/MXFP4/NVFP4 plans.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sion plans

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing imports it. It was single-device, not serializable, and no checkpoint shipped its layout.
Its lazy exports and its hub kernel entry go with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A weight-only checkpoint then needs activation_format="bf16" in a passed config, unless the load dequantizes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…zzle

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It shipped in v5.16 to v5.19, so its names warn and go in v5.25 instead of breaking now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MuseSpark's norm declares fused_norm_kind, so the shared integration no longer imports a model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…roducer readers' PR

NVFP4 keeps its own key layout, the ModelOpt one that transformers saves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: muse_spark, qwen4_exp, finegrained, nvfp4

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.

2 participants