-
Notifications
You must be signed in to change notification settings - Fork 20.6k
Support Step3.5/3.7 flash mtp3 #24340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 13 commits
e98e0b3
1208d99
0b8aa51
e0fb9ff
34f68f5
ae013e3
1885d8f
f4a2c12
9a0ff26
2952d83
48a7484
2ce24fb
9b8f3b6
7a0a247
9858fd2
60b04d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -683,8 +683,11 @@ struct llm_graph_params { | |
| } | ||
|
|
||
| return | ||
| cparams.embeddings == other.cparams.embeddings && | ||
| cparams.causal_attn == other.cparams.causal_attn && | ||
| cparams.embeddings == other.cparams.embeddings && | ||
| cparams.embeddings_nextn == other.cparams.embeddings_nextn && | ||
| cparams.embeddings_nextn_masked == other.cparams.embeddings_nextn_masked && | ||
| cparams.nextn_layer_offset == other.cparams.nextn_layer_offset && | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is correct, but effectively it will disable graph reuse during drafting. However, there isn't a better way to do it for now as we don't have a mechanism to do layer selection at compute time. It's something to think about in the future.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add TODO to not forget: diff --git a/src/llama-graph.h b/src/llama-graph.h
index d2a1b39d4..ac00d6cc6 100644
--- a/src/llama-graph.h
+++ b/src/llama-graph.h
@@ -682,11 +682,15 @@ struct llm_graph_params {
}
}
+ // TODO: https://github.com/ggml-org/llama.cpp/pull/24340#discussion_r3448035248
+ if (cparams.nextn_layer_offset != other.cparams.nextn_layer_offset) {
+ return false;
+ }
+
return
cparams.embeddings == other.cparams.embeddings &&
cparams.embeddings_nextn == other.cparams.embeddings_nextn &&
cparams.embeddings_nextn_masked == other.cparams.embeddings_nextn_masked &&
- cparams.nextn_layer_offset == other.cparams.nextn_layer_offset &&
cparams.causal_attn == other.cparams.causal_attn &&
arch == other.arch &&
gtype == other.gtype && |
||
| cparams.causal_attn == other.cparams.causal_attn && | ||
| arch == other.arch && | ||
| gtype == other.gtype && | ||
| cvec == other.cvec && | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the logic here - seems incorrect. Every
headiteration will basically erase the result of the previous iteration.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each head runs a different layer, set_nextn_layer_offset(head) makes graph_mtp build layer n_layer()+head, i.e. 45/46/47. So each head writes its own k_l[il]/v_l[il].
seq_rm here doesn't drop any KV data β it just clears the cell metadata so find_slot hands back the same cells at the same positions for every head. Without it, head 46/47 would land on fresh cells and we'd get duplicate positions in v_cells .
So after the loop those cells hold valid KV for all three MTP layers at once. it's the teacher-forcing catch-up that seeds each head's layer so the next draft() round attends to a correct, target-aligned cache.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, got it. That's interesting.