Skip to content

Set NVFP4 MSE preset effective bits to 4.5 - #2223

Open
realAsma wants to merge 1 commit into
mainfrom
asma/qwen3.8_fp4
Open

Set NVFP4 MSE preset effective bits to 4.5#2223
realAsma wants to merge 1 commit into
mainfrom
asma/qwen3.8_fp4

Conversation

@realAsma

@realAsma realAsma commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Type of change: Bug fix

Set effective_bits: 4.5 on the NVFP4 W4A4 weight-MSE FP8-scale-sweep preset. This records the NVFP4 storage cost—including its FP8 scale overhead—at the preset level for AutoQuant consumers.

Add a focused regression test to ensure the discovered preset continues to expose the correct effective-bit cost.

Usage

No new API or flag is introduced. Recipes importing nvfp4_w4a4_weight_mse_fp8_sweep automatically receive the corrected metadata.

Testing

  • pre-commit run --files modelopt_recipes/configs/ptq/presets/model/nvfp4_w4a4_weight_mse_fp8_sweep.yaml tests/unit/recipe/test_presets.py
  • pytest_pwd -q tests/unit/recipe/test_presets.py — 7 passed
  • git diff --check 913f5e224cb2a9a7754bd2f17edd50395aad7bf7..5be3e216e57822394f2f6db842f759489c72e2fb

Before your PR is "Ready for review"

Make sure you read and follow Contributor guidelines and your commits are signed (git commit -s -S).

Make sure you read and follow the Security Best Practices (e.g. avoiding hardcoded trust_remote_code=True, torch.load(..., weights_only=False), pickle, etc.).

  • Is this change backward compatible?: ✅
  • If you copied code from any other sources or added a new PIP dependency, did you follow guidance in CONTRIBUTING.md: N/A
  • Did you write any new necessary tests?: ✅
  • Did you update Changelog?: N/A — this focused preset metadata correction is not changelog-worthy
  • Did you get Claude approval on this PR?: N/A — this is a small metadata correction with a focused regression test

Additional Information

None.

Summary by CodeRabbit

  • New Features

    • Updated the NVFP4 W4A4 MSE FP8-scale preset to report an effective precision of 4.5 bits.
  • Bug Fixes

    • Corrected the preset’s storage-cost metadata for more accurate configuration reporting.
  • Tests

    • Added regression coverage to verify the updated effective-bits value.

Signed-off-by: realAsma <akuriparambi@nvidia.com>
@realAsma
realAsma requested review from a team as code owners August 20, 2026 19:11
@realAsma
realAsma requested a review from shengliangxu August 20, 2026 19:11
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 98b83b5c-d922-4bd4-aadd-ae080c1c5bdb

📥 Commits

Reviewing files that changed from the base of the PR and between 913f5e2 and 5be3e21.

📒 Files selected for processing (2)
  • modelopt_recipes/configs/ptq/presets/model/nvfp4_w4a4_weight_mse_fp8_sweep.yaml
  • tests/unit/recipe/test_presets.py

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


📝 Walkthrough

Walkthrough

The NVFP4 W4A4 MSE FP8-scale preset now declares effective_bits: 4.5. A unit test verifies the configured storage cost.

Changes

NVFP4 storage cost

Layer / File(s) Summary
Preset storage cost and regression coverage
modelopt_recipes/configs/ptq/presets/model/nvfp4_w4a4_weight_mse_fp8_sweep.yaml, tests/unit/recipe/test_presets.py
The preset adds effective_bits: 4.5. The unit test asserts this value.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 5be3e

This change corrects the NVFP4 preset’s effective-bit metadata and adds regression coverage; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: shengliangxu

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (1 skipped: 1 unsupported.) Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: setting the NVFP4 MSE preset effective bits to 4.5.
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 PR changes only one YAML metadata field and one regression assertion; it adds no modelopt/examples Python security patterns, dependencies, or # nosec bypass.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch asma/qwen3.8_fp4

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

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.37%. Comparing base (913f5e2) to head (5be3e21).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2223      +/-   ##
==========================================
- Coverage   78.98%   78.37%   -0.61%     
==========================================
  Files         522      522              
  Lines       60599    60599              
==========================================
- Hits        47862    47497     -365     
- Misses      12737    13102     +365     
Flag Coverage Δ
examples-diffusers 20.70% <ø> (+<0.01%) ⬆️
examples-gpt-oss 13.23% <ø> (+<0.01%) ⬆️
examples-hf_ptq 21.47% <ø> (-0.04%) ⬇️
examples-llm_distill 13.30% <ø> (+<0.01%) ⬆️
examples-llm_eval 17.06% <ø> (+<0.01%) ⬆️
examples-llm_qat 17.54% <ø> (+<0.01%) ⬆️
examples-llm_sparsity 15.88% <ø> (+<0.01%) ⬆️
examples-megatron_bridge 25.67% <ø> (-0.16%) ⬇️
examples-specdec_bench 12.97% <ø> (+<0.01%) ⬆️
examples-speculative_decoding 17.48% <ø> (-0.07%) ⬇️
examples-torch_onnx 21.79% <ø> (+<0.01%) ⬆️
examples-torch_trt 15.03% <ø> (-0.01%) ⬇️
gpu 58.50% <ø> (-0.72%) ⬇️
unit 55.60% <ø> (-0.01%) ⬇️

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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants