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
14 changes: 14 additions & 0 deletions src/models/qwen35.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,20 @@ llama_model_qwen35::graph_mtp::graph_mtp(const llama_model & model, const llm_gr
ggml_tensor * tok_embd_w = layer.nextn.embed_tokens ? layer.nextn.embed_tokens : model.tok_embd;

tok_embd = ggml_get_rows(ctx0, tok_embd_w, inp->tokens);

// a Hadamard-latent embedding table stores rotated rows; restore the primal
// basis right after the lookup (h = s * (H z)), exactly like the trunk path in
// llm_graph_context::build_inp_embd. Without this the draft head consumes
// embeddings in the rotated basis and llama_verify_hadamard_graph refuses the graph.
Comment on lines +638 to +641
if (hadamard_inverses) {
const auto it = hadamard_inverses->find(tok_embd_w);
if (it != hadamard_inverses->end()) {
tok_embd = llama_mul_mat_hadamard(ctx0, tok_embd, it->second.rot);
if (it->second.signs) {
tok_embd = ggml_mul(ctx0, tok_embd, it->second.signs);
}
}
}
} else {
tok_embd = inp->embd;
}
Expand Down