Skip to content

feat(quant): load ModelOpt MIXED_PRECISION (NVFP4 + FP8) checkpoints such as nvidia/Qwen3.6-35B-A3B-NVFP4 #3201

Done

Description

@Jaeyeong-CHOI

Problem / Background

Most of NVIDIA's own NVFP4 releases on the Hub are not plain NVFP4 but ModelOpt MIXED_PRECISION: some linears are NVFP4 and the rest FP8. mlxcel repacks ModelOpt NVFP4 / W4A16_NVFP4 and deliberately leaves the other algorithms alone (other_modelopt_algorithms_are_not_repacked_as_nvfp4 in src/models/sanitize_tests.rs), so these checkpoints do not load. I am filing this to ask whether support is wanted and which target format you would prefer, before writing anything.

quant_algo of the nvidia/*NVFP4* repositories by downloads (Hub API, 2026-11-22), with the ones that fit a 128 GB machine marked:

Repository Downloads Size model_type quant_algo
nvidia/Qwen3.6-35B-A3B-NVFP4 3.9 M 23.5 GB qwen3_5_moe MIXED_PRECISION
nvidia/Gemma-4-26B-A4B-NVFP4 1.8 M 18.8 GB gemma4 NVFP4 (#3197)
nvidia/Gemma-4-31B-IT-NVFP4 0.97 M 32.7 GB gemma4 NVFP4
nvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-NVFP4 0.88 M 21.6 GB nemotron_h MIXED_PRECISION
nvidia/Qwen2.5-VL-7B-Instruct-NVFP4 0.70 M 7.2 GB qwen2_5_vl NVFP4 (loads since #3166)
nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-NVFP4 0.63 M 19.4 GB nemotron_h NVFP4
nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-NVFP4 0.50 M 80.4 GB nemotron_h MIXED_PRECISION
nvidia/Qwen3.8-27B-NVFP4 0.33 M 21.9 GB qwen3_5 MIXED_PRECISION
nvidia/Qwen3.6-27B-NVFP4 0.09 M 21.9 GB qwen3_5 MIXED_PRECISION

The larger ones (GLM-5.3, DeepSeek-V4-Flash, DeepSeek-V4.1-Flash, Qwen3.8-Flash-Next, Qwen3.5-397B-A17B, MiniMax-M3, the Nemotron Ultra / Puzzle / Super-VL models) are MIXED_PRECISION as well. Third-party exports follow: ornith-ai/Ornith-1.5-9B-NVFP4 (1.15 M downloads) and PhaniPendela/Qwen3.5-4B-W4A16-NVFP4.

Current Behavior

main @ d6ef843, Linux + CUDA (GB10), mlxcel generate:

Error: Failed to load Qwen3.5 text model: Unsupported packed weight: model.layers.0.linear_attn.in_proj_qkv.weight is uint8 with model.layers.0.linear_attn.in_proj_qkv.weight_scale; this dense linear loader cannot decode it. …

The same for nvidia/Qwen3.6-35B-A3B-NVFP4 @ 1355db6a0, ornith-ai/Ornith-1.5-9B-NVFP4 @ 155f200d8 and PhaniPendela/Qwen3.5-4B-W4A16-NVFP4 @ 8fba45034. The first linear the loader meets is an FP8 one.

What the files hold (safetensors headers of the three checkpoints above):

  • hf_quant_config.json has "quant_algo": "MIXED_PRECISION" and a quantized_layers map with one entry per linear: {"quant_algo": "FP8"} or {"quant_algo": "W4A16_NVFP4", "group_size": 16}. In the 4B and 9B checkpoints that is 104 FP8 linears and 97 NVFP4 ones; in Qwen3.6-35B-A3B 130 FP8 and 161 NVFP4 entries (an experts entry covers a layer's 256 experts).
  • NVFP4 linears are the usual triplet: weight (uint8, two codes per byte), weight_scale (F8_E4M3, one per 16 elements), weight_scale_2 (F32 scalar), plus input_scale. They are mostly the MLP projections and, in the MoE model, the per-expert and shared-expert projections.
  • FP8 linears are weight (F8_E4M3, full shape), weight_scale (F32 scalar) and input_scale (F32 scalar). They are the attention projections: linear_attn.{in_proj_qkv, in_proj_z, out_proj} and self_attn.{q,k,v,o}_proj.
  • Everything else (norms, embeddings, in_proj_a / in_proj_b, the vision tower, mtp.*) is bf16.

What is missing

  1. Detection. is_modelopt_nvfp4 accepts NVFP4 and W4A16_NVFP4 only, and requires every config group to be 4-bit, so a MIXED_PRECISION declaration repacks nothing. The NVFP4 half would go through the existing repack unchanged: the triplets are the same, and the repack is already keyed on weight_scale_2.
  2. The FP8 half. These are per-tensor scales: W = e4m3(weight) * weight_scale. The two FP8 routes in the tree are the vendor 128x128 block layout and compressed-tensors float-quantized with a channel or block scale; fp8_ct.rs refuses strategy: "tensor" on purpose. The two layouts are told apart by tensors, not only by config: an FP8 linear has a weight_scale and no weight_scale_2.
  3. Per-expert stacking with the tensor scale for the MoE model, which is fix(models): Qwen3.5 MoE NVFP4 stacking drops the per-expert tensor scale, so the export is refused at load #3195 / fix(models): keep per-expert NVFP4 tensor scales in the Qwen3.5 MoE stacking #3196.

Proposed Solution (for discussion)

  • Treat quant_method: "modelopt", quant_algo: "MIXED_PRECISION" as "repack what is NVFP4, reconstruct what is FP8", per tensor, when every quantized_layers entry is one of those two algorithms; refuse by name otherwise (W4A8_NVFP4_FP8 and the AWQ variants stay out).
  • For the FP8 linears, one of:
    • (a) dense: decode to the checkpoint's float dtype. Exact, simplest, and these are the attention projections only; it costs their 8-bit size again in memory (on the order of a gigabyte on Qwen3.6-35B-A3B by my arithmetic; not measured).
    • (b) mxfp8: requantize as the two existing FP8 routes do. Smaller, but a per-tensor scale does not map onto mxfp8's block exponents without loss.
  • Start with the Qwen3.5 families (the three checkpoints above), since they already carry the FP8 merge points, and leave nemotron_h for a follow-up.

Question: is this wanted, and (a) or (b)? I can do the work and validate on a GB10 with the three checkpoints above (and nvidia/Qwen3.8-27B-NVFP4), main against fix, with a numpy dequantization of the same files as an independent reference for the FP8 half.

Out of scope

  • Activation quantization (input_scale): dropped, as on the NVFP4 route.
  • The KV-cache FP8 scheme some of these configs declare (kv_cache_scheme).
  • The checkpoints that do not fit a 128 GB host: I cannot run them.

Activity

  1. inureyes commented on Nov 22, 2026

    @inureyes
    Member

    Thanks for the detailed writeup and the Hub survey. Automated triage reviewed this and confirmed the underlying gap against the source: is_modelopt_nvfp4 in src/models/gemma4.rs:4706 accepts NVFP4 and W4A16_NVFP4 only, so a MIXED_PRECISION declaration repacks nothing, and the FP8 half has no per-tensor route (fp8_ct.rs refuses strategy: "tensor" by design). So the problem you describe is real.

    It is being left open with status:review rather than marked ready, because the issue is written as a request for a decision rather than a settled work item: it asks whether MIXED_PRECISION support is wanted at all, and which of two mutually exclusive approaches for the FP8 linears to take ((a) dense decode vs (b) mxfp8 requantization). Those are scope and design calls that a maintainer should make, and that is not something automated triage can decide. A maintainer makes the final call here.

    No action is needed from you in the meantime. Once a maintainer confirms the direction and the FP8 approach, this can move to a ready implementation ticket.


    Generated by Claude Code

  2. added
    type:enhancement
    priority:medium
    status:in-progress
    status:done
    and removed
    status:review
    status:in-progress
    on Nov 30, 2026
  3. added a commit that references this issue on Dec 2, 2026
    04ee292
  4. added a commit that references this issue on Dec 2, 2026
    8a8b499
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:mediumstatus:donetype:enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions