Skip to content

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

[CORE] PagedGatedDeltaNet core op (#35051)

Mateusz Mikolajczyk7dad617bcb05
diff --git a/src/core/dev_api/openvino/op/paged_gated_delta_net.hpp b/src/core/dev_api/openvino/op/paged_gated_delta_net.hpp
new file mode 100644
index 00000000000..5226209269c
--- /dev/null
+++ b/src/core/dev_api/openvino/op/paged_gated_delta_net.hpp
@@ -0,0 +1,95 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+#pragma once
+
+#include "openvino/op/op.hpp"
+
+namespace ov::op::internal {
+/// \note PagedGatedDeltaNet op class is under development and subject to change
+///
+/// \brief Operator performing paged Gated Delta Net computation for linear attention models.
+///
+/// Computes gated delta net attention over input tokens using a block-based recurrent state table
+/// managed by the paged execution pipeline. The recurrent state table is updated in-place by the kernel.
+///
+/// This operation uses grouped-query linear attention. The number of groups is
+/// ``num_groups = v_num_heads / num_heads``. Each query and key head is shared by
+/// ``num_groups`` consecutive value heads, with the mapping ``h_q = h_v / num_groups``.
+/// \ingroup ov_ops_cpp_api
+class OPENVINO_API PagedGatedDeltaNet : public ov::op::Op {
+public:
+ OPENVINO_OP("PagedGatedDeltaNet");
+
+ PagedGatedDeltaNet() = default;
+ /// \brief Constructs a PagedGatedDeltaNet operation.
+ ///
+ /// \param query Query tensor [batch_size_in_tokens, num_heads, key_head_dim].
+ /// num_heads is the number of query/key heads; v_num_heads must be divisible by num_heads.
+ /// \param key Key tensor [batch_size_in_tokens, num_heads, key_head_dim].
+ /// \param value Value tensor [batch_size_in_tokens, v_num_heads, value_head_dim].
+ /// v_num_heads >= num_heads; the ratio v_num_heads/num_heads gives the number of GQA groups.
+ /// \param recurrent_state_table Block table containing recurrent states
+ /// [num_blocks, v_num_heads, value_head_dim, key_head_dim].
+ /// \param gate Gate tensor [batch_size_in_tokens, v_num_heads].
+ /// \param beta Beta tensor [batch_size_in_tokens, v_num_heads].
+ /// \param subsequence_begins Start indices of tokens from current sequences [batch_size_in_sequences+1],
+ /// element type i32 or i64.
+ /// \param la_block_indices Block index along 0-th dim in recurrent_state table [num_blocks],
+ /// element type i32 or i64.
+ /// \param la_block_indices_begins Defines how block indices are split among sequences [batch_size_in_sequences+1],
+ /// element type i32 or i64.
+ /// \param processed_tokens Number of tokens already handled per sequence [batch_size_in_sequences],
+ /// element type i32 or i64.
+ /// \param cache_interval Interval between tokens to cache state [batch_size_in_sequences],
+ /// element type i32 or i64.
+ /// \param use_qk_l2norm Enables q/k L2-normalization inside this op.
+ /// \param q_l2_norm_eps Positive floating-point epsilon used for query L2-normalization.
+ /// \param k_l2_norm_eps Positive floating-point epsilon used for key L2-normalization.
+ PagedGatedDeltaNet(const Output<Node>& query,
+ const Output<Node>& key,
+ const Output<Node>& value,
+ const Output<Node>& recurrent_state_table,
+ const Output<Node>& gate,
+ const Output<Node>& beta,
+ const Output<Node>& subsequence_begins,
+ const Output<Node>& la_block_indices,
+ const Output<Node>& la_block_indices_begins,
+ const Output<Node>& processed_tokens,
+ const Output<Node>& cache_interval,
+ bool use_qk_l2norm = false,
+ float q_l2_norm_eps = 1e-6F,
+ float k_l2_norm_eps = 1e-6F);
+
+ /// \brief Constructs a PagedGatedDeltaNet operation from input vector.
+ ///
+ /// \param args Input tensor vector (11 inputs in order listed above).
+ /// \param use_qk_l2norm Enables q/k L2-normalization inside this op.
+ /// \param q_l2_norm_eps Positive floating-point epsilon used for query L2-normalization.
+ /// \param k_l2_norm_eps Positive floating-point epsilon used for key L2-normalization.
+ PagedGatedDeltaNet(const ov::OutputVector& args,
+ bool use_qk_l2norm = false,
+ float q_l2_norm_eps = 1e-6F,
+ float k_l2_norm_eps = 1e-6F);
+
+ void validate_and_infer_types() override;
+ bool visit_attributes(AttributeVisitor& visitor) override;
+ std::shared_ptr<ov::Node> clone_with_new_inputs(const ov::OutputVector& new_args) const override;
+
+ bool get_use_qk_l2norm() const {
+ return m_use_qk_l2norm;
+ }
+ float get_q_l2_norm_eps() const {
+ return m_q_l2_norm_eps;
+ }
+ float get_k_l2_norm_eps() const {
+ return m_k_l2_norm_eps;
+ }
+
+private:
+ bool m_use_qk_l2norm = false;
+ float m_q_l2_norm_eps = 1e-6F;
+ float m_k_l2_norm_eps = 1e-6F;
+};
+
+} // namespace ov::op::internal
diff --git a/src/core/shape_inference/include/paged_gated_delta_net_shape_inference.hpp b/src/core/shape_inference/include/paged_gated_delta_net_shape_inference.hpp
new file mode 100644
index 00000000000..2b22249eb9d
--- /dev/null
+++ b/src/core/shape_inference/include/paged_gated_delta_net_shape_inference.hpp
@@ -0,0 +1,88 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include "openvino/op/paged_gated_delta_net.hpp"
+#include "utils.hpp"
+
+namespace ov::op::internal {
+
+template <class T, class TRShape = result_shape_t<T>>
+std::vector<TRShape> shape_infer(const PagedGatedDeltaNet* op, const std::vector<T>& input_shapes) {
+ NODE_VALIDATION_CHECK(op, input_shapes.size() == 11);
+
+ NODE_SHAPE_INFER_CHECK(op, input_shapes, input_shapes[0].rank().compatible(3));
+ NODE_SHAPE_INFER_CHECK(op, input_shapes, input_shapes[1].rank().compatible(3));
+ NODE_SHAPE_INFER_CHECK(op, input_shapes, input_shapes[2].rank().compatible(3));
+ NODE_SHAPE_INFER_CHECK(op, input_shapes, input_shapes[3].rank().compatible(4));
+ NODE_SHAPE_INFER_CHECK(op, input_shapes, input_shapes[4].rank().compatible(2));
+ NODE_SHAPE_INFER_CHECK(op, input_shapes, input_shapes[5].rank().compatible(2));
+ NODE_SHAPE_INFER_CHECK(op, input_shapes, input_shapes[6].rank().compatible(1));
+ NODE_SHAPE_INFER_CHECK(op, input_shapes, input_shapes[7].rank().compatible(1));
+ NODE_SHAPE_INFER_CHECK(op, input_shapes, input_shapes[8].rank().compatible(1));
+ NODE_SHAPE_INFER_CHECK(op, input_shapes, input_shapes[9].rank().compatible(1));
+ NODE_SHAPE_INFER_CHECK(op, input_shapes, input_shapes[10].rank().compatible(1));
+
+ // [batch_size_in_tokens, num_heads, key_head_dim]
+ const auto& query_ps = input_shapes[0];
+ const auto& key_ps = input_shapes[1];
+ // [batch_size_in_tokens, v_num_heads, value_head_dim]
+ const auto& value_ps = input_shapes[2];
+ // [num_blocks, v_num_heads, value_head_dim, key_head_dim]
+ const auto& state_ps = input_shapes[3];
+ // [batch_size_in_tokens, v_num_heads]
+ const auto& gate_ps = input_shapes[4];
+ const auto& beta_ps = input_shapes[5];
+
+ const auto query_rank_is_static = query_ps.rank().is_static();
+ const auto key_rank_is_static = key_ps.rank().is_static();
+ const auto value_rank_is_static = value_ps.rank().is_static();
+ const auto state_rank_is_static = state_ps.rank().is_static();
+ const auto gate_rank_is_static = gate_ps.rank().is_static();
+ const auto beta_rank_is_static = beta_ps.rank().is_static();
+
+ if (query_rank_is_static && key_rank_is_static) {
+ NODE_SHAPE_INFER_CHECK(op,
+ input_shapes,
+ query_ps[1].compatible(key_ps[1]),
+ "The number of heads in query and key inputs must be equal.");
+
+ NODE_SHAPE_INFER_CHECK(op,
+ input_shapes,
+ key_ps[2].compatible(query_ps[2]),
+ "The head size of query and key inputs must be equal.");
+ }
+
+ if (value_rank_is_static && gate_rank_is_static && beta_rank_is_static) {
+ NODE_SHAPE_INFER_CHECK(op,
+ input_shapes,
+ gate_ps[1].compatible(value_ps[1]) && beta_ps[1].compatible(value_ps[1]),
+ "The number of heads in gate, beta, and value inputs must be equal.");
+ }
+
+ if (state_rank_is_static && value_rank_is_static && key_rank_is_static) {
+ // [num_blocks, v_num_heads, value_head_dim, key_head_dim]
+ NODE_SHAPE_INFER_CHECK(op,
+ input_shapes,
+ state_ps[1].compatible(value_ps[1]),
+ "The number of heads in recurrent_state_table and value inputs must be equal.");
+
+ NODE_SHAPE_INFER_CHECK(
+ op,
+ input_shapes,
+ state_ps[2].compatible(value_ps[2]),
+ "The value dimension of recurrent_state_table and the head size of value input must be equal.");
+
+ NODE_SHAPE_INFER_CHECK(
+ op,
+ input_shapes,
+ state_ps[3].compatible(key_ps[2]),
+ "The key dimension of recurrent_state_table and the head size of key input must be equal.");
+ }
+
+ // output: [batch_size_in_tokens, v_num_heads, value_head_dim] — same shape as value input
+ return {value_ps};
+}
+} // namespace ov::op::internal
diff --git a/src/core/src/op/paged_gated_delta_net.cpp b/src/core/src/op/paged_gated_delta_net.cpp
new file mode 100644
index 00000000000..1f8527ef902
--- /dev/null
+++ b/src/core/src/op/paged_gated_delta_net.cpp
@@ -0,0 +1,108 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "openvino/op/paged_gated_delta_net.hpp"
+
+#include "itt.hpp"
+#include "openvino/core/validation_util.hpp"
+#include "openvino/op/op.hpp"
+#include "paged_gated_delta_net_shape_inference.hpp"
+
+namespace ov::op::internal {
+
+PagedGatedDeltaNet::PagedGatedDeltaNet(const Output<Node>& query,
+ const Output<Node>& key,
+ const Output<Node>& value,
+ const Output<Node>& recurrent_state_table,
+ const Output<Node>& gate,
+ const Output<Node>& beta,
+ const Output<Node>& subsequence_begins,
+ const Output<Node>& la_block_indices,
+ const Output<Node>& la_block_indices_begins,
+ const Output<Node>& processed_tokens,
+ const Output<Node>& cache_interval,
+ bool use_qk_l2norm,
+ float q_l2_norm_eps,
+ float k_l2_norm_eps)
+ : Op({query,
+ key,
+ value,
+ recurrent_state_table,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval}),
+ m_use_qk_l2norm(use_qk_l2norm),
+ m_q_l2_norm_eps(q_l2_norm_eps),
+ m_k_l2_norm_eps(k_l2_norm_eps) {
+ constructor_validate_and_infer_types();
+}
+
+PagedGatedDeltaNet::PagedGatedDeltaNet(const ov::OutputVector& args,
+ bool use_qk_l2norm,
+ float q_l2_norm_eps,
+ float k_l2_norm_eps)
+ : ov::op::Op(args),
+ m_use_qk_l2norm(use_qk_l2norm),
+ m_q_l2_norm_eps(q_l2_norm_eps),
+ m_k_l2_norm_eps(k_l2_norm_eps) {
+ constructor_validate_and_infer_types();
+}
+
+void PagedGatedDeltaNet::validate_and_infer_types() {
+ OV_OP_SCOPE(PagedGatedDeltaNet_validate_and_infer_types);
+
+ NODE_VALIDATION_CHECK(this, get_input_size() == 11);
+
+ ov::element::Type common_float_type = get_input_element_type(0);
+ const bool float_types_merge =
+ ov::element::Type::merge(common_float_type, common_float_type, get_input_element_type(1)) &&
+ ov::element::Type::merge(common_float_type, common_float_type, get_input_element_type(2)) &&
+ ov::element::Type::merge(common_float_type, common_float_type, get_input_element_type(3)) &&
+ ov::element::Type::merge(common_float_type, common_float_type, get_input_element_type(4)) &&
+ ov::element::Type::merge(common_float_type, common_float_type, get_input_element_type(5));
+ NODE_VALIDATION_CHECK(this,
+ float_types_merge,
+ "PagedGatedDeltaNet expects query, key, value, recurrent_state_table, gate, and beta to "
+ "have the same element type.");
+ NODE_VALIDATION_CHECK(this,
+ common_float_type.is_dynamic() || common_float_type == ov::element::f32 ||
+ common_float_type == ov::element::f16 || common_float_type == ov::element::bf16,
+ "Float inputs must have f32, f16, or bf16 element type.");
+ for (size_t i = 6; i < 11; ++i) {
+ const auto& et = get_input_element_type(i);
+ NODE_VALIDATION_CHECK(this,
+ et.is_dynamic() || et == ov::element::i32 || et == ov::element::i64,
+ "Integer inputs must have i32 or i64 element type.");
+ }
+
+ NODE_VALIDATION_CHECK(this,
+ m_q_l2_norm_eps > 0.0f,
+ "Attribute 'q_l2_norm_eps' must be a positive floating-point number.");
+ NODE_VALIDATION_CHECK(this,
+ m_k_l2_norm_eps > 0.0f,
+ "Attribute 'k_l2_norm_eps' must be a positive floating-point number.");
+
+ const auto output_shapes = shape_infer(this, ov::util::get_node_input_partial_shapes(*this));
+ set_output_type(0, common_float_type, output_shapes[0]);
+}
+
+bool PagedGatedDeltaNet::visit_attributes(AttributeVisitor& visitor) {
+ OV_OP_SCOPE(PagedGatedDeltaNet_visit_attributes);
+ visitor.on_attribute("use_qk_l2norm", m_use_qk_l2norm);
+ visitor.on_attribute("q_l2_norm_eps", m_q_l2_norm_eps);
+ visitor.on_attribute("k_l2_norm_eps", m_k_l2_norm_eps);
+ return true;
+}
+
+std::shared_ptr<ov::Node> PagedGatedDeltaNet::clone_with_new_inputs(const ov::OutputVector& new_args) const {
+ OV_OP_SCOPE(PagedGatedDeltaNet_clone_with_new_inputs);
+ check_new_args_count(this, new_args);
+ return std::make_shared<PagedGatedDeltaNet>(new_args, m_use_qk_l2norm, m_q_l2_norm_eps, m_k_l2_norm_eps);
+}
+
+} // namespace ov::op::internal
diff --git a/src/core/tests/type_prop/paged_gated_delta_net.cpp b/src/core/tests/type_prop/paged_gated_delta_net.cpp
new file mode 100644
index 00000000000..967e1f59a0d
--- /dev/null
+++ b/src/core/tests/type_prop/paged_gated_delta_net.cpp
@@ -0,0 +1,787 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "openvino/op/paged_gated_delta_net.hpp"
+
+#include <gtest/gtest.h>
+
+#include "common_test_utils/test_assertions.hpp"
+#include "common_test_utils/type_prop.hpp"
+#include "openvino/openvino.hpp"
+
+namespace ov::test {
+
+class TypePropPagedGatedDeltaNetTest : public TypePropOpTest<op::internal::PagedGatedDeltaNet> {};
+
+TEST_F(TypePropPagedGatedDeltaNetTest, f32_static_shapes) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, Shape{5, 4, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ const auto op = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval});
+
+ EXPECT_EQ(op->get_output_size(), 1);
+ EXPECT_EQ(op->get_output_element_type(0), element::f32);
+ EXPECT_EQ(op->get_output_partial_shape(0), PartialShape(Shape{10, 4, 16}));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, f16_static_shapes) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::f16, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f16, Shape{10, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f16, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f16, Shape{5, 4, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f16, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f16, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ const auto op = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval});
+
+ EXPECT_EQ(op->get_output_element_type(0), element::f16);
+ EXPECT_EQ(op->get_output_partial_shape(0), PartialShape(Shape{10, 4, 16}));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, bf16_partial_shapes) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::bf16, PartialShape{-1, {2, 8}, 64});
+ const auto key = std::make_shared<op::v0::Parameter>(element::bf16, PartialShape{-1, {2, 8}, 64});
+ const auto value = std::make_shared<op::v0::Parameter>(element::bf16, PartialShape{-1, {2, 8}, {32, 128}});
+ const auto state = std::make_shared<op::v0::Parameter>(element::bf16, PartialShape{-1, {2, 8}, {32, 128}, 64});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::bf16, PartialShape{-1, {2, 8}});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::bf16, PartialShape{-1, {2, 8}});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+
+ const auto op = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval});
+
+ EXPECT_EQ(op->get_output_element_type(0), element::bf16);
+ EXPECT_EQ(op->get_output_partial_shape(0), (PartialShape{-1, {2, 8}, {32, 128}}));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, query_incompatible_rank) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8, 1}); // rank 4 - invalid
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, Shape{5, 4, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ OV_EXPECT_THROW(std::ignore = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval}),
+ NodeValidationFailure,
+ testing::HasSubstr("input_shapes[0].rank().compatible(3)"));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, query_incompatible_type) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::i32, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::i32, Shape{10, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::i32, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::i32, Shape{5, 4, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::i32, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::i32, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ OV_EXPECT_THROW(std::ignore = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval}),
+ NodeValidationFailure,
+ testing::HasSubstr("Float inputs must have f32, f16, or bf16 element type"));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, key_incompatible_head_num) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 6, 8}); // num_heads 6 != 4
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, Shape{5, 4, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ OV_EXPECT_THROW(std::ignore = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval}),
+ NodeValidationFailure,
+ testing::HasSubstr("The number of heads in query and key inputs must be equal"));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, key_incompatible_head_num_partial) {
+ // Non-overlapping dimension ranges: query num_heads {2,4}, key num_heads {6,10}
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {2, 4}, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {6, 10}, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {6, 10}, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {6, 10}, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {6, 10}});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {6, 10}});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+
+ OV_EXPECT_THROW(std::ignore = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval}),
+ NodeValidationFailure,
+ testing::HasSubstr("The number of heads in query and key inputs must be equal"));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, key_incompatible_head_size) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 32}); // key_head_dim 32 != 8
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, Shape{5, 4, 16, 32});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ OV_EXPECT_THROW(std::ignore = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval}),
+ NodeValidationFailure,
+ testing::HasSubstr("The head size of query and key inputs must be equal"));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, gate_incompatible_head_num) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, Shape{5, 4, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 6}); // gate heads 6 != 4
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ OV_EXPECT_THROW(std::ignore = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval}),
+ NodeValidationFailure,
+ testing::HasSubstr("The number of heads in gate, beta, and value inputs must be equal"));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, state_incompatible_value_dim) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 16});
+ const auto state =
+ std::make_shared<op::v0::Parameter>(element::f32, Shape{5, 4, 32, 8}); // value_head_dim 32 != 16
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ OV_EXPECT_THROW(std::ignore = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval}),
+ NodeValidationFailure,
+ testing::HasSubstr(
+ "The value dimension of recurrent_state_table and the head size of value input must be equal"));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, state_incompatible_num_heads) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, Shape{5, 6, 16, 8}); // num_heads 6 != 4
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ OV_EXPECT_THROW(std::ignore = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval}),
+ NodeValidationFailure,
+ testing::HasSubstr("The number of heads in recurrent_state_table and value inputs must be equal."));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, state_incompatible_key_dim) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, Shape{5, 4, 16, 16}); // key_head_dim 16 != 8
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ OV_EXPECT_THROW(
+ std::ignore = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval}),
+ NodeValidationFailure,
+ testing::HasSubstr("The key dimension of recurrent_state_table and the head size of key input must be equal."));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, state_incompatible_value_dim_partial) {
+ // Non-overlapping dimension ranges: value value_head_dim {8,16}, state value_head_dim {32,64}
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4, {8, 16}});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4, {32, 64}, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+
+ OV_EXPECT_THROW(std::ignore = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval}),
+ NodeValidationFailure,
+ testing::HasSubstr(
+ "The value dimension of recurrent_state_table and the head size of value input must be equal"));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, incompatible_inputs_count) {
+ const auto p = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ OV_EXPECT_THROW(std::ignore = make_op(OutputVector{p, p, p}),
+ NodeValidationFailure,
+ testing::HasSubstr("get_input_size() == 11"));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, dynamic_rank) {
+ // Dynamic rank inputs should be accepted during model import / shape propagation
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, PartialShape::dynamic());
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, PartialShape::dynamic());
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, PartialShape::dynamic());
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, PartialShape::dynamic());
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, PartialShape::dynamic());
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, PartialShape::dynamic());
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+
+ const auto op = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval});
+
+ EXPECT_EQ(op->get_output_size(), 1);
+ EXPECT_EQ(op->get_output_partial_shape(0), PartialShape::dynamic());
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, dynamic_type) {
+ // Dynamic element type inputs should be accepted during model import / shape propagation
+ const auto query = std::make_shared<op::v0::Parameter>(element::dynamic, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::dynamic, Shape{10, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::dynamic, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::dynamic, Shape{5, 4, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::dynamic, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::dynamic, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ const auto op = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval});
+
+ EXPECT_EQ(op->get_output_size(), 1);
+ EXPECT_EQ(op->get_output_element_type(0), element::dynamic);
+ EXPECT_EQ(op->get_output_partial_shape(0), (PartialShape{10, 4, 16}));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, dynamic_and_concrete_float_type_merged) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::dynamic, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, Shape{5, 4, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ const auto op = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval});
+
+ EXPECT_EQ(op->get_output_size(), 1);
+ EXPECT_EQ(op->get_output_element_type(0), element::f32);
+ EXPECT_EQ(op->get_output_partial_shape(0), (PartialShape{10, 4, 16}));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, overlapping_dim_ranges_compatible) {
+ // Overlapping (not identical) ranges are compatible: query num_heads {2,6}, key num_heads {4,8}
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {2, 6}, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {4, 8}, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {4, 6}, {16, 32}});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {4, 6}, {16, 32}, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {4, 6}});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {4, 6}});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+
+ const auto op = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval});
+
+ EXPECT_EQ(op->get_output_element_type(0), element::f32);
+ EXPECT_EQ(op->get_output_partial_shape(0), (PartialShape{-1, {4, 6}, {16, 32}}));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, mixed_float_types_incompatible) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f16, Shape{10, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, Shape{5, 4, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ OV_EXPECT_THROW(std::ignore = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval}),
+ NodeValidationFailure,
+ testing::HasSubstr("have the same element type"));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, i64_integer_inputs) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, Shape{5, 4, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i64, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i64, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i64, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i64, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i64, Shape{2});
+
+ const auto op = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval});
+
+ EXPECT_EQ(op->get_output_size(), 1);
+ EXPECT_EQ(op->get_output_element_type(0), element::f32);
+ EXPECT_EQ(op->get_output_partial_shape(0), PartialShape(Shape{10, 4, 16}));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, subsequence_begins_incompatible_rank) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, Shape{5, 4, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{2, 2}); // rank 2 - invalid
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ OV_EXPECT_THROW(std::ignore = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval}),
+ NodeValidationFailure,
+ testing::HasSubstr("input_shapes[6].rank().compatible(1)"));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, subsequence_begins_incompatible_type) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, Shape{5, 4, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i16, Shape{3}); // i16 - invalid
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ OV_EXPECT_THROW(std::ignore = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval}),
+ NodeValidationFailure,
+ testing::HasSubstr("Integer inputs must have i32 or i64 element type"));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, q_l2norm_eps_incompatible_negative) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, Shape{5, 4, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ OV_EXPECT_THROW(std::ignore = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval},
+ false,
+ -1.0f,
+ 1e-6f),
+ NodeValidationFailure,
+ testing::HasSubstr("Attribute 'q_l2_norm_eps' must be a positive floating-point number"));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, q_l2norm_eps_incompatible_zero) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, Shape{5, 4, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ OV_EXPECT_THROW(std::ignore = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval},
+ false,
+ 0.0f,
+ 1e-6f),
+ NodeValidationFailure,
+ testing::HasSubstr("Attribute 'q_l2_norm_eps' must be a positive floating-point number"));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, k_l2norm_eps_incompatible_zero) {
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, Shape{5, 4, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ OV_EXPECT_THROW(std::ignore = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval},
+ false,
+ 1e-6f,
+ 0.0f),
+ NodeValidationFailure,
+ testing::HasSubstr("Attribute 'k_l2_norm_eps' must be a positive floating-point number"));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, gqa_static_shapes) {
+ // GQA: 2 q/k heads, 8 v heads (4 groups)
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 2, 64});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 2, 64});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 8, 32});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, Shape{5, 8, 32, 64});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 8});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, Shape{10, 8});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, Shape{5});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, Shape{3});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, Shape{2});
+
+ const auto op = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval});
+
+ EXPECT_EQ(op->get_output_size(), 1);
+ EXPECT_EQ(op->get_output_element_type(0), element::f32);
+ EXPECT_EQ(op->get_output_partial_shape(0), PartialShape(Shape{10, 8, 32}));
+}
+
+TEST_F(TypePropPagedGatedDeltaNetTest, gqa_partial_shapes) {
+ // GQA with partial shapes: q/k heads {1,4}, v heads {4,16}
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {1, 4}, 64});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {1, 4}, 64});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {4, 16}, {32, 128}});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {4, 16}, {32, 128}, 64});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {4, 16}});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, {4, 16}});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+
+ const auto op = make_op(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval});
+
+ EXPECT_EQ(op->get_output_size(), 1);
+ EXPECT_EQ(op->get_output_element_type(0), element::f32);
+ EXPECT_EQ(op->get_output_partial_shape(0), (PartialShape{-1, {4, 16}, {32, 128}}));
+}
+} // namespace ov::test
diff --git a/src/core/tests/visitors/op/paged_gated_delta_net.cpp b/src/core/tests/visitors/op/paged_gated_delta_net.cpp
new file mode 100644
index 00000000000..6b252fa65c1
--- /dev/null
+++ b/src/core/tests/visitors/op/paged_gated_delta_net.cpp
@@ -0,0 +1,120 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "openvino/op/paged_gated_delta_net.hpp"
+
+#include <gtest/gtest.h>
+
+#include "visitors/visitors.hpp"
+
+namespace ov::test {
+
+TEST(attributes, paged_gated_delta_net_default_attrs) {
+ NodeBuilder::opset().insert<op::internal::PagedGatedDeltaNet>();
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+
+ const auto op = std::make_shared<op::internal::PagedGatedDeltaNet>(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval});
+
+ NodeBuilder builder(op,
+ {query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval});
+ auto g_op = as_type_ptr<op::internal::PagedGatedDeltaNet>(builder.create());
+
+ constexpr auto expected_attr_count = 3;
+ EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
+
+ EXPECT_FALSE(op->get_use_qk_l2norm());
+ EXPECT_FLOAT_EQ(op->get_q_l2_norm_eps(), 1e-6f);
+ EXPECT_FLOAT_EQ(op->get_k_l2_norm_eps(), 1e-6f);
+
+ EXPECT_EQ(g_op->get_use_qk_l2norm(), op->get_use_qk_l2norm());
+ EXPECT_FLOAT_EQ(g_op->get_q_l2_norm_eps(), op->get_q_l2_norm_eps());
+ EXPECT_FLOAT_EQ(g_op->get_k_l2_norm_eps(), op->get_k_l2_norm_eps());
+}
+
+TEST(attributes, paged_gated_delta_net_non_default_attrs) {
+ NodeBuilder::opset().insert<op::internal::PagedGatedDeltaNet>();
+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4, 8});
+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4, 8});
+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4, 16});
+ const auto state = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4, 16, 8});
+ const auto gate = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4});
+ const auto beta = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{-1, 4});
+ const auto subsequence_begins = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto la_block_indices = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto la_block_indices_begins = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto processed_tokens = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+ const auto cache_interval = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{-1});
+
+ const auto op = std::make_shared<op::internal::PagedGatedDeltaNet>(OutputVector{query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval},
+ true, // use_qk_l2norm
+ 1e-3f, // q_l2_norm_eps
+ 2e-3f); // k_l2_norm_eps
+
+ NodeBuilder builder(op,
+ {query,
+ key,
+ value,
+ state,
+ gate,
+ beta,
+ subsequence_begins,
+ la_block_indices,
+ la_block_indices_begins,
+ processed_tokens,
+ cache_interval});
+ auto g_op = as_type_ptr<op::internal::PagedGatedDeltaNet>(builder.create());
+
+ constexpr auto expected_attr_count = 3;
+ EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
+
+ EXPECT_TRUE(op->get_use_qk_l2norm());
+ EXPECT_FLOAT_EQ(op->get_q_l2_norm_eps(), 1e-3f);
+ EXPECT_FLOAT_EQ(op->get_k_l2_norm_eps(), 2e-3f);
+
+ EXPECT_EQ(g_op->get_use_qk_l2norm(), op->get_use_qk_l2norm());
+ EXPECT_FLOAT_EQ(g_op->get_q_l2_norm_eps(), op->get_q_l2_norm_eps());
+ EXPECT_FLOAT_EQ(g_op->get_k_l2_norm_eps(), op->get_k_l2_norm_eps());
+}
+
+} // namespace ov::test