Skip to content

[Model] Support GLM-5.3 Flash NVFP4 loading - #38621

Merged
YAMY1234 merged 3 commits into
sgl-project:mainfrom
nvpohanh:codex/glm53-nvfp4-minimal-support
Sep 9, 2026
Merged

YAMY1234 merged 3 commits into
sgl-project:mainfrom
nvpohanh:codex/glm53-nvfp4-minimal-support

Conversation

@nvpohanh

@nvpohanh nvpohanh commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator

[by Codex]

Motivation

nvidia/GLM-5.3-Flash-NVFP4 is a mixed-precision ModelOpt checkpoint: attention and shared-expert modules remain unquantized while routed experts use NVFP4.

Two GLM-5-specific mismatches currently prevent the checkpoint from loading:

  1. ModelOpt exclusion patterns use Hugging Face names under model.language_model.*, while the corresponding SGLang modules are under model.*. The weight loader already performs this rename, but precision selection did not.
  2. Shared-expert fusion cannot combine the checkpoint's unquantized shared experts with its NVFP4 routed experts.

This PR is intentionally narrower than #36761 and #37322. It does not change generic packed-module matching or redesign NextN quantization. Current main already keeps the GLM-5 NextN layer unquantized.

Modifications

  • Add the existing GLM-5 Hugging Face-to-SGLang name mapping to quantization-config matching.
  • Disable shared-expert fusion only when a ModelOpt FP4 checkpoint excludes shared experts but quantizes routed experts.
  • Add unit coverage for text/vision exclusion mapping, the mixed-precision fusion guard, and the uniform-FP4 case where fusion remains enabled.

Accuracy Tests

Validated an unchanged snapshot of nvidia/GLM-5.3-Flash-NVFP4 on 4x NVIDIA GB300 using lmsysorg/sglang:dev-cu13 and the requested launch configuration. The server became healthy without editing checkpoint metadata and without passing --disable-shared-experts-fusion:

sglang serve \
  --model-path nvidia/GLM-5.3-Flash-NVFP4 \
  --quantization modelopt_fp4 \
  --tp-size 4 \
  --dsa-prefill-backend trtllm \
  --dsa-decode-backend trtllm \
  --kv-cache-dtype fp8_e4m3 \
  --moe-runner-backend flashinfer_cutlass \
  --speculative-algorithm EAGLE \
  --speculative-num-steps 5 \
  --speculative-eagle-topk 1 \
  --speculative-num-draft-tokens 6 \
  --speculative-adaptive \
  --reasoning-parser glm45 \
  --tool-call-parser glm47 \
  --mem-fraction-static 0.85 \
  --cuda-graph-max-bs-decode 32 \
  --host 0.0.0.0 \
  --port 30000

Basic deterministic GSM8K subset:

  • Accuracy: 31/32 (96.9%)
  • Invalid answers: 0/32
  • Completion tokens: 2,596

Local regression tests:

44 passed, 2 subtests passed

The tested set includes test_modelopt_nvfp4.py, test_glm5_next_dflash_capture.py, test_shared_experts_fusion_gates.py, and the new GLM-5 ModelOpt tests.

Speed Tests and Profiling

Not applicable. This only changes checkpoint interpretation and prevents an invalid fusion combination; uniformly quantized configurations retain the existing fusion path.

Checklist

  • Ran pre-commit run --all-files --show-diff-on-failure successfully.
  • Added unit tests for the new behavior.
  • Provided an end-to-end accuracy smoke test.
  • Followed the existing SGLang model and quantization patterns.
  • Documentation is not required for this targeted compatibility fix.

CI States

Latest PR Test (Base): ❌ Run #34386744816
Latest PR Test (Extra): ❌ Run #34386744469
Latest PR Test (AMD ROCm 10): ❌ Run #34386744775

Comment thread python/sglang/srt/models/glm5_next.py
Comment thread test/registered/unit/models/test_glm5_next_modelopt.py
@nvpohanh
nvpohanh marked this pull request as ready for review September 9, 2026 05:49
@nvpohanh

nvpohanh commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author

/rerun-tests test/registered/e2e/models/test_glm53_flash_b200.py

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-tests test/registered/e2e/models/test_glm53_flash_b200.py:

🚀 4-gpu-b200 (1 test): ✅ View workflow run

cd test/ && python3 registered/e2e/models/test_glm53_flash_b200.py

@YAMY1234

YAMY1234 commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

/rerun-test test/registered/unit/models/test_glm5_next_modelopt.py

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test/registered/unit/models/test_glm5_next_modelopt.py:

🚀 ubuntu-latest (1 test): ✅ View workflow run

cd test/ && python3 registered/unit/models/test_glm5_next_modelopt.py

Comment thread test/registered/unit/models/test_glm5_next_modelopt.py
@mmangkad

mmangkad commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Wait for #38621 (comment) to pass

@YAMY1234 YAMY1234 added the run-ci CI: run the baseline test suite on this PR label Sep 9, 2026
@YAMY1234

YAMY1234 commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

CI is flaky, related test passed: https://github.com/sgl-project/sglang/actions/runs/34319931588

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants