Skip to content

[Quant] Preserve ModelOpt FP4 quantization for NextN drafts - #37322

Open
usr-bin-roygbiv wants to merge 3 commits into
sgl-project:mainfrom
usr-bin-roygbiv:workflowz/nextn-modelopt
Open

usr-bin-roygbiv wants to merge 3 commits into
sgl-project:mainfrom
usr-bin-roygbiv:workflowz/nextn-modelopt

Conversation

@usr-bin-roygbiv

@usr-bin-roygbiv usr-bin-roygbiv commented Sep 1, 2026 •

Copy link
Copy Markdown

Motivation

Fixes #36599 and addresses the draft-load failure described in #36653. DeepseekModelNextN and BailingMoEModelNextN currently force modelopt_fp4 quantization to None. That makes quantized GLM-5.3-Flash NextN/MTP weights load into BF16 modules and fail with a packed-versus-unpacked shape mismatch.

Modifications

  • Remove the blanket modelopt_fp4 to None override from the DeepSeek and Bailing NextN paths while preserving the legacy GLM-4.x and GLM-OCR overrides.
  • Resolve ModelOpt FP4 MTP exclusions after loader name mapping, including raw and already-remapped wildcard/exact forms, the canonical legacy layer-0 layout, coarse FusedMoE prefixes, and Bailing hybrid runtime prefixes.
  • Retain ModelOpt FP4 for checkpoints with quantized MTP weights and exclude only explicitly unquantized MTP modules. This is the supported checkpoint contract.
  • Copy quantization configs before changing per-layer exclusions and normalize optional packed-module mappings.
  • Add coverage for mapper-before-resolver ordering, production wildcard spelling, exact parent-module matching, ModelOpt consumer behavior, Bailing hybrid prefixes, legacy layer-0 layouts, and configuration immutability.

Accuracy Tests

CUDA_HOME=/usr PYTHONPATH=python:. uv run --with-editable ./python/ --with pytest pytest test/registered/unit/models/test_nextn_modelopt_quant.py test/registered/unit/layers/quantization/test_modelopt_nvfp4.py test/registered/unit/layers/quantization/test_modelopt_nvfp4_moe_scales.py -v

Result: 75 passed, 15 warnings, 30 subtests passed in 13.77s.

The unit coverage exercises loader mapper ordering and the downstream ModelOpt get_quant_method decisions. No full ModelOpt FP4 checkpoint load, speculative-decoding run, or model-output accuracy run was performed locally.

Speed Tests and Profiling

This changes NextN module construction and checkpoint weight-loading precision selection; it does not add a kernel benchmark. No throughput benchmark or profiler run was performed.

Relationship to Other Work

The branch starts from an older main ancestor (88cf5c9541); the intervening upstream commits do not touch this PR's changed paths. The branch should be rebased after the overlapping PRs above land.

Checklist

  • Format code according to the pre-commit format guidance.
  • Add unit tests according to the unit-test guidance.
  • Update documentation according to the documentation guidance; no user-facing documentation change is needed for this internal loader behavior.
  • Provide full checkpoint accuracy and speed benchmark results; no full checkpoint or benchmark run was performed locally.
  • Follow the SGLang code style guidance.

CI States

Latest PR Test (Base): ❌ Run #33458470679
Latest PR Test (Extra): ❌ Run #33458470537
Latest PR Test (AMD ROCm 7.2): ❌ Run #33458470657

@usr-bin-roygbiv

Copy link
Copy Markdown
Author

/tag-and-rerun-ci

@usr-bin-roygbiv

Copy link
Copy Markdown
Author

Hi @HaiShaw — could you add the run-ci label and rerun CI on this PR? I tried /tag-and-rerun-ci, but the author account can't add labels, so the gate stops before substantive tests run. Local unit tests and lint are passing. Thanks!

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

deepseek quant LLM Quantization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] deepseek_nextn hardcodes quant_config=None for modelopt_fp4 — breaks quantized NextN drafts (GLM-5.3-Flash NVFP4 speculative decoding)

1 participant