Repository navigation
Closed
Description
Severity: high — quantized checkpoints keep large parts of the model in BF16 with no error
Version: 7.11.0 @ 6c3421c, transformers 5.22.2
How this was found
For each MODEL_MAP type:
- Build the real module tree on the meta device the way the loader does:
resolve_trust_remote_code→ defuser →build_shell_model→ definition. - Compare the declared quantized and
:!paths with every Linear / Conv / Embedding leaf.
About 151 types were checked. The existing tests/module_tree suites pass (520 passed) and catch none of the cases below.
Findings
| Model | Where | Problem |
|---|---|---|
| Voxtral | definitions/voxtral.py:12-15 |
Tree declares language_model.model.layers; the real path in 5.22 is model.language_model.layers. pre_lm_head_norm_module was updated, the tree wasn't. Zero layers resolve, so nothing is quantized. |
| Nemotron-H MoE (e.g. NVIDIA-Nemotron-3-Nano-30B-A3B) | definitions/nemotron_h.py:22-33 |
No mixer.experts.#, mixer.shared_experts or router entries, and layer_modules_strict=False. 2944 routed-expert up/down projections plus shared experts stay BF16, which is most of the weights. |
Ling 2.0 (bailing_moe) — regression from #4080 (2ac5a4e) |
definitions/bailing_moe.py:26-43 |
attention.query_key_value / attention.dense were dropped on the assumption that the layout no longer exists. bailing_moe is remote-code only and still uses it, so on Ling-mini-2.0 attention in all 20 layers stays FP. |
| Llama-4 Maverick | definitions/llama4.py:31-48 (+ Llama4TextQModel) |
feed_forward:moe has no "" dense entry. MoE is every other layer, so 24/48 layers have undeclared feed_forward.{gate,up,down}_proj. With strict=True this should raise; relaxed, the dense MLPs stay FP. Scout is unaffected. |
Gemma-4 MoE (enable_moe_block=True, e.g. 26B-A4B) |
definitions/gemma4.py:20-50 |
No router or expert entries. Experts are a 3-D Gemma4TextExperts parameter, and defuser 0.0.31 has no gemma4 entry. The undeclared-leaf warning only checks Linear/Conv, so the user gets no warning. |
| Phi-3 128k (longrope) | definitions/phi3.py |
Native AutoConfig fails on 5.22 (KeyError: rope_parameters missing original_max_position_embeddings), so remote code is used. That code has a fused mlp.gate_up_proj, while the definition declares gate_proj/up_proj with strict=True, so quantization fails. |
lm_head=True calibrated on the wrong inputs / wrong path
lm_head_pre_quantize_generate_hook (base.py:~3934) applies pre_lm_head_norm_module to the last layer's output.
phimoe,falcon_h1,nemotron_handhrm_textdeclare no pre-head norm, althoughmodel.norm/final_layernorm/norm_fexist. lm_head GPTQ is calibrated on un-normalised hidden states.zamba.py:16andzamba2.py:17set it to"lm_head", so the hook runs the head on its own input.Llama4TextQModelinheritslm_head="language_model.lm_head", butLlama4ForCausalLMhaslm_head.
Lower
- Jamba
mamba.dt_projand GRIN-MoEblock_sparse_moe.gateare undeclared. KimiLinearNativeQModel.rotary_embeddingpoints at the non-existentmodel.rotary_emb.- mllama cross-attention is left FP (known TODO).
Suggested fix
- Fix the trees above and add model-specific module-plan tests (per AGENTS.md).
- Consider a registry-wide test that builds each meta model from its default/local config and fails when any Linear/Conv/expert parameter under the layer stack is neither declared nor tagged
:!/:?. Include 3-D expert parameters, not only Linear/Conv.
Note: CI environments with defuser 0.0.29 (below the required 0.0.31) fail the granite awq_relationships cases spuriously.
Found during an AI-assisted review (Claude Code) of 6c3421c; repros were run on RTX 4090/5090 (CUDA 13) and Radeon AI PRO R9700 (ROCm) unless marked static/suspected.
Activity
Qubitium commentedon Nov 16, 2026
Another definition in the same class, found in a follow-up pass at
9dad249:internvl_chat(models/definitions/internvl_chat.py:34-52) declares only Qwen-style decoder leaves.InternVL2 / 2.5 checkpoints with an InternLM2 backbone share the same
model_type. Their real decoder leaves (attention.wqkv,attention.wo,feed_forward.w1/w2/w3) are all undeclared. There is no layout variant and no clear rejection, and withlayer_modules_strict=Truequantization should fail atmodule_looper.py:~2226.fix(models): declare every decoder leaf for issue #4174 (#4174) (#4245)