Skip to content

[OMNIML-3853] Backfill checkpoint aliases for Kimi-K2.7-Code and the Gemma-4 MoE releases - #2647

Merged
shengliangxu merged 2 commits into
mainfrom
shengliangx/backfill-2026-group-a
Oct 8, 2026
Merged

shengliangxu merged 2 commits into
mainfrom
shengliangx/backfill-2026-group-a

Conversation

@shengliangxu

@shengliangxu shengliangxu commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Type of change: New recipes (checkpoint aliases)

Continues the 2026 published-checkpoint backfill started in #2643, with three more NVFP4 releases. Each entry is a thin alias importing an existing general recipe wholesale — no duplicated quant_cfg, and editing a base recipe flows through to every alias pointing at it.

Source model Recipe Published as
moonshotai/Kimi-K2.7-Code general/ptq/nvfp4_experts_only_input_scale1-kv_fp8_cast nvidia/Kimi-K2.7-Code-NVFP4
google/gemma-4-26B-A4B-it general/ptq/nvfp4_experts_only-kv_fp8_cast nvidia/Gemma-4-26B-A4B-NVFP4
google/diffusiongemma-26B-A4B-it general/ptq/nvfp4_experts_only-kv_fp8_cast nvidia/diffusiongemma-26B-A4B-it-NVFP4

How these were verified

Unlike #2643, where each engineer named a recipe file outright, these three were described in prose ("NVFP4 experts only, input activation scale 1.0, calibration free"; "nvfp4 experts only, default dataset, 1024 samples"). So the mapping was checked against the published checkpoints before being recorded:

  • Format and method. All three are NVFP4 with an FP8 KV cache, and every model card documents post-training quantization with no mention of quantization-aware training or distillation. That check matters because QAD retrains the weights while leaving the quantization layout identical — a PTQ recipe could match every module and format and still not reproduce such a release.
  • Scope. Both Gemma releases list dense MLPs, router, attention, vision tower and lm_head in exclude_modules, leaving only the routed experts quantized. Kimi-K2.7-Code additionally excludes its shared experts.
  • input_scale1 vs plain experts-only. This is what separates the Kimi recipe from the Gemma one. The input_scale1 recipe pins expert activation amax to a constant 2688.0 (E2M1_MAX * E4M3_MAX), so the exported input_scale is exactly 1.0. Kimi-K2.7-Code's sampled expert input_scale tensors are exactly 1.0; the Gemma releases' are calibrated values, so they take the plain recipe.
  • KV mode. Neither Gemma release exports k_scale tensors, which is what cast mode produces (use_constant_amax, no KV calibration) — consistent with the already-merged GLM-5.1/Kimi-K2.6 entries, which use -kv_fp8_cast recipes and likewise export none. A calibrated KV cache exports a non-1.0 k_scale.
  • A naming quirk worth knowing: diffusiongemma nests its decoder under model.decoder.layers rather than model.language_model.layers. The recipe's *.experts.* patterns match either way, so no model-specific body is needed.

What this cannot establish: calibration. A checkpoint does not record whether max, MSE, or something else was used, so that rests on what each engineer said — the Gemma pair used the default, which is max. Kimi-K2.7-Code is calibration-free on the activation side by construction.

Second commit: name the release in the Qwen3.8-27B description

models/Qwen/Qwen3.8-27B/ptq/nvfp4_w4a4_mlp_fp8_attn_local_hessian already reproduces nvidia/Qwen3.8-27B-NVFP4, and ptq.md says so — but the recipe's own metadata.description did not, so on its own the file reads like an unrelated AutoQuantize artifact. Every other checkpoint entry names its release, so a coverage audit that reads the recipes can miss this one. (It missed mine.)

Checked against the published checkpoint before asserting it: MLP gate/up/down_proj NVFP4, self_attn and linear_attn projections FP8, lm_head NVFP4, mtp* excluded, no KV quantization — and the model card names local-Hessian calibration on 2,048 samples. All matching, including the unusual NVFP4 lm_head.

Usage

python examples/hf_ptq/hf_ptq.py \
    --pyt_ckpt_path google/gemma-4-26B-A4B-it \
    --recipe models/google/gemma-4-26B-A4B-it/ptq/nvfp4_experts_only-kv_fp8_cast \
    --export_path <output>

Testing

  • tests/unit/recipe/ — 460 passed. All three aliases load through load_recipe, inherit algorithm: max from their base, and resolve to 32 quant_cfg entries.
  • The aliases are swept by the shipped-recipe discovery in tests/unit/recipe/test_loader.py, which finds every PTQ recipe from disk, so they are covered without a bespoke test.
  • pre-commit passes on all changed files.
  • The 14 failures in the local run are pre-existing and environment-only — a broken transformer_engine .so in the dev venv; they reproduce identically on unmodified main.

Not covered: numerics. Nothing here asserts accuracy or that running a recipe reproduces a released checkpoint's weights bit-for-bit.

Before your PR is "Ready for review"

  • Is this change backward compatible?: ✅ — purely additive. Three new alias files plus a docs and changelog entry; no existing recipe path, body or API changes.
  • If you copied code from any other sources or added a new PIP dependency, did you follow guidance in CONTRIBUTING.md: ✅ — no new dependencies, no source changes.
  • Did you write any new necessary tests?: ✅ — covered by the shipped-recipe sweep.
  • Did you update Changelog?: ✅
  • Did you get Claude approval on this PR?: ❌ — not yet run.

Additional Information

Three more releases from the same tracking list are verified for scope and KV mode but still need their calibration method confirmed by the engineer who produced them (a checkpoint cannot reveal it): moonshotai/Kimi-K2.5, Qwen/Qwen3.5-397B-A17B (the non-V2 release), and zai-org/GLM-5.1. They will follow separately.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added checkpoint recipes for Kimi-K2.7-Code, Gemma 4 26B A4B, and DiffusionGemma 26B A4B, with NVFP4 quantization and FP8 KV-cache options.
    • Added documentation identifying the published checkpoints and their available recipe configurations.
    • Updated the Qwen 3.8 27B recipe description to identify its published checkpoint.

@copy-pr-bot

copy-pr-bot Bot commented Oct 2, 2026

Copy link
Copy Markdown

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.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/Model-Optimizer/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 0bf9f3d9-462a-4158-996b-dff085fad470
📥 Commits

Reviewing files that changed from the base of the PR and between 90ba9fb and 71e3277.

📒 Files selected for processing (6)
  • CHANGELOG.rst
  • modelopt_recipes/models/Qwen/Qwen3.8-27B/ptq/nvfp4_w4a4_mlp_fp8_attn_local_hessian.yaml
  • modelopt_recipes/models/google/diffusiongemma-26B-A4B-it/ptq/nvfp4_experts_only-kv_fp8_cast.yaml
  • modelopt_recipes/models/google/gemma-4-26B-A4B-it/ptq/nvfp4_experts_only-kv_fp8_cast.yaml
  • modelopt_recipes/models/moonshotai/Kimi-K2.7-Code/ptq/nvfp4_experts_only_input_scale1-kv_fp8_cast.yaml
  • modelopt_recipes/ptq.md

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Walkthrough

Walkthrough

The change adds three model-specific NVFP4 recipe aliases that import existing general recipes. It documents the aliases and their published checkpoint names, and updates the published checkpoint reference in an existing Qwen recipe description.

Changes

NVFP4 checkpoint aliases

Layer / File(s) Summary
Model-specific recipe aliases
modelopt_recipes/models/google/{gemma-4-26B-A4B-it,diffusiongemma-26B-A4B-it}/ptq/*, modelopt_recipes/models/moonshotai/Kimi-K2.7-Code/ptq/*
Adds aliases that import general NVFP4 recipes and describe the models’ quantization configurations.
Alias documentation and checkpoint references
modelopt_recipes/ptq.md, CHANGELOG.rst, modelopt_recipes/models/Qwen/Qwen3.8-27B/ptq/nvfp4_w4a4_mlp_fp8_attn_local_hessian.yaml
Documents the three aliases, adds a changelog entry, and names the published checkpoint in the Qwen recipe description.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to 71e32

The aliases and checkpoint references are internally consistent, with no demonstrated merge-blocking risk.

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: adding checkpoint aliases for Kimi-K2.7-Code and the Gemma-4 MoE releases. It is concise and directly related to the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Anti-Patterns ✅ Passed The pull request changes only YAML recipes and documentation. It adds no Python files, dependency files, or security-sensitive code patterns covered by SECURITY.md. No prohibited pattern or new non-pe…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.06%. Comparing base (90ba9fb) to head (71e3277).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2647      +/-   ##
==========================================
+ Coverage   71.54%   78.06%   +6.52%     
==========================================
  Files         640      638       -2     
  Lines       71316    71256      -60     
==========================================
+ Hits        51020    55627    +4607     
+ Misses      20296    15629    -4667     
Flag Coverage Δ
examples-diffusers 21.37% <ø> (ø)
examples-gpt-oss 13.45% <ø> (ø)
examples-hf_ptq 23.39% <ø> (-0.04%) ⬇️
examples-llm_distill 13.51% <ø> (-0.01%) ⬇️
examples-llm_eval 17.29% <ø> (ø)
examples-llm_qat 17.52% <ø> (-0.01%) ⬇️
examples-llm_sparsity 15.83% <ø> (ø)
examples-megatron_bridge 26.45% <ø> (-0.14%) ⬇️
examples-specdec_bench 13.23% <ø> (ø)
examples-speculative_decoding 17.58% <ø> (-0.18%) ⬇️
examples-torch_onnx 21.58% <ø> (ø)
examples-torch_trt 15.22% <ø> (ø)
examples-vllm_serve 13.89% <ø> (ø)
gpu 58.83% <ø> (+25.31%) ⬆️
unit 59.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

shengliangxu and others added 2 commits October 8, 2026 01:21
Continues the 2026 published-checkpoint backfill. Each entry imports an existing
general recipe wholesale; nothing is duplicated.

  moonshotai/Kimi-K2.7-Code         general/ptq/nvfp4_experts_only_input_scale1-kv_fp8_cast
  google/gemma-4-26B-A4B-it         general/ptq/nvfp4_experts_only-kv_fp8_cast
  google/diffusiongemma-26B-A4B-it  general/ptq/nvfp4_experts_only-kv_fp8_cast

Each engineer described the scheme in prose rather than naming a recipe file, so
the mapping was checked against the published checkpoints before being recorded:

- All three are NVFP4 with an FP8 KV cache, and every model card documents
  post-training quantization with no quantization-aware training or distillation.
- Kimi-K2.7-Code's exported expert input_scale tensors are exactly 1.0, which is
  what the input_scale1 recipe produces by pinning amax to a constant 2688.0
  (E2M1_MAX * E4M3_MAX); its shared experts and attention are excluded. That
  distinguishes it from the plain experts-only recipe, whose expert input scales
  are calibrated.
- Both Gemma releases quantize only the routed experts -- dense MLPs, router,
  attention, vision tower and lm_head all appear in exclude_modules -- with
  calibrated expert input scales and no exported k_scale, i.e. KV cast mode.
  diffusiongemma nests its decoder under model.decoder.layers rather than
  model.language_model.layers, which the recipe's `*.experts.*` patterns match
  either way.

Calibration is the one property a checkpoint cannot reveal, so it rests on what
each engineer said: the Gemma pair used the default calibration, which is max.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Shengliang Xu <[email protected]>
The recipe reproduces nvidia/Qwen3.8-27B-NVFP4 -- ptq.md already says so -- but
the recipe's own metadata.description did not, which makes it read like an
unrelated AutoQuantize artifact when you encounter the file on its own. Every
other checkpoint entry names the release it corresponds to, so an audit of
backfill coverage that reads the recipes can miss this one.

Verified the claim against the published checkpoint before asserting it: MLP
gate/up/down_proj NVFP4, self_attn and linear_attn projections FP8, lm_head
NVFP4, mtp excluded, no KV quantization, and the model card names local-Hessian
calibration on 2,048 samples -- all matching this recipe, including the unusual
NVFP4 lm_head.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Shengliang Xu <[email protected]>
@shengliangxu shengliangxu changed the title Backfill checkpoint aliases for Kimi-K2.7-Code and the Gemma-4 MoE releases [OmniML-3853] Backfill checkpoint aliases for Kimi-K2.7-Code and the Gemma-4 MoE releases Oct 8, 2026
@shengliangxu
shengliangxu force-pushed the shengliangx/backfill-2026-group-a branch from 553e45d to 71e3277 Compare October 8, 2026 01:24
@shengliangxu
shengliangxu marked this pull request as ready for review October 8, 2026 16:56
@shengliangxu
shengliangxu requested review from a team as code owners October 8, 2026 16:56
@shengliangxu
shengliangxu requested a review from cjluo-nv October 8, 2026 16:56

@cjluo-nv cjluo-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bot review (bedrock-claude-opus-5-5) — DM the bot to share feedback.

Approve: this adds three thin YAML aliases that follow the established checkpoint-alias pattern, and both base recipes they import already exist.

No action needed.

No action needed:

  • Design review was triggered because the diff spans 6 directories, but nothing new is being built. Each alias has the same imports: base + $import: base + metadata shape as the merged models/zai-org/GLM-5.1/ptq/nvfp4_experts_only_input_scale1-kv_fp8_cast.yaml.
  • general/ptq/nvfp4_experts_only-kv_fp8_cast.yaml and general/ptq/nvfp4_experts_only_input_scale1-kv_fp8_cast.yaml both exist, so the imports resolve.
  • Licensing: the new files carry only the standard NVIDIA header, which matches LICENSE_HEADER exactly.
  • Size: no source code changed, so this is well under the logic-line budget.
  • Tests: no new test was added; the PR says the shipped-recipe sweep in tests/unit/recipe/test_loader.py loads every new alias. No existing tests changed.
  • The Qwen3.8-27B recipe edit only changes its description text.

@shengliangxu
shengliangxu merged commit 8ea3ae5 into main Oct 8, 2026
71 of 73 checks passed
@shengliangxu
shengliangxu deleted the shengliangx/backfill-2026-group-a branch October 8, 2026 20:37
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-08 20:38 UTC

@shengliangxu shengliangxu changed the title [OmniML-3853] Backfill checkpoint aliases for Kimi-K2.7-Code and the Gemma-4 MoE releases [OMNIML-3853] [OmniML-3853] Backfill checkpoint aliases for Kimi-K2.7-Code and the Gemma-4 MoE releases Oct 8, 2026
@shengliangxu shengliangxu changed the title [OMNIML-3853] [OmniML-3853] Backfill checkpoint aliases for Kimi-K2.7-Code and the Gemma-4 MoE releases [OMNIML-3853] Backfill checkpoint aliases for Kimi-K2.7-Code and the Gemma-4 MoE releases Oct 8, 2026
@rohansjoshi rohansjoshi added the cherry-pick-done Added by bot once PR is cherry-picked to the release branch label Oct 16, 2026
rohansjoshi added a commit that referenced this pull request Oct 17, 2026
#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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick-0.48.0 cherry-pick-done Added by bot once PR is cherry-picked to the release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants