Skip to content

Added int2 and int3 symmetric compression types for OV backend.#4123

Open
andreyanufr wants to merge 6 commits into
openvinotoolkit:developfrom
andreyanufr:aanuf/support_of_2_3_bit_sym
Open

Added int2 and int3 symmetric compression types for OV backend.#4123
andreyanufr wants to merge 6 commits into
openvinotoolkit:developfrom
andreyanufr:aanuf/support_of_2_3_bit_sym

Conversation

@andreyanufr

Copy link
Copy Markdown
Collaborator

Changes

Reason for changes

Related tickets

Tests

@github-actions github-actions Bot added the NNCF OpenVINO Pull requests that updates NNCF OpenVINO label Jul 2, 2026
@andreyanufr andreyanufr marked this pull request as ready for review July 2, 2026 12:44
@andreyanufr andreyanufr requested a review from a team as a code owner July 2, 2026 12:44
Copilot AI review requested due to automatic review settings July 2, 2026 12:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_SYM and 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 thread src/nncf/parameters.py
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 thread src/nncf/tensor/functions/openvino_numeric.py
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)

@github-actions github-actions Bot added the API Public API-impacting changes label Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API Public API-impacting changes NNCF OpenVINO Pull requests that updates NNCF OpenVINO

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants