Skip to content

docs: add AutoQuantize mixed-precision search blog#1979

Draft
realAsma wants to merge 5 commits into
chenhany/omniml-5476from
asma/autoquantize-blog
Draft

docs: add AutoQuantize mixed-precision search blog#1979
realAsma wants to merge 5 commits into
chenhany/omniml-5476from
asma/autoquantize-blog

Conversation

@realAsma

Copy link
Copy Markdown
Contributor

What does this PR do?

Type of change: documentation.

Adds the AutoQuantize technical blog to the announcements system introduced by #1971.

  • Preserves the source derivation, deployment-aware search details, results, usage example, and references in native Sphinx RST.
  • Adds the MMLU accuracy-versus-effective-bits figure as a losslessly optimized asset.
  • Adds a newest-first landing-page card and AutoQuantize filter.
  • Credits the authors in this order: Asma Beevi K T, Wei Ming, Frida Hou, Juhi Mittal, Jenny Chen, Ajinkya Rasane, Meng Xin.

This is a stacked PR targeting the branch for #1971. After #1971 merges, this PR can be retargeted to main.

Usage

N/A; documentation only.

Testing

  • Focused pre-commit hooks on all three changed files.
  • git diff --check.
  • Focused Sphinx HTML build for the announcement and landing page.
  • Rendered-output checks for equations, table, Python code block, image and alt text, references, external links, card, filter, and exact author order.
  • Full fail-on-warning build was attempted; remaining warnings were unrelated optional autodoc environment warnings.

Before your PR is "Ready for review"

  • 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?: N/A
  • Did you update Changelog?: N/A
  • Did you get Claude approval on this PR?: N/A

Additional Information

Depends on #1971.

Signed-off-by: realAsma <akuriparambi@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 15, 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 Jul 15, 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: d8da7363-c5f2-4238-b6cb-fc944fa5cca0

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 asma/autoquantize-blog

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

Signed-off-by: realAsma <akuriparambi@nvidia.com>
AutoQuantize gradient is fast!
==============================

**Speed.** The direct way to measure sensitivity — quantize one layer at a time and measure a downstream evaluation such as loss, accuracy — runs the whole model per measurement. The AutoQuantize gradient scores all layer × format combinations in one forward + backward sweep. On Qwen3.6-35B-A3B, with everything else identical, that's a ~51× difference (Table 1).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we add a brief line explaining what the KL divergence sensitivity score represents?

Since we already define the AutoQuantize Gradient-based sensitivity earlier, this would give readers the full context for the comparison.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added this, could you take a look at the latest?

Signed-off-by: realAsma <akuriparambi@nvidia.com>
Comment thread docs/source/announcements/autoquantize.rst Outdated

A mixed-precision assignment is only useful if the runtime can execute it. So AutoQuantize performs a deployment-aware search — runtime coupling constraints are folded into the search rather than patched up afterwards, meaning the searched model is deployable out of the box in vLLM, SGLang, TensorRT-LLM, and similar inference runtimes. Any restriction of the form "this group of operators takes one joint format decision" becomes a merged knapsack item with aggregated sensitivity and cost.

**1) Joint quantization for fused linear layers.** Inference runtimes often fuse linear operators, which imposes a shared quantization format across the fused group. This constraint is applied within each layer: that layer's Q, K, and V projections are fused and must share one format, so the fused QKV projection becomes a single decision variable. The naive score would just sum the three per-projection sensitivities — but that treats their Hessians as independent, when the three outputs actually interact through the attention operation. Instead, AutoQuantize quantizes all three projections jointly with format :math:`f` and measures the sensitivity at the attention output, so the metric naturally captures how the projections' quantization errors combine through attention:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like there's no score rule to redirect QKV to an attention output, we only have that for MoEs: https://github.com/NVIDIA/Model-Optimizer/blob/main/modelopt/torch/quantization/algorithms.py#L1027

In my understanding the QKV will actually get a summed score

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, @meenchen had recently implemented that and found that it was better. So I am keeping that here instead of making it confusing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see, is it this PR:#1878? We should consider merging it if it works better :)

Comment thread docs/source/announcements/autoquantize.rst Outdated
Signed-off-by: realAsma <akuriparambi@nvidia.com>
Results
*******

.. image:: assets/autoquantize-qwen3-mmlu-effective-bits.png

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

BB: Can you get BF16 baselines for the models in the figure, regenerate this figure with BF16 baseline (plotted as a horizontal line) and send the figure to me in slack? Do not upload it here before my approval.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🤖 Bot comment.

🐝

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🤖 Bot comment.

I’ve queued the BF16 baseline runs and a regenerated figure with horizontal BF16 reference lines. I’ll send the candidate privately in Slack and will not upload it to this PR before your approval.

@meenchen meenchen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

High-priority documentation correctness findings are inline.

Results
*******

.. image:: assets/autoquantize-qwen3-mmlu-effective-bits.png

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This plot starts at 4.0, but current NVFP4 accounting is 4.5 bits including scale overhead.

Joint quantization for fused linear layers
===========================================

TensorRT-LLM fuses each layer's Q, K, and V projections, so AutoQuantize constrains the three projections to share one format. Sensitivity remains measured at each projection's individual module output, and the three scores are aggregated for the shared-format decision:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: this is not specific to TensorRT-LLM but applies to most of the inference libraries

Performance cost
================

ModelOpt uses *effective bits* as the cost: the total compressed model size, counting each weight's bit-width plus scale-factor overhead. Sweeping the budget over effective-bits targets directly controls model size and makes the accuracy-vs-compression frontier easy to interpret.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] “Total compressed model size” overstates what this constraint measures. The LP denominator includes only AutoQuantize-eligible quantizable weights, so embeddings, norms, and other excluded parameters are not counted. Format overhead is included when a format supplies an explicit effective_bits value; otherwise the implementation falls back to a num_bits heuristic. Could we describe this as a modeled average bit cost over eligible weights, with format-provided overhead where available?

AutoQuantize gradient is fast!
==============================

Direct sensitivity measurement runs the whole model once per layer per format. KL-divergence scoring is one such direct measurement: quantize one layer, run a forward pass, and compare the output distributions of the quantized and unquantized models. The gradient score instead scores all layers at once, so its cost scales with the number of formats, not the number of layers. On Qwen3.6-35B-A3B that is a ~51× difference (Table 1).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] “Cost scales with the number of formats, not the number of layers” contradicts both Table 1 and the implementation. For each scoring batch, the patched forward visits every score module and locally replays every candidate format, then performs one backward; the table’s O(N_layers × N_formats) is the correct total-work scaling. The saving is that AutoQuantize avoids a full-model evaluation per layer and format, not that layer scaling disappears. Please rephrase accordingly and change line 53 to “one backward pass per scoring batch.”

How AutoQuantize works
**********************

AutoQuantize is a neural architecture search (NAS) inspired method that works in three steps: score how sensitive each operation is to quantization, model the performance cost of each available format, and solve for the best layer-wise assignment under the cost budget with a knapsack-style optimization. The sensitivity score is a second-order Taylor approximation in the spirit of Optimal Brain Surgeon [1]_, as introduced in LLM-MQ [2]_.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] LLM-MQ does not introduce this second-order diagonal-Fisher score. Its §2.2, Eq. 1–2 uses the first-order weight-space score |g_iᵀ(W_i − Q_b(W_i))| and explicitly focuses on first-order information instead of the Hessian: https://nicsefc.ee.tsinghua.edu.cn/nics_file/pdf/5c805adc-b555-499f-9882-5ca35ce674b5.pdf. Please credit LLM-MQ for the mixed-precision allocation inspiration and cite the actual source for the output-side Fisher score.


The figure shows the accuracy-vs-compression frontier AutoQuantize traces on Qwen3 models: sweep the bit budget, solve at each point, evaluate on MMLU. Accuracy rises with the budget.

Two things to notice. First, the rise is essentially monotonic, which means the sensitivity score is ranking layers correctly — a noisy proxy would give a jagged frontier. Second, adding FP8 to the format menu helps: at every budget, searching over NVFP4, FP8, and BF16 matches or beats NVFP4 and BF16 alone. A sensitive layer doesn't need to fall back all the way to BF16 — FP8 is a good middle ground, protecting moderately sensitive layers at a fraction of the cost.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] These results do not form an empirical Pareto frontier or establish that the sensitivity ranking is correct. For example, Qwen3-1.7B at 6 bits (~55.0) dominates its 6.5–8-bit points, and Qwen3-14B drops from 7.5 to 8 bits. A solver optimum for the additive proxy is not necessarily Pareto-optimal in measured MMLU; without repeated runs or error bars, the dips could also be evaluation noise. Please call this a budget sweep or proxy-optimal assignment and soften the text to an overall upward trend, or add direct ranking validation.

Signed-off-by: realAsma <akuriparambi@nvidia.com>
@realAsma

Copy link
Copy Markdown
Contributor Author

/claude review

Comment thread docs/source/announcements/autoquantize.rst

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude review passed — no blocking issues found. LGTM

Scope: Documentation-only PR (3 files: new docs/source/announcements/autoquantize.rst, one PNG asset, and a landing-page card/filter in docs/source/index.rst). Reviewed the RST blog and index changes; the binary PNG was not opened.

What I verified:

  • The mtq.auto_quantize(...) code example matches the real public API: signature/argument names (constraints, quantization_formats, data_loader, forward_step, loss_func, num_calib_steps, num_score_steps), the model, search_state = ... return-value unpacking, and the NVFP4_DEFAULT_CFG/FP8_DEFAULT_CFG config constants all exist in modelopt/torch/quantization.
  • The sensitivity-score derivation (Taylor → OBS → diagonal-Fisher/squared-gradient approximation) is internally consistent and correctly presented.
  • The landing-page card in index.rst is consistent with the RST (title, date, tags, author order all match); newest-first ordering is preserved.

Findings (1 SUGGESTION, non-blocking):

  • The benchmark model name Qwen3.6-35B-A3B (Table 1 timing paragraph) does not correspond to a real Qwen3 release — the MoE model with 3B active params is Qwen3-30B-A3B. Since this is customer-facing published content, please confirm the exact model used and correct the identifier before publishing. (Inline comment posted.)

Risk: Low — docs-only, no code/API/state changes.

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.

4 participants