Added int2 and int3 symmetric compression types for OV backend.#4123
Open
andreyanufr wants to merge 6 commits into
Open
Added int2 and int3 symmetric compression types for OV backend.#4123andreyanufr wants to merge 6 commits into
andreyanufr wants to merge 6 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends NNCF’s weight compression and tensor dtype support to include new low-bit symmetric integer modes (INT3_SYM and INT2_SYM) for the OpenVINO backend, and updates tests to cover/skip the new types appropriately.
Changes:
- Added
CompressWeightsMode.INT3_SYM/INT2_SYMand wired them into weight compression config (bit-width + dtype selection). - Added OpenVINO dtype mappings and a dedicated OpenVINO dequant subgraph path for “symmetric stored as unsigned” representations.
- Extended OpenVINO weight compression tests and adjusted cross-framework tensor template tests to account for the new dtypes.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/openvino/native/quantization/test_weights_compression.py | Adds test coverage for INT2/INT3 symmetric compression behavior. |
| tests/cross_fw/test_templates/template_test_nncf_tensor.py | Skips unsupported creation paths for TensorDataType.int2/int3 in generic tensor API templates. |
| src/nncf/tensor/functions/openvino_numeric.py | Introduces OpenVINO dtype mapping entries and cast handling for TensorDataType.int2/int3. |
| src/nncf/tensor/definitions.py | Adds TensorDataType.int2/int3 and their bit-size definitions. |
| src/nncf/quantization/algorithms/weight_compression/openvino_backend.py | Adds an INT2/INT3-specific biased-unsigned dequant path in the OpenVINO compression subgraph. |
| src/nncf/quantization/algorithms/weight_compression/config.py | Adds INT2/INT3 to num_bits and compression_dtype, plus a helper flag for biased-unsigned symmetric storage. |
| src/nncf/parameters.py | Exposes new public compression modes int2_sym and int3_sym. |
Comment on lines
103
to
+108
| INT8_SYM = "int8_sym" | ||
| INT8_ASYM = "int8_asym" | ||
| INT4_SYM = "int4_sym" | ||
| INT4_ASYM = "int4_asym" | ||
| INT3_SYM = "int3_sym" | ||
| INT2_SYM = "int2_sym" |
Comment on lines
+64
to
+79
| mode_to_bits_map = { | ||
| CompressWeightsMode.INT8_ASYM: 8, | ||
| CompressWeightsMode.INT8_SYM: 8, | ||
| CompressWeightsMode.INT4_SYM: 4, | ||
| CompressWeightsMode.INT4_ASYM: 4, | ||
| CompressWeightsMode.NF4: 4, | ||
| CompressWeightsMode.FP4: 4, | ||
| CompressWeightsMode.MXFP4: 4, | ||
| CompressWeightsMode.NVFP4: 4, | ||
| CompressWeightsMode.FP8_E4M3: 8, | ||
| CompressWeightsMode.MXFP8_E4M3: 8, | ||
| CompressWeightsMode.INT3_SYM: 3, | ||
| CompressWeightsMode.INT2_SYM: 2, | ||
| } | ||
|
|
||
| return mode_to_bits_map[self.mode] |
Comment on lines
+264
to
+266
| zero_point_const = opset.constant(offset, dtype=ov.Type.i8, name=f"{const_node_name}/zero_point") | ||
| zero_point_const = opset.convert(zero_point_const, ov.Type.f16) | ||
|
|
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.
Changes
Reason for changes
Related tickets
Tests