Skip to content

Make group-boundary AutoQuant scoring the default#1988

Draft
meenchen wants to merge 1 commit into
mainfrom
weimingc/autoquant-group-scoring
Draft

Make group-boundary AutoQuant scoring the default#1988
meenchen wants to merge 1 commit into
mainfrom
weimingc/autoquant-group-scoring

Conversation

@meenchen

Copy link
Copy Markdown
Contributor

What does this PR do?

Type of change: New feature

AutoQuant gradient scoring currently measures each quantized projection at its leaf output. That can understate perturbations that are amplified by the surrounding attention or MoE computation.

This PR:

  • makes group-boundary scoring the default for gradient AutoQuant;
  • scores attention projection perturbations at the parent attention output and fused/shared expert perturbations at the parent MLP output;
  • keeps recipe decisions independent, so this does not impose an attention-family quantization mask or force projections to share a format;
  • preserves leaf-output scoring through score_boundary: local;
  • keeps KL-divergence on local scoring;
  • disables and restores mutable model KV caching while parent-boundary gradient scores are collected;
  • exposes the setting through recipe configuration and the deprecated compatibility CLI;
  • documents the behavior and adds focused coverage.

This branch intentionally contains only group-boundary scoring. Per-element score normalization remains a separate change.

Usage

auto_quantize:
  auto_quantize_method: gradient
  # Optional because gradient AutoQuant now defaults to group.
  score_boundary: group

To restore the previous leaf-output behavior:

auto_quantize:
  auto_quantize_method: gradient
  score_boundary: local

Testing

  • Focused unit suite:
    284 passed, 1 deselected
    
    from test_autoquant.py, test_loader.py, and test_hf_ptq_args.py.
  • Distributed AutoQuant unit:
    1 passed
    
    for test_data_parallel_auto_quantize.
  • GPU end-to-end PTQ/export on aws-cmh:
    • Slurm job: 2612917
    • Tested commit: 82b717182859cf2f87b37830315e4c8746a300a5
    • Model: Qwen3.5-9B
    • Recipe: general/auto_quantize/nvfp4_fp8_at_5p4bits
    • Result: mixed FP8/NVFP4 recipe selected at 5.40 effective bits and unified HF checkpoint exported successfully
    • Job status: COMPLETED, exit 0:0

Before your PR is "Ready for review"

  • Is this change backward compatible?: ❌ The default gradient scoring boundary changes; score_boundary: local restores the previous behavior.
  • 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?: ✅
  • Did you get Claude approval on this PR?: N/A

Additional Information

The scoring boundary is distinct from module grouping: this PR changes where sensitivity is measured, not which modules share one AutoQuant assignment.

Score gradient perturbations at parent attention and MLP outputs by default, with an explicit local-boundary opt-out and local-only KL-divergence behavior.

Signed-off-by: weimingc <17592131+meenchen@users.noreply.github.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 28f54798-c263-49e3-a1c3-07e87e47f78f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch weimingc/autoquant-group-scoring

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

@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://NVIDIA.github.io/Model-Optimizer/pr-preview/pr-1988/

Built to branch gh-pages at 2026-07-17 19:00 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.25000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.45%. Comparing base (c9dbb5e) to head (82b7171).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
modelopt/torch/quantization/algorithms.py 95.94% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1988      +/-   ##
==========================================
+ Coverage   77.40%   77.45%   +0.05%     
==========================================
  Files         524      524              
  Lines       59267    59479     +212     
==========================================
+ Hits        45873    46070     +197     
- Misses      13394    13409      +15     
Flag Coverage Δ
unit 55.10% <96.25%> (+0.11%) ⬆️

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.

1 participant