You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: move prune_lm_head from global flag to CausalLMTask option
Remove the MOBIUS_PRUNE_LM_HEAD feature flag and replace it with a
prune_lm_head constructor parameter on CausalLMTask (and
HybridCausalLMTask), mirroring the stable-API pattern already used by
the static_cache option.
When prune_lm_head=True, the task inserts Gather(axis=1, index=-1)
followed by Unsqueeze(axis=1) on the logits output after calling
module(), changing the output shape from [B, S, vocab] to [B, 1, vocab].
ONNX Runtime's graph optimizer can push this Gather backward through the
LM head MatMul to avoid computing all-token logits during prefill.
Update tests to use CausalLMTask(prune_lm_head=True) instead of the
override_flags context manager. Also merges main branch changes
(tencent_q1_0_use_native_2bit and static_cache_bias flags).
Signed-off-by: Copilot <copilot@github.com>
Signed-off-by: GitHub <noreply@github.com>
Copy file name to clipboardExpand all lines: .agents/skills/attention-optimization/SKILL.md
+93-15Lines changed: 93 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,8 +23,8 @@ Use this skill when:
23
23
| Scenario | Recommended | Why |
24
24
|----------|------------|-----|
25
25
| Causal only |`attn_mask=None` + `is_causal=1`| Enables Flash (fastest for prefill) |
26
-
| Padding (batch>1) |`nonpad_kv_seqlens` (best) or bool mask |`nonpad_kv_seqlens` enables Flash + shared buffer with no mask|
27
-
| Sliding window (simple) |Bool mask |Equally precise as float, uses less memory|
26
+
| Padding (batch>1) |`nonpad_kv_seqlens` (+ static cache) or bool mask |`nonpad_kv_seqlens` enables Flash with no mask; pair with `TensorScatter` static cache for decode (can't combine with `past_key`/`past_value` inputs)|
27
+
| Sliding window (simple) |GQA `local_window_size` or bool mask |`local_window_size` keeps the fast GQA path; bool mask if you need ONNX Attention|
28
28
| Complex (sliding+KV-shared+dual head_dim) | Float additive bias | Avoids mask construction bugs in multi-constraint patterns |
0 commit comments