Repository navigation
ggml-openvino: one output in the decode model of a static NPU pair - #445
Merged
Merged
Conversation
The decode model of a static prefill/decode pair copied the compute params of the
prefill graph, including output_len. With llama-perplexity the prefill graph has many
outputs (128 at -c 256), so the decode model gathered 128 rows from its one token in
the last layer. For a MoE model that layer then differs from the others and NPUW fails
to lower its experts ("could not lower the isolated expert partition"). A decode step
outputs one token; the model cache key already assumes it (decode_signature out=1).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
We meet this issue when doing the KLD measurement.
On the NPU, a static graph is compiled as a pair: a prefill model and a decode model. The decode model is built with a copy of the prefill graph's compute params, including
output_len, the size of the output-ids input.For generation,
output_lenis 1, so the copy is harmless.llama-perplexityasks for many outputs per batch (128 at-c 256), so the decode model of its pair gathers 128 rows from its single token in the last layer.-b 512. With-b 1(decode KLD) every graph has one output, so the decode model is correct either way.Additional information
Change
The decode model of a pair now always gets
output_len = 1. A decode step outputs one token, and the model-cache key of the decode model already assumed this (decode_signatureisstatic-1 out=1).The change is in
ov_graph_compute_static, which runs only for static graphs (the NPU, orGGML_OPENVINO_FORCE_STATIC). Dynamic graphs are not affected.Testing
It depends on the PR443 and PR444 if using the Qwen3.6-35B-A3B model for the KLD testing.
In the windows
-b 1): unchanged.output_lenwas already 1.llama-perplexity -c 256 -b 256 --kl-divergencefailed in the decode model before the change. After it, all 40 chunks run (results in PR C).llama-server -c 512 -np 1 --spec-type ngram-simple --spec-ngram-simple-size-n 3 --spec-ngram-simple-size-m 4, greedy, 48 tokens.Requirements
YES, I use the AI to do the debug and analysis.