Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,14 @@ class CutLMHead : public ov::pass::MatcherPass {
auto matched_matmul = std::static_pointer_cast<ov::op::v0::MatMul>(matched_node_matmul);
auto matched_result = std::static_pointer_cast<ov::op::v0::Result>(matched_node_result);

// Some LLMs add intermediate hidden state outputs that can interfere with LM head detection.
// Skip Result nodes that were manually added (marked with "manually_added_output" in RT_INFO).
// For example, Eagle-3 target/draft models add "last_hidden_state" output which should be skipped.
const auto& rt_info = matched_result->get_rt_info();
if (rt_info.count("manually_added_output")) {
return false;
}

// Cut point:
auto matmul_first_source = matched_matmul->input(0).get_source_output();

Expand Down
Loading