Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[ONNX FE] Enable com.microsoft.GatherBlockQuantized Contrib Op Support (#37044)

Ankit Maheshkar19b7d8f2605e
diff --git a/docs/articles_en/documentation/compatibility-and-support/supported-operations.rst b/docs/articles_en/documentation/compatibility-and-support/supported-operations.rst
index 9836132766d..6ba684a164a 100644
--- a/docs/articles_en/documentation/compatibility-and-support/supported-operations.rst
+++ b/docs/articles_en/documentation/compatibility-and-support/supported-operations.rst
@@ -294,6 +294,7 @@ Data as of OpenVINO 2025.4.1 (December 18, 2025).
Fused_Conv
FusedGemm
FusedMatMul
+ GatherBlockQuantized
MatMulIntegerToFloat
MatMulNBits
Pad
diff --git a/src/frontends/onnx/docs/supported_ops.md b/src/frontends/onnx/docs/supported_ops.md
index 7521da35d54..67c7a94813f 100644
--- a/src/frontends/onnx/docs/supported_ops.md
+++ b/src/frontends/onnx/docs/supported_ops.md
@@ -243,6 +243,7 @@ OpenVINO provides support for operations of Default Opset (empty in table below)
|com.microsoft |FusedMatMul |1 |1 | |
|com.microsoft |FusedMatMulActivation | |1 | |
|com.microsoft |GatedRelativePositionBias | |1 | |
+|com.microsoft |GatherBlockQuantized |1 |1 | |
|com.microsoft |GatherND |1 |1 | |
|com.microsoft |Gelu |1 |1 | |
|com.microsoft |GemmFastGelu | |1 | |
diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/gather_block_quantized.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/gather_block_quantized.cpp
new file mode 100644
index 00000000000..d82c8152347
--- /dev/null
+++ b/src/frontends/onnx/frontend/src/op/com.microsoft/gather_block_quantized.cpp
@@ -0,0 +1,303 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include <cstdint>
+#include <memory>
+#include <vector>
+
+#include "core/operator_set.hpp"
+#include "exceptions.hpp"
+#include "openvino/decompositions/low_precision_dequantize.hpp"
+#include "openvino/op/constant.hpp"
+#include "openvino/op/convert.hpp"
+#include "openvino/op/gather.hpp"
+#include "openvino/op/reshape.hpp"
+#include "openvino/op/slice.hpp"
+#include "utils/common.hpp"
+
+namespace ov {
+namespace frontend {
+namespace onnx {
+namespace com_microsoft {
+namespace opset_1 {
+
+// com.microsoft.GatherBlockQuantized: a Gather over a block-quantized table.
+// https://github.com/microsoft/onnxruntime/blob/main/docs/ContribOperators.md#com.microsoft.GatherBlockQuantized
+//
+// The op is decomposed into native OpenVINO ops that the plugins' ConvertGatherToGatherCompressed pass folds
+// into the optimized internal GatherCompressed op:
+// reinterpret(data) -> low_precision_dequantize (Convert [-> Subtract(zp)] -> Multiply(scale)) ->
+// Reshape (back to the logical table) -> v8::Gather(gather_axis)
+// Dequantization follows ORT semantics: output = (data - zero_point) * scale, one scale per `block_size`
+// consecutive elements along `quantize_axis`. Default zero_point is 0 for int4/uint4 and 2^(bits-1) for uint8.
+// uint8 data may pack 8/bits sub-byte values per byte along the last dimension (bits 2/4, low-bits-first);
+// it is reinterpreted to the matching native u2/u4 type, and its packed zero_points are unpacked the same way.
+ov::OutputVector gather_block_quantized(const ov::frontend::onnx::Node& node) {
+ using namespace ov::op;
+ common::default_op_checks(node, 3);
+
+ const auto inputs = node.get_ov_inputs();
+ const auto& data = inputs[0]; // required, quantized table (int4/uint4/uint8)
+ const auto& indices = inputs[1]; // required, int32/int64
+ const auto& scales = inputs[2]; // required, f32/f16/bf16
+ ov::Output<ov::Node> zero_points; // optional, input[3], same type as data
+
+ const auto gather_axis_attr = node.get_attribute_value<int64_t>("gather_axis", 0);
+ const auto quantize_axis_attr = node.get_attribute_value<int64_t>("quantize_axis", 1);
+ const auto block_size = node.get_attribute_value<int64_t>("block_size", 128);
+ const auto bits = node.get_attribute_value<int64_t>("bits", 4);
+
+ // ---- data: constant of a supported quantized type with a static shape ----
+ CHECK_VALID_NODE(node,
+ ov::as_type<v0::Constant>(data.get_node()) != nullptr,
+ "GatherBlockQuantized: 'data' must be a constant");
+ const auto data_et = data.get_element_type();
+ CHECK_VALID_NODE(node,
+ data_et == ov::element::i4 || data_et == ov::element::u4 || data_et == ov::element::u8,
+ "GatherBlockQuantized: unsupported 'data' type, expected int4/uint4/uint8, got: ",
+ data_et);
+ const auto& data_pshape = data.get_partial_shape();
+ CHECK_VALID_NODE(node,
+ data_pshape.is_static(),
+ "GatherBlockQuantized: 'data' must have a static shape, got: ",
+ data_pshape);
+ const auto data_shape = data_pshape.get_shape();
+ const auto r = static_cast<int64_t>(data_shape.size());
+ CHECK_VALID_NODE(node, r >= 2, "GatherBlockQuantized: 'data' rank must be >= 2, got: ", r);
+
+ // ---- block_size / bits (mirror ORT contrib_defs.cc + CPU kernel) ----
+ CHECK_VALID_NODE(node,
+ block_size >= 16 && (block_size & (block_size - 1)) == 0,
+ "GatherBlockQuantized: 'block_size' must be a power of 2 and >= 16, got: ",
+ block_size);
+ const bool is_u8 = data_et == ov::element::u8;
+ if (is_u8) {
+ CHECK_VALID_NODE(node,
+ bits == 2 || bits == 4 || bits == 8,
+ "GatherBlockQuantized: for uint8 data 'bits' must be 2, 4 or 8, got: ",
+ bits);
+ } else {
+ CHECK_VALID_NODE(node, bits == 4, "GatherBlockQuantized: for int4/uint4 data 'bits' must be 4, got: ", bits);
+ }
+
+ // Native element type the packed 'data' is reinterpreted to, and how many logical values are packed per
+ // stored uint8 (1 for whole-byte uint8 and for int4/uint4, which are already native sub-byte constants).
+ // For uint8 with bits 2/4, each stored byte holds 8/bits values low-bits-first along the last dim, so we
+ // reinterpret to u2/u4 and expand the last dimension by 'components' (mirrors matmulnbits.cpp).
+ ov::element::Type reinterp_et = data_et;
+ int64_t components = 1;
+ if (is_u8 && bits != 8) {
+ components = 8 / bits;
+ reinterp_et = (bits == 2) ? ov::element::u2 : ov::element::u4;
+ }
+
+ // ---- normalize axes ----
+ CHECK_VALID_NODE(node,
+ gather_axis_attr >= -r && gather_axis_attr < r,
+ "GatherBlockQuantized: 'gather_axis' out of range [-r, r-1]: ",
+ gather_axis_attr);
+ CHECK_VALID_NODE(node,
+ quantize_axis_attr >= -r && quantize_axis_attr < r,
+ "GatherBlockQuantized: 'quantize_axis' out of range [-r, r-1]: ",
+ quantize_axis_attr);
+ const auto gather_axis = (gather_axis_attr + r) % r;
+ const auto quantize_axis = (quantize_axis_attr + r) % r;
+ CHECK_VALID_NODE(node,
+ gather_axis != quantize_axis,
+ "GatherBlockQuantized: 'gather_axis' and 'quantize_axis' must differ");
+ // 'quantize_axis' must be the last dimension. This matches the ORT CPU kernel's uint8 constraint and,
+ // for int4/uint4, guarantees numerical correctness of the compressed-gather fusion: the plugins'
+ // ConvertGatherToGatherCompressed collapses the reinterpreted [.., nb, block_size] table by merging its
+ // last two dimensions, which only reconstructs the logical table when the quantized axis is last.
+ // A non-last quantize_axis would otherwise silently mis-fuse on CPU/GPU (see the shape check below).
+ CHECK_VALID_NODE(node,
+ quantize_axis == r - 1,
+ "GatherBlockQuantized: 'quantize_axis' must be the last dimension, got: ",
+ quantize_axis,
+ " (rank ",
+ r,
+ ")");
+ if (is_u8) {
+ CHECK_VALID_NODE(node, gather_axis == 0, "GatherBlockQuantized: for uint8 data 'gather_axis' must be 0");
+ }
+
+ // Logical (unpacked) size of the quantized axis. For uint8 sub-byte data the stored dim is 'components'
+ // times smaller than the logical dim.
+ const int64_t quant_dim = static_cast<int64_t>(data_shape[static_cast<size_t>(quantize_axis)]) * components;
+ CHECK_VALID_NODE(node,
+ quant_dim % block_size == 0,
+ "GatherBlockQuantized: quantize dimension (",
+ quant_dim,
+ ") must be a multiple of block_size (",
+ block_size,
+ ")");
+ const int64_t nb = quant_dim / block_size;
+
+ // ---- scales: constant, matching rank, per-block along quantize_axis ----
+ CHECK_VALID_NODE(node,
+ ov::as_type<v0::Constant>(scales.get_node()) != nullptr,
+ "GatherBlockQuantized: 'scales' must be a constant");
+ const auto scales_et = scales.get_element_type();
+ CHECK_VALID_NODE(node,
+ scales_et == ov::element::f32 || scales_et == ov::element::f16 || scales_et == ov::element::bf16,
+ "GatherBlockQuantized: unsupported 'scales' type, expected f32/f16/bf16, got: ",
+ scales_et);
+ const auto& scales_pshape = scales.get_partial_shape();
+ CHECK_VALID_NODE(node,
+ scales_pshape.is_static(),
+ "GatherBlockQuantized: 'scales' must have a static shape, got: ",
+ scales_pshape);
+ const auto scales_shape = scales_pshape.get_shape();
+ CHECK_VALID_NODE(node,
+ static_cast<int64_t>(scales_shape.size()) == r,
+ "GatherBlockQuantized: 'scales' must have the same rank as 'data'");
+ for (int64_t i = 0; i < r; ++i) {
+ const auto expected = (i == quantize_axis) ? static_cast<size_t>(nb) : data_shape[static_cast<size_t>(i)];
+ CHECK_VALID_NODE(node,
+ scales_shape[static_cast<size_t>(i)] == expected,
+ "GatherBlockQuantized: 'scales' shape mismatch at axis ",
+ i,
+ ", expected ",
+ expected,
+ ", got ",
+ scales_shape[static_cast<size_t>(i)]);
+ }
+
+ // ---- indices ----
+ const auto indices_et = indices.get_element_type();
+ CHECK_VALID_NODE(
+ node,
+ indices_et == ov::element::i32 || indices_et == ov::element::i64 || indices_et == ov::element::dynamic,
+ "GatherBlockQuantized: 'indices' must be int32 or int64, got: ",
+ indices_et);
+
+ // ---- per-block split shapes ----
+ // data: [.., d_qa, ..] -> [.., nb, block_size, ..] (rank r+1)
+ // sc/zp: [.., nb, ..] -> [.., nb, 1, ..] (rank r+1, size-1 axis broadcasts over the block)
+ ov::Shape data_split_shape;
+ ov::Shape param_split_shape;
+ data_split_shape.reserve(static_cast<size_t>(r) + 1);
+ param_split_shape.reserve(static_cast<size_t>(r) + 1);
+ for (int64_t i = 0; i < r; ++i) {
+ if (i == quantize_axis) {
+ data_split_shape.push_back(static_cast<size_t>(nb));
+ data_split_shape.push_back(static_cast<size_t>(block_size));
+ param_split_shape.push_back(static_cast<size_t>(nb));
+ param_split_shape.push_back(1);
+ } else {
+ data_split_shape.push_back(data_shape[static_cast<size_t>(i)]);
+ param_split_shape.push_back(data_shape[static_cast<size_t>(i)]);
+ }
+ }
+
+ const auto data_const = ov::as_type_ptr<v0::Constant>(data.get_node_shared_ptr());
+ const auto scales_const = ov::as_type_ptr<v0::Constant>(scales.get_node_shared_ptr());
+
+ // Reinterpret 'data' as the per-block-split constant of the native (sub-)byte type. OpenVINO u2/u4/i4
+ // packing is low-bits-first, byte-identical to ORT; splitting/unpacking an axis is a pure contiguous
+ // reshape over the flat bitstream, so the raw byte buffer is reused verbatim (for uint8 sub-byte,
+ // reinterp_et is u2/u4 and the split shape already carries the unpacked, components-expanded size).
+ // The buffer is wrapped (not copied) by passing the source constant as the shared owner, which keeps it
+ // alive; this avoids duplicating a potentially large embedding table in memory.
+ auto data_split =
+ std::make_shared<v0::Constant>(reinterp_et, data_split_shape, data_const->get_data_ptr(), data_const);
+ // Preserve the original initializer name so downstream weight-sharing by name still works.
+ data_split->set_friendly_name(data_const->get_friendly_name());
+ data_split->get_output_tensor(0).set_names(data_const->get_output_tensor(0).get_names());
+
+ // Reinterpret 'scales' with an inserted size-1 block axis for per-block broadcast (buffer wrapped, not copied).
+ auto scales_split =
+ std::make_shared<v0::Constant>(scales_et, param_split_shape, scales_const->get_data_ptr(), scales_const);
+
+ // ---- zero point ----
+ ov::Output<ov::Node> zp_for_dequant;
+ if (common::is_input_valid(node, 3)) {
+ zero_points = inputs[3];
+ CHECK_VALID_NODE(node,
+ ov::as_type<v0::Constant>(zero_points.get_node()) != nullptr,
+ "GatherBlockQuantized: 'zero_points' must be a constant");
+ CHECK_VALID_NODE(node,
+ zero_points.get_element_type() == data_et,
+ "GatherBlockQuantized: 'zero_points' must have the same type as 'data', got: ",
+ zero_points.get_element_type());
+ const auto& zp_pshape = zero_points.get_partial_shape();
+ CHECK_VALID_NODE(node,
+ zp_pshape.is_static(),
+ "GatherBlockQuantized: 'zero_points' must have a static shape, got: ",
+ zp_pshape);
+ const auto zp_shape = zp_pshape.get_shape();
+ CHECK_VALID_NODE(node,
+ static_cast<int64_t>(zp_shape.size()) == r,
+ "GatherBlockQuantized: 'zero_points' must have the same rank as 'data'");
+ // zero_points match scales, except that for uint8 sub-byte data the per-block zero_points are
+ // themselves packed 'components'-per-byte along the quantize axis (ceil(nb / components) bytes).
+ const int64_t zp_qaxis_bytes = (nb + components - 1) / components;
+ for (int64_t i = 0; i < r; ++i) {
+ const auto expected =
+ (i == quantize_axis) ? static_cast<size_t>(zp_qaxis_bytes) : data_shape[static_cast<size_t>(i)];
+ CHECK_VALID_NODE(node,
+ zp_shape[static_cast<size_t>(i)] == expected,
+ "GatherBlockQuantized: 'zero_points' shape mismatch at axis ",
+ i,
+ ", expected ",
+ expected,
+ ", got ",
+ zp_shape[static_cast<size_t>(i)]);
+ }
+ const auto zp_const = ov::as_type_ptr<v0::Constant>(zero_points.get_node_shared_ptr());
+ if (components == 1) {
+ // int4/uint4/uint8(bits=8): one stored value per block, reinterpret directly to [.., nb, 1, ..].
+ zp_for_dequant =
+ std::make_shared<v0::Constant>(reinterp_et, param_split_shape, zp_const->get_data_ptr(), zp_const);
+ } else {
+ // uint8 sub-byte: reinterpret the packed zero_points to u2/u4 at the byte-aligned block count,
+ // convert to the dequant precision, then slice off the alignment padding down to nb blocks
+ // (mirrors matmulnbits.cpp; convert before slice to avoid slicing a sub-byte constant).
+ const int64_t aligned = zp_qaxis_bytes * components;
+ ov::Shape zp_aligned_shape = param_split_shape;
+ zp_aligned_shape[static_cast<size_t>(quantize_axis)] = static_cast<size_t>(aligned);
+ const auto zp_aligned =
+ std::make_shared<v0::Constant>(reinterp_et, zp_aligned_shape, zp_const->get_data_ptr(), zp_const);
+ ov::Output<ov::Node> zp_converted = std::make_shared<v0::Convert>(zp_aligned, scales_et);
+ if (aligned != nb) {
+ const auto start = v0::Constant::create(ov::element::i64, ov::Shape{1}, {0});
+ const auto stop = v0::Constant::create(ov::element::i64, ov::Shape{1}, {nb});
+ const auto step = v0::Constant::create(ov::element::i64, ov::Shape{1}, {1});
+ const auto slice_axis = v0::Constant::create(ov::element::i64, ov::Shape{1}, {quantize_axis});
+ zp_converted = std::make_shared<v8::Slice>(zp_converted, start, stop, step, slice_axis);
+ }
+ zp_for_dequant = zp_converted;
+ }
+ } else if (is_u8) {
+ // Default uint8 zero point is 2^(bits-1); subtract it even in the "symmetric" case.
+ const int32_t default_zp = 1 << (static_cast<int>(bits) - 1);
+ zp_for_dequant = std::make_shared<v0::Constant>(reinterp_et, ov::Shape{1}, default_zp);
+ }
+ // int4/uint4 with no zero_points -> default zero point 0 -> leave zp empty so the Subtract is omitted
+ // (symmetric dequantization; this is the clean form the compressed-gather fusion prefers).
+
+ // Dequantize: Multiply(Subtract(Convert(data), zp), scale) or, without zp, Multiply(Convert(data), scale).
+ // Output element type follows 'scales'.
+ auto dequant = ov::decomposition::low_precision_dequantize(data_split, scales_split, zp_for_dequant);
+
+ // Reshape the dequantized blocks back to the logical table shape. For the rank-2 embedding case this is the
+ // 3D->2D reshape that ConvertGatherToGatherCompressed folds together with the Gather into GatherCompressed.
+ // The (last) quantized axis uses its unpacked size (quant_dim = stored_dim * components).
+ std::vector<int64_t> logical_dims(data_shape.begin(), data_shape.end());
+ logical_dims[static_cast<size_t>(quantize_axis)] = quant_dim;
+ const auto table_shape = v0::Constant::create(ov::element::i64, ov::Shape{logical_dims.size()}, logical_dims);
+ const auto table = std::make_shared<v1::Reshape>(dequant, table_shape, false);
+
+ // Gather on gather_axis. v8::Gather natively handles negative indices, matching ORT.
+ const auto axis = v0::Constant::create(ov::element::i64, ov::Shape{}, {gather_axis});
+ return {std::make_shared<v8::Gather>(table, indices, axis)};
+}
+
+ONNX_OP("GatherBlockQuantized", OPSET_SINCE(1), com_microsoft::opset_1::gather_block_quantized, MICROSOFT_DOMAIN);
+
+} // namespace opset_1
+} // namespace com_microsoft
+} // namespace onnx
+} // namespace frontend
+} // namespace ov
diff --git a/src/frontends/onnx/tests/CMakeLists.txt b/src/frontends/onnx/tests/CMakeLists.txt
index ff240c5cb97..b6977a5feca 100644
--- a/src/frontends/onnx/tests/CMakeLists.txt
+++ b/src/frontends/onnx/tests/CMakeLists.txt
@@ -68,6 +68,7 @@ set(SRC
conversion.cpp
convert_tests.cpp
convert_partially_tests.cpp
+ gather_block_quantized_tests.cpp
graph_iterator.cpp
library_extension.cpp
load_from.cpp
diff --git a/src/frontends/onnx/tests/gather_block_quantized_tests.cpp b/src/frontends/onnx/tests/gather_block_quantized_tests.cpp
new file mode 100644
index 00000000000..c8c81b2faa5
--- /dev/null
+++ b/src/frontends/onnx/tests/gather_block_quantized_tests.cpp
@@ -0,0 +1,82 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include <gtest/gtest.h>
+
+#include <memory>
+
+#include "common_test_utils/ov_test_utils.hpp"
+#include "onnx_utils.hpp"
+#include "openvino/op/gather.hpp"
+#include "openvino/op/multiply.hpp"
+#include "openvino/op/subtract.hpp"
+#include "openvino/pass/manager.hpp"
+#include "ov_ops/gather_compressed.hpp"
+#include "transformations/op_conversions/convert_gather_to_compressed.hpp"
+
+using namespace ov::frontend::onnx::tests;
+
+// These tests verify that the com.microsoft.GatherBlockQuantized translator emits a decomposition that the
+// plugins' ConvertGatherToGatherCompressed pass actually recognizes and folds into the internal
+// GatherCompressed op. Converting the real .onnx model (rather than a hand-built graph) exercises the exact
+// pattern the frontend produces.
+namespace {
+std::shared_ptr<ov::Model> convert_and_fuse(const std::string& model_path) {
+ auto model = convert_model(model_path);
+ ov::pass::Manager manager;
+ manager.register_pass<ov::pass::ConvertGatherToGatherCompressed>();
+ manager.run_passes(model);
+ return model;
+}
+} // namespace
+
+// int4 data, no zero_points -> symmetric decomposition (Multiply(Convert(data), scale) -> Reshape -> Gather).
+// The whole subgraph must fold into a single GatherCompressed with no leftover Gather/Multiply.
+TEST(ONNXFeGatherBlockQuantized, int4_no_zp_fuses_into_gather_compressed) {
+ std::shared_ptr<ov::Model> model;
+ OV_ASSERT_NO_THROW(model = convert_and_fuse("com.microsoft/gather_block_quantized_int4.onnx"));
+ ASSERT_TRUE(model);
+
+ EXPECT_EQ(count_ops_of_type<ov::op::internal::GatherCompressed>(model), 1);
+ EXPECT_EQ(count_ops_of_type<ov::op::v8::Gather>(model), 0);
+ EXPECT_EQ(count_ops_of_type<ov::op::v1::Multiply>(model), 0);
+ EXPECT_EQ(count_ops_of_type<ov::op::v1::Subtract>(model), 0);
+}
+
+// int4 data with zero_points -> asymmetric decomposition (Multiply(Subtract(Convert(data), zp), scale) ->
+// Reshape -> Gather). It must fold into a GatherCompressed (with a zero_point input) and leave no standalone
+// Gather/Multiply/Subtract behind.
+TEST(ONNXFeGatherBlockQuantized, int4_with_zp_fuses_into_gather_compressed) {
+ std::shared_ptr<ov::Model> model;
+ OV_ASSERT_NO_THROW(model = convert_and_fuse("com.microsoft/gather_block_quantized_int4_zp.onnx"));
+ ASSERT_TRUE(model);
+
+ EXPECT_EQ(count_ops_of_type<ov::op::internal::GatherCompressed>(model), 1);
+ EXPECT_EQ(count_ops_of_type<ov::op::v8::Gather>(model), 0);
+ EXPECT_EQ(count_ops_of_type<ov::op::v1::Multiply>(model), 0);
+ EXPECT_EQ(count_ops_of_type<ov::op::v1::Subtract>(model), 0);
+}
+
+// uint4 data, no zero_points -> same symmetric fusable pattern as int4.
+TEST(ONNXFeGatherBlockQuantized, uint4_no_zp_fuses_into_gather_compressed) {
+ std::shared_ptr<ov::Model> model;
+ OV_ASSERT_NO_THROW(model = convert_and_fuse("com.microsoft/gather_block_quantized_uint4.onnx"));
+ ASSERT_TRUE(model);
+
+ EXPECT_EQ(count_ops_of_type<ov::op::internal::GatherCompressed>(model), 1);
+ EXPECT_EQ(count_ops_of_type<ov::op::v8::Gather>(model), 0);
+ EXPECT_EQ(count_ops_of_type<ov::op::v1::Multiply>(model), 0);
+}
+
+// float16 scales -> the dequant runs in f16 and the Gather is on f16 directly (no trailing Convert to f32);
+// the pattern must still fold into GatherCompressed.
+TEST(ONNXFeGatherBlockQuantized, int4_f16_scales_fuses_into_gather_compressed) {
+ std::shared_ptr<ov::Model> model;
+ OV_ASSERT_NO_THROW(model = convert_and_fuse("com.microsoft/gather_block_quantized_int4_f16.onnx"));
+ ASSERT_TRUE(model);
+
+ EXPECT_EQ(count_ops_of_type<ov::op::internal::GatherCompressed>(model), 1);
+ EXPECT_EQ(count_ops_of_type<ov::op::v8::Gather>(model), 0);
+ EXPECT_EQ(count_ops_of_type<ov::op::v1::Multiply>(model), 0);
+}
diff --git a/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_bf16.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_bf16.prototxt
new file mode 100644
index 00000000000..edc995f87a9
--- /dev/null
+++ b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_bf16.prototxt
@@ -0,0 +1,84 @@
+ir_version: 10
+producer_name: "OpenVINO ONNX Frontend"
+graph {
+ node {
+ input: "data"
+ input: "indices"
+ input: "scales"
+ output: "output"
+ op_type: "GatherBlockQuantized"
+ attribute {
+ name: "bits"
+ i: 4
+ type: INT
+ }
+ attribute {
+ name: "block_size"
+ i: 16
+ type: INT
+ }
+ attribute {
+ name: "gather_axis"
+ i: 0
+ type: INT
+ }
+ attribute {
+ name: "quantize_axis"
+ i: 1
+ type: INT
+ }
+ domain: "com.microsoft"
+ }
+ name: "gbq_bf16"
+ initializer {
+ dims: 2
+ dims: 32
+ data_type: 22
+ name: "data"
+ raw_data: "\"\"\"\"\"\"\"\"\377\377\377\377\377\377\377\377\021\021\021\021\021\021\021\02133333333"
+ }
+ initializer {
+ dims: 2
+ dims: 2
+ data_type: 16
+ name: "scales"
+ raw_data: "\000?\200@\000@\200>"
+ }
+ input {
+ name: "indices"
+ type {
+ tensor_type {
+ elem_type: 6
+ shape {
+ dim {
+ dim_value: 2
+ }
+ }
+ }
+ }
+ }
+ output {
+ name: "output"
+ type {
+ tensor_type {
+ elem_type: 16
+ shape {
+ dim {
+ dim_value: 2
+ }
+ dim {
+ dim_value: 32
+ }
+ }
+ }
+ }
+ }
+}
+opset_import {
+ domain: ""
+ version: 21
+}
+opset_import {
+ domain: "com.microsoft"
+ version: 1
+}
diff --git a/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_indices_2d.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_indices_2d.prototxt
new file mode 100644
index 00000000000..190359e011e
--- /dev/null
+++ b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_indices_2d.prototxt
@@ -0,0 +1,90 @@
+ir_version: 10
+producer_name: "OpenVINO ONNX Frontend"
+graph {
+ node {
+ input: "data"
+ input: "indices"
+ input: "scales"
+ output: "output"
+ op_type: "GatherBlockQuantized"
+ attribute {
+ name: "bits"
+ i: 4
+ type: INT
+ }
+ attribute {
+ name: "block_size"
+ i: 16
+ type: INT
+ }
+ attribute {
+ name: "gather_axis"
+ i: 0
+ type: INT
+ }
+ attribute {
+ name: "quantize_axis"
+ i: 1
+ type: INT
+ }
+ domain: "com.microsoft"
+ }
+ name: "gbq_indices2d"
+ initializer {
+ dims: 2
+ dims: 32
+ data_type: 22
+ name: "data"
+ raw_data: "\"\"\"\"\"\"\"\"\377\377\377\377\377\377\377\377\021\021\021\021\021\021\021\02133333333"
+ }
+ initializer {
+ dims: 2
+ dims: 2
+ data_type: 1
+ name: "scales"
+ raw_data: "\000\000\000?\000\000\200@\000\000\000@\000\000\200>"
+ }
+ input {
+ name: "indices"
+ type {
+ tensor_type {
+ elem_type: 7
+ shape {
+ dim {
+ dim_value: 2
+ }
+ dim {
+ dim_value: 2
+ }
+ }
+ }
+ }
+ }
+ output {
+ name: "output"
+ type {
+ tensor_type {
+ elem_type: 1
+ shape {
+ dim {
+ dim_value: 2
+ }
+ dim {
+ dim_value: 2
+ }
+ dim {
+ dim_value: 32
+ }
+ }
+ }
+ }
+ }
+}
+opset_import {
+ domain: ""
+ version: 21
+}
+opset_import {
+ domain: "com.microsoft"
+ version: 1
+}
diff --git a/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_int4.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_int4.prototxt
new file mode 100644
index 00000000000..f8927bbb472
--- /dev/null
+++ b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_int4.prototxt
@@ -0,0 +1,86 @@
+ir_version: 10
+producer_name: "OpenVINO ONNX Frontend"
+producer_version: ""
+model_version: 0
+graph {
+ node {
+ input: "data"
+ input: "indices"
+ input: "scales"
+ output: "output"
+ op_type: "GatherBlockQuantized"
+ attribute {
+ name: "bits"
+ i: 4
+ type: INT
+ }
+ attribute {
+ name: "block_size"
+ i: 16
+ type: INT
+ }
+ attribute {
+ name: "gather_axis"
+ i: 0
+ type: INT
+ }
+ attribute {
+ name: "quantize_axis"
+ i: 1
+ type: INT
+ }
+ domain: "com.microsoft"
+ }
+ name: "gather_block_quantized_int4"
+ initializer {
+ dims: 2
+ dims: 32
+ data_type: 22
+ name: "data"
+ raw_data: "\"\"\"\"\"\"\"\"\377\377\377\377\377\377\377\377\021\021\021\021\021\021\021\02133333333"
+ }
+ initializer {
+ dims: 2
+ dims: 2
+ data_type: 1
+ name: "scales"
+ raw_data: "\000\000\000?\000\000\200@\000\000\000@\000\000\200>"
+ }
+ input {
+ name: "indices"
+ type {
+ tensor_type {
+ elem_type: 6
+ shape {
+ dim {
+ dim_value: 2
+ }
+ }
+ }
+ }
+ }
+ output {
+ name: "output"
+ type {
+ tensor_type {
+ elem_type: 1
+ shape {
+ dim {
+ dim_value: 2
+ }
+ dim {
+ dim_value: 32
+ }
+ }
+ }
+ }
+ }
+}
+opset_import {
+ domain: ""
+ version: 21
+}
+opset_import {
+ domain: "com.microsoft"
+ version: 1
+}
diff --git a/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_int4_f16.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_int4_f16.prototxt
new file mode 100644
index 00000000000..b8aabd02d42
--- /dev/null
+++ b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_int4_f16.prototxt
@@ -0,0 +1,86 @@
+ir_version: 10
+producer_name: "OpenVINO ONNX Frontend"
+producer_version: ""
+model_version: 0
+graph {
+ node {
+ input: "data"
+ input: "indices"
+ input: "scales"
+ output: "output"
+ op_type: "GatherBlockQuantized"
+ attribute {
+ name: "bits"
+ i: 4
+ type: INT
+ }
+ attribute {
+ name: "block_size"
+ i: 16
+ type: INT
+ }
+ attribute {
+ name: "gather_axis"
+ i: 0
+ type: INT
+ }
+ attribute {
+ name: "quantize_axis"
+ i: 1
+ type: INT
+ }
+ domain: "com.microsoft"
+ }
+ name: "gather_block_quantized_int4_f16"
+ initializer {
+ dims: 2
+ dims: 32
+ data_type: 22
+ name: "data"
+ raw_data: "\"\"\"\"\"\"\"\"\377\377\377\377\377\377\377\377\021\021\021\021\021\021\021\02133333333"
+ }
+ initializer {
+ dims: 2
+ dims: 2
+ data_type: 10
+ name: "scales"
+ raw_data: "\0008\000D\000@\0004"
+ }
+ input {
+ name: "indices"
+ type {
+ tensor_type {
+ elem_type: 6
+ shape {
+ dim {
+ dim_value: 2
+ }
+ }
+ }
+ }
+ }
+ output {
+ name: "output"
+ type {
+ tensor_type {
+ elem_type: 10
+ shape {
+ dim {
+ dim_value: 2
+ }
+ dim {
+ dim_value: 32
+ }
+ }
+ }
+ }
+ }
+}
+opset_import {
+ domain: ""
+ version: 21
+}
+opset_import {
+ domain: "com.microsoft"
+ version: 1
+}
diff --git a/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_int4_zp.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_int4_zp.prototxt
new file mode 100644
index 00000000000..d68e788ff8f
--- /dev/null
+++ b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_int4_zp.prototxt
@@ -0,0 +1,94 @@
+ir_version: 10
+producer_name: "OpenVINO ONNX Frontend"
+producer_version: ""
+model_version: 0
+graph {
+ node {
+ input: "data"
+ input: "indices"
+ input: "scales"
+ input: "zero_points"
+ output: "output"
+ op_type: "GatherBlockQuantized"
+ attribute {
+ name: "bits"
+ i: 4
+ type: INT
+ }
+ attribute {
+ name: "block_size"
+ i: 16
+ type: INT
+ }
+ attribute {
+ name: "gather_axis"
+ i: 0
+ type: INT
+ }
+ attribute {
+ name: "quantize_axis"
+ i: 1
+ type: INT
+ }
+ domain: "com.microsoft"
+ }
+ name: "gather_block_quantized_int4_zp"
+ initializer {
+ dims: 2
+ dims: 32
+ data_type: 22
+ name: "data"
+ raw_data: "\"\"\"\"\"\"\"\"\377\377\377\377\377\377\377\377\021\021\021\021\021\021\021\02133333333"
+ }
+ initializer {
+ dims: 2
+ dims: 2
+ data_type: 1
+ name: "scales"
+ raw_data: "\000\000\000?\000\000\200@\000\000\000@\000\000\200>"
+ }
+ initializer {
+ dims: 2
+ dims: 2
+ data_type: 22
+ name: "zero_points"
+ raw_data: "!\020"
+ }
+ input {
+ name: "indices"
+ type {
+ tensor_type {
+ elem_type: 6
+ shape {
+ dim {
+ dim_value: 2
+ }
+ }
+ }
+ }
+ }
+ output {
+ name: "output"
+ type {
+ tensor_type {
+ elem_type: 1
+ shape {
+ dim {
+ dim_value: 2
+ }
+ dim {
+ dim_value: 32
+ }
+ }
+ }
+ }
+ }
+}
+opset_import {
+ domain: ""
+ version: 21
+}
+opset_import {
+ domain: "com.microsoft"
+ version: 1
+}
diff --git a/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_neg_axis.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_neg_axis.prototxt
new file mode 100644
index 00000000000..1ba93e94993
--- /dev/null
+++ b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_neg_axis.prototxt
@@ -0,0 +1,86 @@
+ir_version: 10
+producer_name: "OpenVINO ONNX Frontend"
+producer_version: ""
+model_version: 0
+graph {
+ node {
+ input: "data"
+ input: "indices"
+ input: "scales"
+ output: "output"
+ op_type: "GatherBlockQuantized"
+ attribute {
+ name: "bits"
+ i: 4
+ type: INT
+ }
+ attribute {
+ name: "block_size"
+ i: 16
+ type: INT
+ }
+ attribute {
+ name: "gather_axis"
+ i: 0
+ type: INT
+ }
+ attribute {
+ name: "quantize_axis"
+ i: -1
+ type: INT
+ }
+ domain: "com.microsoft"
+ }
+ name: "gather_block_quantized_neg_axis"
+ initializer {
+ dims: 2
+ dims: 32
+ data_type: 22
+ name: "data"
+ raw_data: "\"\"\"\"\"\"\"\"\377\377\377\377\377\377\377\377\021\021\021\021\021\021\021\02133333333"
+ }
+ initializer {
+ dims: 2
+ dims: 2
+ data_type: 1
+ name: "scales"
+ raw_data: "\000\000\000?\000\000\200@\000\000\000@\000\000\200>"
+ }
+ input {
+ name: "indices"
+ type {
+ tensor_type {
+ elem_type: 6
+ shape {
+ dim {
+ dim_value: 2
+ }
+ }
+ }
+ }
+ }
+ output {
+ name: "output"
+ type {
+ tensor_type {
+ elem_type: 1
+ shape {
+ dim {
+ dim_value: 2
+ }
+ dim {
+ dim_value: 32
+ }
+ }
+ }
+ }
+ }
+}
+opset_import {
+ domain: ""
+ version: 21
+}
+opset_import {
+ domain: "com.microsoft"
+ version: 1
+}
diff --git a/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_quantize_axis_not_last.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_quantize_axis_not_last.prototxt
new file mode 100644
index 00000000000..f8a11b47b90
--- /dev/null
+++ b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_quantize_axis_not_last.prototxt
@@ -0,0 +1,84 @@
+ir_version: 10
+producer_name: "OpenVINO ONNX Frontend"
+graph {
+ node {
+ input: "data"
+ input: "indices"
+ input: "scales"
+ output: "output"
+ op_type: "GatherBlockQuantized"
+ attribute {
+ name: "bits"
+ i: 4
+ type: INT
+ }
+ attribute {
+ name: "block_size"
+ i: 16
+ type: INT
+ }
+ attribute {
+ name: "gather_axis"
+ i: 1
+ type: INT
+ }
+ attribute {
+ name: "quantize_axis"
+ i: 0
+ type: INT
+ }
+ domain: "com.microsoft"
+ }
+ name: "gbq_qaxis_not_last"
+ initializer {
+ dims: 32
+ dims: 4
+ data_type: 22
+ name: "data"
+ raw_data: "\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021\021"
+ }
+ initializer {
+ dims: 2
+ dims: 4
+ data_type: 1
+ name: "scales"
+ raw_data: "\000\000\200?\000\000\200?\000\000\200?\000\000\200?\000\000\200?\000\000\200?\000\000\200?\000\000\200?"
+ }
+ input {
+ name: "indices"
+ type {
+ tensor_type {
+ elem_type: 6
+ shape {
+ dim {
+ dim_value: 2
+ }
+ }
+ }
+ }
+ }
+ output {
+ name: "output"
+ type {
+ tensor_type {
+ elem_type: 1
+ shape {
+ dim {
+ dim_value: 32
+ }
+ dim {
+ dim_value: 2
+ }
+ }
+ }
+ }
+ }
+}
+opset_import {
+ domain: ""
+ version: 21
+}
+opset_import {
+ domain: "com.microsoft"
+ version: 1
+}
diff --git a/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_uint4.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_uint4.prototxt
new file mode 100644
index 00000000000..0937b4dcce6
--- /dev/null
+++ b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_uint4.prototxt
@@ -0,0 +1,86 @@
+ir_version: 10
+producer_name: "OpenVINO ONNX Frontend"
+producer_version: ""
+model_version: 0
+graph {
+ node {
+ input: "data"
+ input: "indices"
+ input: "scales"
+ output: "output"
+ op_type: "GatherBlockQuantized"
+ attribute {
+ name: "bits"
+ i: 4
+ type: INT
+ }
+ attribute {
+ name: "block_size"
+ i: 16
+ type: INT
+ }
+ attribute {
+ name: "gather_axis"
+ i: 0
+ type: INT
+ }
+ attribute {
+ name: "quantize_axis"
+ i: 1
+ type: INT
+ }
+ domain: "com.microsoft"
+ }
+ name: "gather_block_quantized_uint4"
+ initializer {
+ dims: 2
+ dims: 32
+ data_type: 21
+ name: "data"
+ raw_data: "\"\"\"\"\"\"\"\"\377\377\377\377\377\377\377\377\021\021\021\021\021\021\021\02133333333"
+ }
+ initializer {
+ dims: 2
+ dims: 2
+ data_type: 1
+ name: "scales"
+ raw_data: "\000\000\000?\000\000\200@\000\000\000@\000\000\200>"
+ }
+ input {
+ name: "indices"
+ type {
+ tensor_type {
+ elem_type: 7
+ shape {
+ dim {
+ dim_value: 2
+ }
+ }
+ }
+ }
+ }
+ output {
+ name: "output"
+ type {
+ tensor_type {
+ elem_type: 1
+ shape {
+ dim {
+ dim_value: 2
+ }
+ dim {
+ dim_value: 32
+ }
+ }
+ }
+ }
+ }
+}
+opset_import {
+ domain: ""
+ version: 21
+}
+opset_import {
+ domain: "com.microsoft"
+ version: 1
+}
diff --git a/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_uint8.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_uint8.prototxt
new file mode 100644
index 00000000000..820c36735e3
--- /dev/null
+++ b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_uint8.prototxt
@@ -0,0 +1,86 @@
+ir_version: 10
+producer_name: "OpenVINO ONNX Frontend"
+producer_version: ""
+model_version: 0
+graph {
+ node {
+ input: "data"
+ input: "indices"
+ input: "scales"
+ output: "output"
+ op_type: "GatherBlockQuantized"
+ attribute {
+ name: "bits"
+ i: 8
+ type: INT
+ }
+ attribute {
+ name: "block_size"
+ i: 16
+ type: INT
+ }
+ attribute {
+ name: "gather_axis"
+ i: 0
+ type: INT
+ }
+ attribute {
+ name: "quantize_axis"
+ i: 1
+ type: INT
+ }
+ domain: "com.microsoft"
+ }
+ name: "gather_block_quantized_uint8"
+ initializer {
+ dims: 2
+ dims: 32
+ data_type: 2
+ name: "data"
+ raw_data: "\202\202\202\202\202\202\202\202\202\202\202\202\202\202\202\202||||||||||||||||\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\210\210\210\210\210\210\210\210\210\210\210\210\210\210\210\210"
+ }
+ initializer {
+ dims: 2
+ dims: 2
+ data_type: 1
+ name: "scales"
+ raw_data: "\000\000\000?\000\000\200@\000\000\000@\000\000\200>"
+ }
+ input {
+ name: "indices"
+ type {
+ tensor_type {
+ elem_type: 6
+ shape {
+ dim {
+ dim_value: 2
+ }
+ }
+ }
+ }
+ }
+ output {
+ name: "output"
+ type {
+ tensor_type {
+ elem_type: 1
+ shape {
+ dim {
+ dim_value: 2
+ }
+ dim {
+ dim_value: 32
+ }
+ }
+ }
+ }
+ }
+}
+opset_import {
+ domain: ""
+ version: 21
+}
+opset_import {
+ domain: "com.microsoft"
+ version: 1
+}
diff --git a/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_uint8_bits2.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_uint8_bits2.prototxt
new file mode 100644
index 00000000000..8ec9ffa8f64
--- /dev/null
+++ b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_uint8_bits2.prototxt
@@ -0,0 +1,84 @@
+ir_version: 10
+producer_name: "OpenVINO ONNX Frontend"
+graph {
+ node {
+ input: "data"
+ input: "indices"
+ input: "scales"
+ output: "output"
+ op_type: "GatherBlockQuantized"
+ attribute {
+ name: "bits"
+ i: 2
+ type: INT
+ }
+ attribute {
+ name: "block_size"
+ i: 16
+ type: INT
+ }
+ attribute {
+ name: "gather_axis"
+ i: 0
+ type: INT
+ }
+ attribute {
+ name: "quantize_axis"
+ i: 1
+ type: INT
+ }
+ domain: "com.microsoft"
+ }
+ name: "gather_block_quantized_uint8_bits2"
+ initializer {
+ dims: 2
+ dims: 8
+ data_type: 2
+ name: "data"
+ raw_data: "\377\377\377\377UUUU\252\252\252\252\000\000\000\000"
+ }
+ initializer {
+ dims: 2
+ dims: 2
+ data_type: 1
+ name: "scales"
+ raw_data: "\000\000\000?\000\000\000@\000\000\200?\000\000\200@"
+ }
+ input {
+ name: "indices"
+ type {
+ tensor_type {
+ elem_type: 6
+ shape {
+ dim {
+ dim_value: 2
+ }
+ }
+ }
+ }
+ }
+ output {
+ name: "output"
+ type {
+ tensor_type {
+ elem_type: 1
+ shape {
+ dim {
+ dim_value: 2
+ }
+ dim {
+ dim_value: 32
+ }
+ }
+ }
+ }
+ }
+}
+opset_import {
+ domain: ""
+ version: 21
+}
+opset_import {
+ domain: "com.microsoft"
+ version: 1
+}
diff --git a/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_uint8_bits4.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_uint8_bits4.prototxt
new file mode 100644
index 00000000000..458c8e3803b
--- /dev/null
+++ b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_uint8_bits4.prototxt
@@ -0,0 +1,84 @@
+ir_version: 10
+producer_name: "OpenVINO ONNX Frontend"
+graph {
+ node {
+ input: "data"
+ input: "indices"
+ input: "scales"
+ output: "output"
+ op_type: "GatherBlockQuantized"
+ attribute {
+ name: "bits"
+ i: 4
+ type: INT
+ }
+ attribute {
+ name: "block_size"
+ i: 16
+ type: INT
+ }
+ attribute {
+ name: "gather_axis"
+ i: 0
+ type: INT
+ }
+ attribute {
+ name: "quantize_axis"
+ i: 1
+ type: INT
+ }
+ domain: "com.microsoft"
+ }
+ name: "gather_block_quantized_uint8_bits4"
+ initializer {
+ dims: 2
+ dims: 16
+ data_type: 2
+ name: "data"
+ raw_data: "\231\231\231\231\231\231\231\231wwwwwwww\252\252\252\252\252\252\252\252ffffffff"
+ }
+ initializer {
+ dims: 2
+ dims: 2
+ data_type: 1
+ name: "scales"
+ raw_data: "\000\000\000?\000\000\000@\000\000\200?\000\000\200@"
+ }
+ input {
+ name: "indices"
+ type {
+ tensor_type {
+ elem_type: 6
+ shape {
+ dim {
+ dim_value: 2
+ }
+ }
+ }
+ }
+ }
+ output {
+ name: "output"
+ type {
+ tensor_type {
+ elem_type: 1
+ shape {
+ dim {
+ dim_value: 2
+ }
+ dim {
+ dim_value: 32
+ }
+ }
+ }
+ }
+ }
+}
+opset_import {
+ domain: ""
+ version: 21
+}
+opset_import {
+ domain: "com.microsoft"
+ version: 1
+}
diff --git a/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_uint8_bits4_zp.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_uint8_bits4_zp.prototxt
new file mode 100644
index 00000000000..f31e7ce162c
--- /dev/null
+++ b/src/frontends/onnx/tests/models/com.microsoft/gather_block_quantized_uint8_bits4_zp.prototxt
@@ -0,0 +1,92 @@
+ir_version: 10
+producer_name: "OpenVINO ONNX Frontend"
+graph {
+ node {
+ input: "data"
+ input: "indices"
+ input: "scales"
+ input: "zero_points"
+ output: "output"
+ op_type: "GatherBlockQuantized"
+ attribute {
+ name: "bits"
+ i: 4
+ type: INT
+ }
+ attribute {
+ name: "block_size"
+ i: 16
+ type: INT
+ }
+ attribute {
+ name: "gather_axis"
+ i: 0
+ type: INT
+ }
+ attribute {
+ name: "quantize_axis"
+ i: 1
+ type: INT
+ }
+ domain: "com.microsoft"
+ }
+ name: "gather_block_quantized_uint8_bits4_zp"
+ initializer {
+ dims: 2
+ dims: 16
+ data_type: 2
+ name: "data"
+ raw_data: "\231\231\231\231\231\231\231\231wwwwwwww\252\252\252\252\252\252\252\252ffffffff"
+ }
+ initializer {
+ dims: 2
+ dims: 2
+ data_type: 1
+ name: "scales"
+ raw_data: "\000\000\000?\000\000\000@\000\000\200?\000\000\200@"
+ }
+ initializer {
+ dims: 2
+ dims: 1
+ data_type: 2
+ name: "zero_points"
+ raw_data: "!\003"
+ }
+ input {
+ name: "indices"
+ type {
+ tensor_type {
+ elem_type: 6
+ shape {
+ dim {
+ dim_value: 2
+ }
+ }
+ }
+ }
+ }
+ output {
+ name: "output"
+ type {
+ tensor_type {
+ elem_type: 1
+ shape {
+ dim {
+ dim_value: 2
+ }
+ dim {
+ dim_value: 32
+ }
+ }
+ }
+ }
+ }
+}
+opset_import {
+ domain: ""
+ version: 21
+}
+opset_import {
+ domain: "com.microsoft"
+ version: 1
+}
diff --git a/src/frontends/onnx/tests/onnx_import_com_microsoft.in.cpp b/src/frontends/onnx/tests/onnx_import_com_microsoft.in.cpp
index f58ddff4158..991adc540a7 100644
--- a/src/frontends/onnx/tests/onnx_import_com_microsoft.in.cpp
+++ b/src/frontends/onnx/tests/onnx_import_com_microsoft.in.cpp
@@ -5558,3 +5558,175 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_bifurcation_detector_src_shorter_than_
test_case.add_expected_output<int64_t>(Shape{}, {-1});
test_case.run();
}
+
+// GatherBlockQuantized: block-quantized embedding lookup (com.microsoft).
+// All models use V=2, H=32, block_size=16 (nb=2), gather_axis=0, quantize_axis=1, indices=[1,0].
+// Expected values are hand-derived from output = (data - zero_point) * scale, then gathered.
+namespace {
+// Helper: build a [2, 32] expected output where row r is [blockA(x16), blockB(x16)].
+std::vector<float> gbq_expected(float r0a, float r0b, float r1a, float r1b) {
+ std::vector<float> out;
+ out.reserve(64);
+ for (int i = 0; i < 16; ++i)
+ out.push_back(r0a);
+ for (int i = 0; i < 16; ++i)
+ out.push_back(r0b);
+ for (int i = 0; i < 16; ++i)
+ out.push_back(r1a);
+ for (int i = 0; i < 16; ++i)
+ out.push_back(r1b);
+ return out;
+}
+} // namespace
+
+OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_gather_block_quantized_int4) {
+ // data row0 = 16x(2), 16x(-1); row1 = 16x(1), 16x(3). scales row0=[0.5,4.0], row1=[2.0,0.25]. no zp.
+ // gather [1,0] -> out[0]=row1, out[1]=row0.
+ const auto model = convert_model("com.microsoft/gather_block_quantized_int4.onnx");
+ auto test_case = ov::test::TestCase(model, s_device);
+
+ test_case.add_input<int32_t>(Shape{2}, {1, 0});
+ // out[0]=row1: (1-0)*2.0=2.0, (3-0)*0.25=0.75 ; out[1]=row0: (2-0)*0.5=1.0, (-1-0)*4.0=-4.0
+ test_case.add_expected_output<float>(Shape{2, 32}, gbq_expected(2.0f, 0.75f, 1.0f, -4.0f));
+
+ test_case.run();
+}
+
+OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_gather_block_quantized_uint4) {
+ // data row0 = 16x(2), 16x(15); row1 = 16x(1), 16x(3). int64 indices. no zp.
+ const auto model = convert_model("com.microsoft/gather_block_quantized_uint4.onnx");
+ auto test_case = ov::test::TestCase(model, s_device);
+
+ test_case.add_input<int64_t>(Shape{2}, {1, 0});
+ // out[0]=row1: 1*2.0=2.0, 3*0.25=0.75 ; out[1]=row0: 2*0.5=1.0, 15*4.0=60.0
+ test_case.add_expected_output<float>(Shape{2, 32}, gbq_expected(2.0f, 0.75f, 1.0f, 60.0f));
+
+ test_case.run();
+}
+
+OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_gather_block_quantized_int4_zp) {
+ // Same data/scales as int4 case. zero_points row0=[1,2], row1=[0,1].
+ const auto model = convert_model("com.microsoft/gather_block_quantized_int4_zp.onnx");
+ auto test_case = ov::test::TestCase(model, s_device);
+
+ test_case.add_input<int32_t>(Shape{2}, {1, 0});
+ // out[0]=row1: (1-0)*2.0=2.0, (3-1)*0.25=0.5 ; out[1]=row0: (2-1)*0.5=0.5, (-1-2)*4.0=-12.0
+ test_case.add_expected_output<float>(Shape{2, 32}, gbq_expected(2.0f, 0.5f, 0.5f, -12.0f));
+
+ test_case.run();
+}
+
+OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_gather_block_quantized_int4_f16) {
+ // Same as int4 case but scales are float16; output is float16.
+ const auto model = convert_model("com.microsoft/gather_block_quantized_int4_f16.onnx");
+ auto test_case = ov::test::TestCase(model, s_device);
+
+ test_case.add_input<int32_t>(Shape{2}, {1, 0});
+ const auto expected_f32 = gbq_expected(2.0f, 0.75f, 1.0f, -4.0f);
+ test_case.add_expected_output<ov::float16>(Shape{2, 32},
+ std::vector<ov::float16>(expected_f32.begin(), expected_f32.end()));
+
+ test_case.run_with_tolerance_as_fp(0.01f);
+}
+
+OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_gather_block_quantized_uint8) {
+ // uint8, bits=8, default zero_point=128. data row0=16x(130),16x(124); row1=16x(128),16x(136).
+ const auto model = convert_model("com.microsoft/gather_block_quantized_uint8.onnx");
+ auto test_case = ov::test::TestCase(model, s_device);
+
+ test_case.add_input<int32_t>(Shape{2}, {1, 0});
+ // out[0]=row1: (128-128)*2.0=0.0, (136-128)*0.25=2.0 ; out[1]=row0: (130-128)*0.5=1.0, (124-128)*4.0=-16.0
+ test_case.add_expected_output<float>(Shape{2, 32}, gbq_expected(0.0f, 2.0f, 1.0f, -16.0f));
+
+ test_case.run();
+}
+
+OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_gather_block_quantized_uint8_bits4) {
+ // uint8 data holding 2 int4 values per byte (bits=4), default zero_point=8. Logical H=32, block=16.
+ // Unpacked row0 = 16x(9), 16x(7); row1 = 16x(10), 16x(6). scales row0=[0.5,2.0], row1=[1.0,4.0].
+ const auto model = convert_model("com.microsoft/gather_block_quantized_uint8_bits4.onnx");
+ auto test_case = ov::test::TestCase(model, s_device);
+
+ test_case.add_input<int32_t>(Shape{2}, {1, 0});
+ // out[0]=row1: (10-8)*1.0=2.0, (6-8)*4.0=-8.0 ; out[1]=row0: (9-8)*0.5=0.5, (7-8)*2.0=-2.0
+ test_case.add_expected_output<float>(Shape{2, 32}, gbq_expected(2.0f, -8.0f, 0.5f, -2.0f));
+
+ test_case.run();
+}
+
+OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_gather_block_quantized_uint8_bits2) {
+ // uint8 data holding 4 2-bit values per byte (bits=2), default zero_point=2. Logical H=32, block=16.
+ // Unpacked row0 = 16x(3), 16x(1); row1 = 16x(2), 16x(0). scales row0=[0.5,2.0], row1=[1.0,4.0].
+ const auto model = convert_model("com.microsoft/gather_block_quantized_uint8_bits2.onnx");
+ auto test_case = ov::test::TestCase(model, s_device);
+
+ test_case.add_input<int32_t>(Shape{2}, {1, 0});
+ // out[0]=row1: (2-2)*1.0=0.0, (0-2)*4.0=-8.0 ; out[1]=row0: (3-2)*0.5=0.5, (1-2)*2.0=-2.0
+ test_case.add_expected_output<float>(Shape{2, 32}, gbq_expected(0.0f, -8.0f, 0.5f, -2.0f));
+
+ test_case.run();
+}
+
+OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_gather_block_quantized_uint8_bits4_zp) {
+ // uint8 bits=4 with packed zero_points (2 per byte along the quantize axis). Same data/scales as bits4.
+ // zero_points row0=[1,2], row1=[3,0].
+ const auto model = convert_model("com.microsoft/gather_block_quantized_uint8_bits4_zp.onnx");
+ auto test_case = ov::test::TestCase(model, s_device);
+
+ test_case.add_input<int32_t>(Shape{2}, {1, 0});
+ // out[0]=row1: (10-3)*1.0=7.0, (6-0)*4.0=24.0 ; out[1]=row0: (9-1)*0.5=4.0, (7-2)*2.0=10.0
+ test_case.add_expected_output<float>(Shape{2, 32}, gbq_expected(7.0f, 24.0f, 4.0f, 10.0f));
+
+ test_case.run();
+}
+
+OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_gather_block_quantized_neg_axis) {
+ // Same as int4 case but quantize_axis=-1 (normalizes to 1); verifies negative-axis handling.
+ const auto model = convert_model("com.microsoft/gather_block_quantized_neg_axis.onnx");
+ auto test_case = ov::test::TestCase(model, s_device);
+
+ test_case.add_input<int32_t>(Shape{2}, {1, 0});
+ test_case.add_expected_output<float>(Shape{2, 32}, gbq_expected(2.0f, 0.75f, 1.0f, -4.0f));
+
+ test_case.run();
+}
+
+OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_gather_block_quantized_bf16) {
+ // Same int4 data/scales as the base case, but scales (and output) are bfloat16.
+ const auto model = convert_model("com.microsoft/gather_block_quantized_bf16.onnx");
+ auto test_case = ov::test::TestCase(model, s_device);
+
+ test_case.add_input<int32_t>(Shape{2}, {1, 0});
+ // Expected values (2.0, 0.75, 1.0, -4.0) are all exactly representable in bfloat16, so compare bit-exact.
+ const auto expected_f32 = gbq_expected(2.0f, 0.75f, 1.0f, -4.0f);
+ test_case.add_expected_output<ov::bfloat16>(Shape{2, 32},
+ std::vector<ov::bfloat16>(expected_f32.begin(), expected_f32.end()));
+
+ test_case.run();
+}
+
+OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_gather_block_quantized_indices_2d) {
+ // Rank-2 indices [2,2] -> output rank q + (r-1) = 2 + 1 = 3, shape [2,2,32]. int64 indices.
+ // indices = [[1,0],[0,1]]; row1 = [2.0 x16, 0.75 x16], row0 = [1.0 x16, -4.0 x16].
+ const auto model = convert_model("com.microsoft/gather_block_quantized_indices_2d.onnx");
+ auto test_case = ov::test::TestCase(model, s_device);
+
+ test_case.add_input<int64_t>(Shape{2, 2}, {1, 0, 0, 1});
+ const auto r1 = gbq_expected(2.0f, 0.75f, 1.0f, -4.0f); // one gathered row pair, reused per index
+ std::vector<float> expected;
+ const std::vector<float> row1(r1.begin(), r1.begin() + 32);
+ const std::vector<float> row0(r1.begin() + 32, r1.end());
+ for (const auto* row : {&row1, &row0, &row0, &row1}) { // [1,0,0,1] -> row1,row0,row0,row1
+ expected.insert(expected.end(), row->begin(), row->end());
+ }
+ test_case.add_expected_output<float>(Shape{2, 2, 32}, expected);
+
+ test_case.run();
+}
+
+OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_gather_block_quantized_quantize_axis_not_last) {
+ // quantize_axis is not the last dimension (quantize_axis=0, gather_axis=1). This must be rejected:
+ // the compressed-gather fusion reconstructs the table by merging the trailing dims, which is only
+ // valid when the quantized axis is last, so importing a non-last quantize_axis is disallowed.
+ EXPECT_THROW(convert_model("com.microsoft/gather_block_quantized_quantize_axis_not_last.onnx"), ov::Exception);
+}