Skip to content

Check for output_extra.weight when loading Gemma4 assistant models#1817

Merged
ikawrakow merged 1 commit into
mainfrom
ik/gemma4_mtp_extra_output
May 18, 2026
Merged

Check for output_extra.weight when loading Gemma4 assistant models#1817
ikawrakow merged 1 commit into
mainfrom
ik/gemma4_mtp_extra_output

Conversation

@ikawrakow

Copy link
Copy Markdown
Owner

PR #1810 added the ability to add an extra output tensor quantized with fewer bits per weight by adding --extra-output-tensor to the llama-quantize command.

This creates the opportunity for some clever user to do so for the Gemma4 assistant models. But then loading this model will fail because no attempt is made to load this additional tensor.

This PR fixes the loading failure of such a hypothetical model.

How do I know that this issue might occur? Well, after observing performance improvement when using MTP with the Qwen3.6 models by creating such an additional output tensor (see #1809, #1810), I went ahead to see if this will do something for Gemma4 MTP. With Gemma4 the MTP part is a separate "assistant model". This model does not have an output.weight tensor (as usual for Gemma models the token embedding tensor is uses also as output tensor), so quantizing a Gemma4 assistant model with --extra-output-tensor does create output_extra.weight, but the resulting model fails to load. So, to try, I had to fix it.

The bad news is that this does not improve Gemma4 MTP performance. But at least we avoid having an issue filed.

@ikawrakow ikawrakow merged commit 40aae0b into main May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant