Skip to content

[OV] Allowed group-size weight compression for INT8 - #4278

Open
AsyaPronina wants to merge 2 commits into
openvinotoolkit:developfrom
AsyaPronina:allow_int8_group_size
Open

AsyaPronina wants to merge 2 commits into
openvinotoolkit:developfrom
AsyaPronina:allow_int8_group_size

Conversation

@AsyaPronina

@AsyaPronina AsyaPronina commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Changes

Group-size parameter is not prohibited now with INT8 weight compression mode.

Reason for changes

The change is required because LTX-2.3-Diffusers compressed in INT8_SYM group_size==32 mode shows better accuracy.

Related tickets

Tests

  • There are two new tests added that check the correctness of group-size INT8 compression on the test model and check that weights with no defined reduction axes got converted channel-wise.

Copilot AI balanced review requested due to automatic review settings October 21, 2026 20:08
@AsyaPronina
AsyaPronina requested a review from a team as a code owner October 21, 2026 20:08
@github-actions github-actions Bot added documentation Improvements or additions to documentation NNCF OpenVINO Pull requests that updates NNCF OpenVINO labels Oct 21, 2026
@github-actions github-actions Bot added the API Public API-impacting changes label Oct 21, 2026
@AsyaPronina
AsyaPronina force-pushed the allow_int8_group_size branch from 1e9c501 to 2033cdc Compare October 21, 2026 20:10

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.

🟢 Approval recommended

No blocking issues were identified, and focused tests cover INT8 grouping and convolution fallback.

No open issues 🎉

What changed in this PR

Enables group-wise INT8 weight compression for OpenVINO, supporting the accuracy improvement described for LTX-2.3-Diffusers.

Changes:

  • Allows INT8 grouping for weights with one reduction axis, retaining per-channel compression for others.
  • Rejects group-wise INT8 compression on other backends.
  • Adds correctness tests and usage documentation.
File Description
tests/​openvino/​native/​quantization/​test_weights_compression.py Tests INT8 grouping and per-channel convolution fallback.
src/​nncf/​quantization/​quantize_model.py Enforces the backend restriction and documents grouping.
src/​nncf/​quantization/​algorithms/​weight_compression/​algorithm.py Enables INT8 grouping and preserves per-channel fallback.
docs/​usage/​post_training_compression/​weights_compression/​Usage.md Documents support and adds a group-size example.

Review effort: Balanced

```python
from nncf import compress_weights, CompressWeightsMode

# model is openvino.Model object

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

remove comment from code block

Comment on lines 28 to +32
| Compression Mode | Element type | Scale type | Granularity | Supported backends | Description |
|------------------|--------------|------------|--------------------------|----------------------------------|----------------------------|
| INT8_ASYM | INT8 | FP16 | Per-channel | OpenVINO, PyTorch, ONNX, TorchFX | [Asymmetric quantization](/docs/usage/Quantization.md#asymmetric-quantization) |
| INT8_SYM | INT8 | FP16 | Per-channel | OpenVINO, PyTorch, ONNX, TorchFX | [Symmetric quantization](/docs/usage/Quantization.md#symmetric-quantization) |
| INT8_ASYM, INT8_SYM with `group_size` | INT8 | FP16 | Group-wise | OpenVINO | Weights with a single reduction axis (e.g. MatMul, Gather) are quantized group-wise, the others (e.g. Convolution) per-channel. |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
| INT8_ASYM, INT8_SYM with `group_size` | INT8 | FP16 | Group-wise | OpenVINO | Weights with a single reduction axis (e.g. MatMul, Gather) are quantized group-wise, the others (e.g. Convolution) per-channel. |
| Compression Mode | Element type | Scale type | Granularity | Supported backends | Description |
|---------------------|--------------|------------|--------------------------|----------------------------------|----------------------------|
| INT8_ASYM | INT8 | FP16 | Per-channel | OpenVINO, PyTorch, ONNX, TorchFX | [Asymmetric quantization](/docs/usage/Quantization.md#asymmetric-quantization) |
| INT8_SYM | INT8 | FP16 | Per-channel | OpenVINO, PyTorch, ONNX, TorchFX | [Symmetric quantization](/docs/usage/Quantization.md#symmetric-quantization) |
| INT8_ASYM, INT8_SYM | INT8 | FP16 | Group-wise | OpenVINO | Only for weights with a single reduction axis, other per-chanel |

Please the table alignment

return all_weight_params
# Group-wise quantization needs a single reduction axis. The other weights (e.g. of convolutions) keep
# the initial config from `_get_backup_config`: per-channel quantization in the same INT8 mode.
return [wp for wp in all_weight_params if len(wp.reduction_axes) == 1]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

-1 for reduction axies is defined group_size, there is no need to filter it and select backup mode
Just set -1 in place where crteates WeightCompressionParameters
dont need to modify _get_ratio_defining_params and _get_backup_config function

:type ratio: float
:param group_size: number of weights (e.g. 128) in the channel dimension that share quantization parameters (scale).
The value -1 means no grouping.
The value -1 means no grouping. INT8 modes are per-channel (-1) by default; with a group size (OpenVINO

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The docstrings do not include information about mods or any specific cases. FIt should be describved in documantaiton.

compressed_model = compress_weights(model, mode=mode, group_size=group_size)

nodes = {op.get_friendly_name(): op for op in compressed_model.get_ops()}
is_asym = mode == CompressWeightsMode.INT8_ASYM

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Look at how to collected reference data for scoped condig, instead of use many asserts
And add test to validate ScopedConfig with same configurations

@AlexanderDokuchaev AlexanderDokuchaev changed the title Allowed group-size weight compression for INT8 [OV] Allowed group-size weight compression for INT8 Oct 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API Public API-impacting changes documentation Improvements or additions to documentation NNCF OpenVINO Pull requests that updates NNCF OpenVINO

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants