Repository navigation
Qualify dense INT2 PyTorch checkpoints - #2669
Closed
Ti-Tai Wang (titaiwangms) wants to merge 3 commits into
Closed
Ti-Tai Wang (titaiwangms) wants to merge 3 commits into
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>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Update the packing assertion to support valid padded, non-divisible shapes.
Pull request overview
Adds offline qualification tests for dense INT2 RTN checkpoint packing, serialization round-trips, and SelectiveMixedPrecision INT2/INT4/INT8 behavior.
Changes:
- Adds a local tiny dense Llama fixture.
- Validates packed buffers, metadata, reloads, and numerical fidelity.
- Tests mixed-precision RTN overrides.
File summaries
| File | Summary |
|---|---|
test/passes/pytorch/test_rtn.py |
Adds dense INT2 RTN and mixed-precision qualification tests. One assertion should account for padding in non-divisible packed dimensions. |
Review details
Suppressed comments (1)
test/passes/pytorch/test_rtn.py:475
- These assertions assume the unpacked last dimension is divisible by the packing factor, but
pack_to_uint8deliberately pads and storesceil(shape[-1] / packing_factor)bytes for valid non-divisible shapes. The current 32/64-wide fixture hides this mismatch; use a ceiling-sized expected shape and compare the packed element count against that so this helper validates (rather than rejects) legal checkpoints with padding.
packing_factor = 8 // bits
assert quant_tensor.shape[-1] % packing_factor == 0
assert quant_tensor.qweight.shape == (*quant_tensor.shape[:-1], quant_tensor.shape[-1] // packing_factor)
assert quant_tensor.qweight.numel() * packing_factor == quant_tensor.numel()
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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>
Ti-Tai Wang (titaiwangms)
marked this pull request as draft
September 17, 2026 17:47
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>
Ti-Tai Wang (titaiwangms)
marked this pull request as ready for review
September 17, 2026 20:25
Contributor
Author
|
Replaced by #2671, using an upstream |
Ti-Tai Wang (titaiwangms)
added a commit
to onnxruntime/mobius
that referenced
this pull request
Sep 22, 2026
## Summary - qualify synthetic Olive-format uniform INT2 checkpoints through the public local `build()` path - qualify mixed default INT2 with INT4 `down_proj` and INT8 `gate_proj` overrides - save and reload the Mobius package, then verify exact `MatMulNBits` attributes, input wiring, packed bytes, scales, and initializer binding - execute representative emitted INT2/INT4/INT8 projections explicitly on `CPUExecutionProvider` against an independent Olive-compatible decode ## Scope This validates the Olive checkpoint format/import/export contract and CPU operator semantics. It does **not** claim CUDA INT2 kernel readiness or performance, and it does not cover QMoE/fused MoE. No Mobius production changes were required after #733. ## Validation - `python -m pytest src/mobius/_component_quantization_loading_test.py -q --tb=short` (61 passed) - `python -m ruff check src/mobius/_component_quantization_loading_test.py` - `python -m ruff format --check src/mobius/_component_quantization_loading_test.py` - `git diff --check` Related: microsoft/onnxruntime#32657, microsoft/Olive#2669 --------- Signed-off-by: titaiwang <titaiwang@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.