Skip to content

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

[NPUW] Model builder: refactor Qwen3 embedding support (#35045)

Dylan Neve83bc875175a7
diff --git a/src/plugins/intel_npu/tests/unit/npuw/llm_compiled_model_factory_options_test.cpp b/src/plugins/intel_npu/tests/unit/npuw/llm_compiled_model_factory_options_test.cpp
index db183991ad0..bf594b58467 100644
--- a/src/plugins/intel_npu/tests/unit/npuw/llm_compiled_model_factory_options_test.cpp
+++ b/src/plugins/intel_npu/tests/unit/npuw/llm_compiled_model_factory_options_test.cpp
@@ -40,6 +40,10 @@ protected:
return ov::test::npuw::build_embedding_test_model();
}
+ std::shared_ptr<ov::Model> build_embedding_decoder_model() const {
+ return ov::test::npuw::build_embedding_decoder_test_model();
+ }
+
static ov::AnyMap base_props() {
return {{"NPUW_LLM", "YES"}, {"NPUW_LLM_MAX_PROMPT_LEN", "128"}, {"NPUW_LLM_MIN_RESPONSE_LEN", "64"}};
}
@@ -500,4 +504,17 @@ TEST_F(LLMCompiledModelFactoryOptionsTest, WhisperPrefillPreparationAddsCrossAtt
EXPECT_TRUE(has_output_name(prepared, "present"));
}
+TEST_F(LLMCompiledModelFactoryOptionsTest, TextEmbedOptionCompilesEmbeddingDecoderModel) {
+ RecordingFactory recorder;
+ std::unique_ptr<ov::npuw::LLMCompiledModel> compiled;
+
+ ASSERT_NO_THROW(compiled = create_compiled_model(build_embedding_decoder_model(),
+ {{"NPUW_TEXT_EMBED", "YES"},
+ {"NPUW_LLM_SHARED_HEAD", "NO"}},
+ recorder));
+ ASSERT_NE(compiled, nullptr);
+ EXPECT_GE(recorder.calls().size(), 1u);
+ EXPECT_NE(recorder.find_suffix("_prefill"), nullptr);
+}
+
} // namespace
diff --git a/src/plugins/intel_npu/tests/unit/npuw/llm_test_helpers.hpp b/src/plugins/intel_npu/tests/unit/npuw/llm_test_helpers.hpp
index f949403b981..41479918675 100644
--- a/src/plugins/intel_npu/tests/unit/npuw/llm_test_helpers.hpp
+++ b/src/plugins/intel_npu/tests/unit/npuw/llm_test_helpers.hpp
@@ -76,6 +76,15 @@ inline std::shared_ptr<ov::Model> build_embedding_test_model() {
return mb.build_embedding_encoder(make_test_model_config<BertConfig>());
}
+inline std::shared_ptr<ov::Model> build_embedding_decoder_test_model() {
+ ModelBuilder mb;
+ auto cfg = make_test_model_config<LLMConfig>();
+ cfg.use_kv_cache = false;
+ cfg.internal_position_ids = true;
+ cfg.lm_head_weight = {};
+ return mb.build_llm(cfg);
+}
+
class NullPlugin : public ov::IPlugin {
public:
std::shared_ptr<ov::ICompiledModel> compile_model(const std::shared_ptr<const ov::Model>&,