Add composable scale calibration to GPTQ#2004
Conversation
Signed-off-by: realAsma <akuriparambi@nvidia.com>
|
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. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
| is_quantized_linear(m) | ||
| and m.weight_quantizer.is_enabled | ||
| and any( | ||
| isinstance(q, TensorQuantizer) and (q.block_sizes or {}).get("four_over_six") |
There was a problem hiding this comment.
RB: Can you explain to me how exactly four_over_six is implemented in modelopt?
There was a problem hiding this comment.
🤖 Bot comment.
🐝 I’m tracing the four_over_six configuration through calibration, quantization, and packing now.
There was a problem hiding this comment.
🤖 Bot comment.
Blocked by Review Bee’s scope guard: GitHub reports PR #2004 is authored by realAsma, while Review Bee may only handle PRs authored by someone else. No PR changes were made.
What does this PR do?
Type of change: new feature
Adds a backward-compatible
scale_algorithmsub-config to GPTQ so its weight update can compose with Max, MSE, local Hessian, and activation-error-coupled local Hessian scale calibration. NVFP4 4/6 composes through its existing quantizer config plus MSE scale calibration.The historical GPTQ behavior remains unchanged when
scale_algorithmis omitted: GPTQ still runs Max calibration first. Fused GPTQ now rejects 4/6 explicitly because the current fused kernel assumes 448-normalized scaling while 4/6 uses 256.This is a stacked draft based on #1976 (
asma/activation-quant-aware-scale-setting), which provides local Hessian and the shared scale-calibration dispatcher.Usage
Use
{"method": "mse"}for MSE,{"method": "max"}for explicit Max, or combine the existing NVFP4 4/6 quantizer config with the MSE scale algorithm.Testing
pre-commit run --files CHANGELOG.rst modelopt/torch/quantization/config.py modelopt/torch/quantization/model_calib.py modelopt_recipes/ptq.md tests/gpu/torch/quantization/test_gptq.py tests/unit/torch/quantization/test_gptq.pypytest_pwd tests/unit/torch/quantization/test_gptq.py -q -x— 15 passedpytest_pwd tests/unit/torch/quantization/test_lsq.py -q -x— 49 passedpytest_pwd tests/unit/torch/quantization/test_config_validation.py -q -x— 79 passedGPU tests were added but not run locally because every visible GPU had active compute allocations and process ownership could not be established safely.
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.).CONTRIBUTING.md: N/AAdditional Information
The experiment launcher/config follow-up is intentionally deferred until the current GSM8K campaign completes. Layerwise-off ablations are deprioritized behind that sweep.