Repository navigation
[OMNIML-3853] Fix the GLM-5.1 alias: it is not the input_scale1 recipe - #2711
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2711 +/- ##
==========================================
+ Coverage 71.67% 78.17% +6.49%
==========================================
Files 644 644
Lines 71470 71470
==========================================
+ Hits 51225 55870 +4645
+ Misses 20245 15600 -4645
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
zai-org/GLM-5.1 was recorded as using general/ptq/nvfp4_experts_only_input_scale1-kv_fp8_cast, alongside GLM-5.2. That recipe pins the expert activation amax to a constant 2688.0 (E2M1_MAX * E4M3_MAX), so every exported expert input_scale comes out exactly 1.0. GLM-5.2's do -- 8 of 8 sampled. GLM-5.1's do not: 0 of 8 randomly sampled expert input_scale tensors equal 1.0, and they span 3.4e-4 to 1.3e-2, i.e. ordinary activation calibration. So GLM-5.1 takes the plain experts-only recipe. Scope and KV mode are unchanged and were verified against the release: routed experts only, FP8 KV cache in cast mode. Only the activation handling was wrong. The two models were given one answer covering both when the recipes were collected, and that answer was recorded without checking the single property the input_scale1 recipe is named for. GLM-5.2 stays as it is. One caveat: max versus MSE is not recoverable from a checkpoint, so the `max` variant here reflects the general default rather than a confirmed fact. If the release used MSE, the fix is to switch the import to general/ptq/nvfp4_experts_only_mse-kv_fp8_cast; everything else stays. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Shengliang Xu <[email protected]>
ea6470a to
f442120
Compare
cjluo-nv
left a comment
There was a problem hiding this comment.
Bot review (bedrock-claude-opus-5-5) — DM the bot to share feedback.
Approving: this is a small, correct alias fix. GLM-5.1 now imports the plain general/ptq/nvfp4_experts_only-kv_fp8_cast recipe, which matches the calibrated input_scale tensors in the published checkpoint.
No action needed.
- I searched the repo for other references to the old path
GLM-5.1/ptq/nvfp4_experts_only_input_scale1-kv_fp8_cast. The only one is theptq.mdentry this PR rewrites. TheCHANGELOG.rstentry nameszai-org/GLM-5.1without a recipe path, so it is still accurate. - I checked the base recipe this alias now points to. It exists, uses
method: max, and has noconstant_amax, so the new comment and description are accurate. The GLM-5.2 alias is unchanged. - The rename keeps the existing NVIDIA Apache header, so there is no licensing concern. The shipped-recipe sweep in
tests/unit/recipe/test_loader.pycovers the new file. - Removing the old path is a deliberate breaking change inside the unreleased cycle that added it (#2643). Skipping a changelog entry is consistent with
CONTRIBUTING.md. - Still open, as the PR body says: we can't tell from the checkpoint whether max or MSE calibration was used. If it turns out to be MSE, switching the import is a one-line follow-up.
|
#2769 #2770 #2719 #2796 #2801 #2794 #2787 #2682 #2793 #2791 #2792 #2766 #2823 #2777 #2773 #2813 #2832 #2795 #2684 #2822 #2838 #2807 #2772 #2837 #2820 (#2843) ## Cherry-picked PRs - #2647 - #2700 - #2718 - #2578 - #2580 - #2711 - #2731 - #2726 - #2697 - #2769 - #2770 - #2719 - #2796 - #2801 - #2794 - #2787 - #2682 - #2793 - #2791 - #2792 - #2766 - #2823 - #2777 - #2773 - #2813 - #2832 - #2795 - #2684 - #2822 - #2838 - #2807 - #2772 - #2837 - #2820 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Expanded quantized model export support for MXFP4, MXFP8, FP8, and additional block-quantization formats. * Added quantization support for GPT-OSS and Step-family models, plus export support for native FP8 experts. * Added chat JSONL data preparation for Megatron workflows and an option to freeze the student MTP head during distillation. * Added model recipes for Kimi, Gemma, DiffusionGemma, and GLM variants. * **Bug Fixes** * Improved ONNX quantization and export compatibility, distributed calibration consistency, and handling of packed attention caches. * Improved safe model loading and low-precision quantization accuracy. * **Documentation** * Updated the 0.48.0 changelog and guidance for data preparation and quantization recipes. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Also includes a partial backport of #2656 (only the `_validate_fold_weight` hook and the `mtq.fold_weight` pre-check), which #2820 depends on. --------- Signed-off-by: Shengliang Xu <[email protected]> Signed-off-by: Rohan Joshi <[email protected]> Signed-off-by: Juhi Mittal <[email protected]> Signed-off-by: Fridah-nv <[email protected]> Signed-off-by: Chenjie Luo <[email protected]> Signed-off-by: yingguo-trt <[email protected]> Signed-off-by: weimingc <[email protected]> Signed-off-by: Yue <[email protected]> Signed-off-by: joe-nv <[email protected]> Signed-off-by: ajrasane <[email protected]> Signed-off-by: Ajinkya Rasane <[email protected]> Signed-off-by: ColinM-sys <[email protected]> Signed-off-by: Keval Morabia <[email protected]> Signed-off-by: Meng Xin <[email protected]> Signed-off-by: gcunhase <[email protected]> Signed-off-by: Chad Voegele <[email protected]> Co-authored-by: Shengliang Xu <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: Juhi Mittal <[email protected]> Co-authored-by: Frida Hou <[email protected]> Co-authored-by: Chenjie Luo <[email protected]> Co-authored-by: yingguo-trt <[email protected]> Co-authored-by: Wei-Ming Chen <[email protected]> Co-authored-by: yueshen2016 <[email protected]> Co-authored-by: joe <[email protected]> Co-authored-by: Ajinkya Rasane <[email protected]> Co-authored-by: Colin McDonough <[email protected]> Co-authored-by: Keval Morabia <[email protected]> Co-authored-by: mxinO <[email protected]> Co-authored-by: Gwena Cunha <[email protected]> Co-authored-by: Chad Voegele <[email protected]>
What does this PR do?
Type of change: Bug fix (checkpoint alias pointed at the wrong recipe)
models/zai-org/GLM-5.1/aliasesgeneral/ptq/nvfp4_experts_only_input_scale1-kv_fp8_cast. It should alias the plaingeneral/ptq/nvfp4_experts_only-kv_fp8_cast.The
input_scale1recipe pins the expert activation amax to a constant 2688.0 (E2M1_MAX * E4M3_MAX), so every exported expertinput_scaleis exactly 1.0 and no activation statistics are collected. That is a visible property of the published checkpoint, and GLM-5.1 does not have it:input_scale, 8 randomly samplednvidia/GLM-5.2-NVFP41.0input_scale1nvidia/GLM-5.1-NVFP43.4e-4…1.3e-2So GLM-5.1 used ordinary activation calibration and takes the plain experts-only recipe. GLM-5.2 is correct and is not touched.
Scope and KV mode were re-checked against the release and are unchanged — routed experts only, FP8 KV cache in cast mode. Only the activation handling was wrong. Verified after the change that the alias now resolves identically to its base, that the pinned
2688.0amax is gone from the resolved config, and that GLM-5.2 still carries it.How this happened
The recipes were collected by asking the engineer behind each release. GLM-5.1 and GLM-5.2 were answered together in one line naming
input_scale1. That was recorded for both without checking the one property the recipe is named for. #2643 merged it.One thing left open
Max versus MSE is not recoverable from a checkpoint — calibration leaves no trace in the exported tensors, which is why the sampling above can settle
input_scale1but not this. Themaxvariant here reflects the general default, not a confirmed fact. If GLM-5.1 used MSE, the follow-up is a one-line change of the import togeneral/ptq/nvfp4_experts_only_mse-kv_fp8_cast; scope, KV mode and activation handling all stay as they are in this PR.This PR is still strictly closer to the release than what is on
maintoday, which misstates activation handling outright.Usage
python examples/hf_ptq/hf_ptq.py \ --pyt_ckpt_path zai-org/GLM-5.1 \ --recipe models/zai-org/GLM-5.1/ptq/nvfp4_experts_only-kv_fp8_cast \ --export_path <output>Testing
tests/unit/recipe/— 461 passed.general/ptq/nvfp4_experts_only-kv_fp8_cast, thatconstant_amax: 2688.0no longer appears in it, that the old path now raisesValueError, and that GLM-5.2 still resolves with the pinned amax.pre-commitpasses on both changed files.transformer_engine.soin the dev venv; they reproduce identically on unmodifiedmain.Before your PR is "Ready for review"
--recipe models/zai-org/GLM-5.1/ptq/nvfp4_experts_only_input_scale1-kv_fp8_caststops resolving and becomes.../nvfp4_experts_only-kv_fp8_cast. That is the fix: the old path named a recipe that does not produce this release.CONTRIBUTING.md: ✅ — no new dependencies, no source changes.tests/unit/recipe/test_loader.py.CONTRIBUTING.mdsays to skip. Happy to add one if you would rather it be recorded.🤖 Generated with Claude Code
Summary by CodeRabbit