Repository navigation
FP8 on the fine-grained machinery (Fp8Config) - #49777
Draft
IlyasMoutawwakil wants to merge 22 commits into
Draft
IlyasMoutawwakil wants to merge 22 commits into
IlyasMoutawwakil wants to merge 22 commits into
Conversation
IlyasMoutawwakil
force-pushed
the
fg-split/5-fp8
branch
from
October 20, 2026 11:08
15bcb87 to
551185c
Compare
IlyasMoutawwakil
force-pushed
the
fg-split/5-fp8
branch
from
October 20, 2026 11:20
551185c to
4a0d371
Compare
|
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
force-pushed
the
fg-split/5-fp8
branch
from
October 20, 2026 13:33
4a0d371 to
1f9a2f6
Compare
This was referenced Oct 20, 2026
Merged
IlyasMoutawwakil
force-pushed
the
fg-split/5-fp8
branch
4 times, most recently
from
October 20, 2026 16:04
0d8d517 to
8d50a39
Compare
IlyasMoutawwakil
force-pushed
the
fg-split/5-fp8
branch
from
October 20, 2026 16:25
8d50a39 to
ef5e58c
Compare
IlyasMoutawwakil
force-pushed
the
fg-split/5-fp8
branch
from
October 20, 2026 16:43
ef5e58c to
c39d6ae
Compare
IlyasMoutawwakil
force-pushed
the
fg-split/5-fp8
branch
from
October 20, 2026 17:34
c39d6ae to
cd37228
Compare
IlyasMoutawwakil
force-pushed
the
fg-split/5-fp8
branch
2 times, most recently
from
October 20, 2026 22:57
bc2c991 to
e3a43ca
Compare
IlyasMoutawwakil
force-pushed
the
fg-split/5-fp8
branch
from
October 23, 2026 13:03
2eb3538 to
d16a8c0
Compare
- Fp8Config / Fp8HfQuantizer: FP8 weights with fp32 or UE8M0 scales over blocks or the whole tensor, dynamic or calibrated (static) activations; quant_method="fp8" now routes here. - FP8 embedding tables (modules_to_convert): FineGrainedEmbedding, one per-tensor scale each, also under FineGrainedConfig. - The modelopt and compressed-tensors config readers, registered for the producers' FP8 exports, with their producer layouts. - FineGrainedFP8Config is deprecated: passed explicitly it still loads through its own frozen integration; finegrained_fp8 warns that it is frozen. - The Mistral conversion scripts swap modules through the quantizer. - Tests: the FP8 suite (config, quantize op, chains, quantizer, tiny checkpoints, load-path equivalence under TP/EP), the shared fine-grained tests that need a real format, and the testers' FP8 fixtures. The machinery tests against the test-only formats are superseded and removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Restore the legacy kernel tests and `FP8LinearTest`, and drop the import-time warning of the frozen module. The block-FP8 routing test moves to the `fp8` suite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A linear whose shape does not tile the block became an FP8Linear but kept its uninitialized scale, which made the ue8m0 round-trip test flaky. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rnel The Hub kernel now reads the right scale for interleaved gate|up rows (kernels-community/finegrained-kernels#1253), so the old slice recorded the bug. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n format Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Block-FP8 gate|up are interleaved on SM100 only, so the tests that check interleaving pin SM100, and a switch of experts implementation after load now works. 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>
A loaded table kept an fp32 scale in a bf16 model, so its rows came out fp32 and the next linear raised. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ror messages The host finds embedding tables with module_kind, as replacement does. FineGrainedEmbedding checks the method enum. plan_from_config_groups only has internal callers, so it is private. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FineGrainedConfig drops modules_to_convert, which never shipped. A targeted entry opts a table in, so the plan alone says which modules quantize. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nfig hook DeepseekV4Config moves its experts' dtype and its scale names into its quantization config. The fp8 reader then picks the integration. PreTrainedConfig needs no adapt hook for one model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s_to_convert - read_fp8 turns a checkpoint's modules_to_convert into per-tensor table entries. - The host gives each member the patterns that name its modules, dtype_plan_targets. A block-scaled member converts the embeddings they name. - The block-scale rename leaves out every embedding, so a member needs no other member's tables. - A reader's skip-list becomes None entries of the plan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
They come back at the top of the stack, for every format at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the fly a passed Fp8Config quantizes the experts to FP8 too. The model config's expert_dtype describes DeepSeek's own checkpoints, so it no longer turns a saved FP8 model into MXFP4 experts on reload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
IlyasMoutawwakil
force-pushed
the
fg-split/5-fp8
branch
from
October 23, 2026 13:35
d16a8c0 to
516802b
Compare
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: deepseek_v4, glm_moe_dsa, ministral3, mistral4, qwen4_exp, finegrained, finegrained_fp8, fp8 |
1 of 6 tasks
This was referenced Nov 16, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why.
Fp8ConfigandFp8HfQuantizer: FP8 weights with fp32 or UE8M0 scales over blocks or the whole tensor, withdynamic or calibrated activations.
quant_method="fp8"routes here. This is the first format on the machinery ofFine-grained block-scaled quantization: the shared machinery #49776. MXFP4, NVFP4 and MXFP8 follow in 🚨 MXFP4 on the fine-grained machinery, and DeepSeek-V4's FP8 + MXFP4 plan #49778, NVFP4 on the fine-grained machinery #49779 and MXFP8 on the fine-grained machinery (
Mxfp8Config) #49780.Qwen4Exp's ~95 GiB
ple.ple_embedding.ngram_embedding(main code). Itsweight_scaleis replicated under TP, sincea
(1,)scale cannot follow a vocab-sharded table.FineGrainedConfig(dtype_plan={"ngram_embedding": Fp8Config(weight_block_size=None), ".*": Fp8Config()}). The catch-all never covers an embedding.read_fp8reads an FP8 checkpoint'smodules_to_convert, the dialect of main'sFineGrainedFP8Config, into sucha plan. So
Fp8Confighas nomodules_to_convert.dtype_plan_targets, the patterns that name its modules. A block-scaled memberconverts the embeddings they name. The block-scale rename leaves out every embedding.
read_fp8. A reader turns a checkpoint'squantization_configinto theconfigs that load it. ModelOpt and compressed-tensors exports come in Load ModelOpt and compressed-tensors exports on the fine-grained formats #49823, for every format at once.
CHECKPOINT_READING_CONFIG_TYPES: a passed config of these types reads the checkpoint's config as its own class.FineGrainedFP8Configreads only FP8 checkpoints, not MXFP4 or NVFP4 ones.FineGrainedFP8Configis deprecated when built. Passed explicitly, it still loads through its frozenintegration.
from_dictdoes not warn, so checkpoints that still map to it load quietly."mxfp8"keeps thatmapping and
from_configroutes it by type to the frozen quantizer until MXFP8 on the fine-grained machinery (Mxfp8Config) #49780.(576, 7168)kv_a_proj_with_mqahas one. Before, the save left it unquantized and the load raised on the scale grid.read_fp8readstheir
checkpoint_format: "deepseek"asFineGrainedFP8Config.DeepseekV4Config.__post_init__puts that layoutname, and V4's
expert_dtype, into the quantization config it loads with. A config transformers saved names itsown layout, so it stays as saved: an FP8 model quantized on the fly reloads as FP8.
by
Fp8Config.Depends on. #49776.
How tested.
AdaptQuantizationConfigTestintests/quantization/test_quantizers_utils.py,tests/quantization/fp8and the shared fine-grained tests that need a real format. The legacy suite(
tests/quantization/finegrained_fp8,tests/kernels/test_finegrained_fp8.py) stays while the legacy path ships.Slow tiny checkpoints:
RUN_SLOW=1 pytest tests/quantization/fp8 -k "Tiny or Checkpoint".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