mirror of
https://github.com/NVIDIA/Model-Optimizer.git
synced 2026-10-02 03:14:52 +08:00
### What does this PR do?
Type of change: documentation
Adds a Local Hessian announcement blog at
`docs/source/announcements/local-hessian.rst`, covering the NVFP4
per-block
weight-scale rule that minimizes output error instead of weight error.
Contents:
- Derivation of the per-block output-error objective and its `16x16`
local
Hessian, with numbered equations.
- Results on Qwen3.5-9B: scale-setting comparison against max, MSE, and
Four-over-six, plus composition with GPTQ.
- Figure 1, a grouped bar chart of the Qwen3.8-27B W4A4 candidate scores
(BF16 in gray, the two scale rules in NVIDIA greens).
- A "Using Local Hessian" section with the config example and the
end-to-end `hf_ptq.py` command.
Two supporting changes outside the blog:
- `docs/source/_static/announcements.css`: the `shibuya` theme has no
`span.eqno` rule, so Sphinx's default `float: right` on equation numbers
cannot share a line with MathJax's full-width display block and the
number
renders *above* the equation. This anchors it to the right of the
equation
instead, and shrinks the table-note class.
-
`docs/source/announcements/assets/qwen3-27b-w4a4-scale-rule-accuracy.png`:
the Figure 1 asset.
### Usage
```python
import modelopt.torch.quantization as mtq
config = {
"quant_cfg": [...], # quantizer configuration
"algorithm": {"method": "local_hessian", "fp8_scale_sweep": True},
}
model = mtq.quantize(model, config, forward_loop)
```
### Testing
Documentation only; no code paths change. The `.rst` parses cleanly
under
docutils. The rendered page has not been checked with a full
`sphinx-build`,
so the equation-number CSS fix and the figure placement are worth an
eyeball
on the built docs before merge.
### Before your PR is "*Ready for review*"
- Is this change backward compatible?: N/A
- 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](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?:
N/A
- Did you get Claude approval on this PR?: ❌
### Additional Information
Two items to settle before this is ready to publish:
1. The `--recipe` example points at
`modelopt_recipes/models/Qwen/Qwen3.8-27B/ptq/nvfp4_local_hessian-fp8_attn-kv_fp8_cast.yaml`,
a placeholder path derived from the existing recipe naming convention.
It
needs to match whatever lands in #2363.
2. The tables report single-run team measurements; the blog says so and
makes
no significance claims.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Documentation**
- Added guidance on NVFP4 Local-Hessian weight-scale selection,
including mathematical details, accuracy comparisons, runtime
considerations, limitations, configuration examples, and reproduction
steps.
- Updated announcement labels, headings, metadata, descriptions, and
filtering text to use “Local-Hessian.”
- **Style**
- Improved announcement formatting for equation labels, display-equation
spacing, Hessian results, table headers, and explanatory notes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Signed-off-by: realAsma <akuriparambi@nvidia.com>
207 lines
4.2 KiB
CSS
207 lines
4.2 KiB
CSS
/* Scoped announcement styles using Shibuya's light and dark color tokens. */
|
|
|
|
#announcements > h1,
|
|
#announcements > p,
|
|
.announcement-section {
|
|
max-width: 860px;
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
}
|
|
|
|
.announcement-section {
|
|
width: 100%;
|
|
}
|
|
|
|
.announcement-toolbar {
|
|
border: 1px solid var(--sy-c-border);
|
|
border-radius: 4px;
|
|
margin: 1.5rem 0;
|
|
padding: 1rem;
|
|
background: var(--sy-c-background);
|
|
}
|
|
|
|
.announcement-search-label {
|
|
display: block;
|
|
font-weight: 700;
|
|
margin-bottom: 0.35rem;
|
|
}
|
|
|
|
.announcement-search {
|
|
box-sizing: border-box;
|
|
width: 100%;
|
|
padding: 0.55rem 0.65rem;
|
|
border: 1px solid var(--sy-c-border);
|
|
border-radius: 4px;
|
|
background: var(--sy-c-background);
|
|
color: var(--sy-c-text);
|
|
font-size: 1rem;
|
|
}
|
|
|
|
.announcement-tags {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 0.45rem;
|
|
margin-top: 0.75rem;
|
|
}
|
|
|
|
.announcement-tag {
|
|
border: 1px solid var(--sy-c-border);
|
|
border-radius: 999px;
|
|
padding: 0.28rem 0.65rem;
|
|
background: var(--sy-c-background);
|
|
color: var(--sy-c-text);
|
|
cursor: pointer;
|
|
font-size: 0.86rem;
|
|
}
|
|
|
|
.announcement-tag.is-active,
|
|
.announcement-tag:hover {
|
|
border-color: #76b900;
|
|
background: #76b900;
|
|
color: #111;
|
|
}
|
|
|
|
.announcement-grid {
|
|
display: grid;
|
|
grid-template-columns: minmax(0, 1fr);
|
|
gap: 1rem;
|
|
margin: 1rem 0 1.25rem;
|
|
}
|
|
|
|
.announcement-card {
|
|
border-bottom: 1px solid var(--sy-c-border);
|
|
padding: 0 0 1rem;
|
|
}
|
|
|
|
.announcement-card:last-child {
|
|
border-bottom: 0;
|
|
}
|
|
|
|
.announcement-card h2 {
|
|
margin-top: 0.25rem;
|
|
font-size: 1.2rem;
|
|
line-height: 1.35;
|
|
}
|
|
|
|
.announcement-card p {
|
|
margin-bottom: 0.75rem;
|
|
}
|
|
|
|
.announcement-card-meta {
|
|
color: var(--sy-c-light);
|
|
font-size: 0.85rem;
|
|
}
|
|
|
|
.announcement-card-tags {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 0.35rem;
|
|
}
|
|
|
|
.announcement-card-tags span {
|
|
border: 1px solid var(--sy-c-border);
|
|
border-radius: 999px;
|
|
color: var(--sy-c-light);
|
|
font-size: 0.78rem;
|
|
padding: 0.15rem 0.45rem;
|
|
}
|
|
|
|
.announcement-empty {
|
|
border-left: 4px solid #76b900;
|
|
padding-left: 0.75rem;
|
|
}
|
|
|
|
|
|
.announcement-pager {
|
|
align-items: center;
|
|
display: flex;
|
|
gap: 0.75rem;
|
|
justify-content: flex-end;
|
|
margin: 0 0 2rem;
|
|
}
|
|
|
|
.announcement-page-button {
|
|
border: 1px solid var(--sy-c-border);
|
|
border-radius: 4px;
|
|
background: var(--sy-c-background);
|
|
color: var(--sy-c-text);
|
|
cursor: pointer;
|
|
padding: 0.35rem 0.7rem;
|
|
}
|
|
|
|
.announcement-page-button:disabled {
|
|
cursor: not-allowed;
|
|
opacity: 0.45;
|
|
}
|
|
|
|
.announcement-page-status {
|
|
color: var(--sy-c-light);
|
|
font-size: 0.9rem;
|
|
}
|
|
|
|
.toctree-wrapper.compound:empty {
|
|
display: none;
|
|
}
|
|
|
|
/* Numbered equations: Sphinx's default `float: right` on the equation number
|
|
cannot share a line with MathJax's full-width display block, so the number
|
|
lands above the equation. Anchor it to the right of the equation instead. */
|
|
div.math {
|
|
position: relative;
|
|
}
|
|
|
|
div.math span.eqno {
|
|
float: none;
|
|
position: absolute;
|
|
right: 0;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
}
|
|
|
|
/* Display equations: shibuya gives `.yue .math-wrapper` a 2rem margin top and
|
|
bottom, and MathJax adds its own margin on the container inside it. The
|
|
wrapper sets `overflow-x: auto`, so none of it collapses with the
|
|
neighbouring paragraph margins and the gap around every equation ends up
|
|
oversized. Drop the MathJax margin and set the spacing on the wrapper. */
|
|
.yue .math-wrapper {
|
|
margin-top: 1rem;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.yue .math-wrapper mjx-container[display="true"] {
|
|
margin: 0;
|
|
}
|
|
|
|
.yue strong.local-hessian-result {
|
|
color: #76b900;
|
|
font-size: 1.15em;
|
|
font-weight: 900;
|
|
}
|
|
|
|
.table-header-note {
|
|
font-size: 0.75em;
|
|
font-weight: 400;
|
|
}
|
|
|
|
.table-note {
|
|
font-size: 0.75rem;
|
|
line-height: 1.4;
|
|
color: var(--sy-c-light);
|
|
}
|
|
|
|
/* A `.table-note` right after a table is that table's caption, so pull it up
|
|
against the table. Shibuya gives `.table-wrapper` a 2rem bottom margin; this
|
|
margin collapses with the note's own, so the negative value here nets out to
|
|
a small gap. The `.yue .table-wrapper +` prefix is needed to outrank the
|
|
theme's paragraph spacing, and keeps figure captions on default spacing. */
|
|
.yue .table-wrapper + p.table-note {
|
|
margin-top: -1.75rem;
|
|
}
|
|
|
|
.table-note strong,
|
|
.table-note code,
|
|
.table-note .math,
|
|
.table-note mjx-container {
|
|
font-size: inherit !important;
|
|
}
|