Qualify dense INT2 PyTorch checkpoints - #2671
Ti-Tai Wang (titaiwangms) wants to merge 3 commits into
Conversation
Add offline uniform and selective mixed-precision checkpoint tests that verify actual packed weights, save/reload stability, effective per-module bit widths, and numerical reconstruction. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add offline dense INT2 and selective mixed-precision checkpoint coverage for native GPTQ and KQuant, sharing packing and reload assertions with RTN. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Avoid a Pylint false positive when computing the dense reference output in RTN and GPTQ checkpoint tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
An unresolved critical Ruff F401 finding remains.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds offline qualification tests for dense INT2 PyTorch RTN, GPTQ, KQuant, and mixed-precision checkpoints.
Changes:
- Adds local model, calibration, packing, and reload helpers.
- Verifies INT2 checkpoint packing, serialization, reconstruction, and execution.
- Adds SMP INT2/INT4/INT8 coverage.
- Critical: Remove the unused
pytestimport causing RuffF401.
File summaries
| File | Description |
|---|---|
test/passes/pytorch/test_rtn.py |
Adds RTN INT2 round-trip and mixed-precision coverage. |
test/passes/pytorch/test_dense_int2.py |
Adds GPTQ, KQuant, and SMP INT2 qualification tests. |
test/passes/pytorch/quantization_test_utils.py |
Provides local model, calibration, and packed-tensor helpers. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| # -------------------------------------------------------------------------- | ||
| from pathlib import Path | ||
|
|
||
| import torch |
|
Cross-repository real-model qualification completed locally with
The generated checkpoint and ONNX artifact were kept as local qualification artifacts and were not committed. |
|
Real-model SMP qualification also completed with the same pinned tiny Llama revision. Observed production behavior for this 2-layer model:
This verifies the real SMP-plan-to-RTN checkpoint path rather than assuming every layer receives the same high-precision override. |
Describe your changes
Add offline qualification coverage for the Olive side of the initial dense INT2 model-production workflow discussed in microsoft/onnxruntime#32657.
SelectiveMixedPrecisiondrives each quantizer with an INT2 default, an SMP-selected INT4 projection, and an explicit INT8 projection override.QuantTensorsettings and packed safetensors buffers instead of relying on checkpoint metadata alone.No production code changes were required: the existing native RTN, GPTQ, KQuant, SMP, serialization, and reload paths already materialize dense INT2 and mixed INT2/INT4/INT8 checkpoints correctly. Mobius export qualification, ONNX-native INT2 RTN, and MoE/QMoE remain separate follow-up work.
Validation:
Checklist before requesting a review
lintrunner -a. (Targeted Ruff checks pass; the existingtest_rtn.pyhas a pre-existing CPY001 finding.)(Optional) Issue link
Supports the INT2 model-production scope in microsoft/onnxruntime#32657.