segKI: `install_decode_attention` patches non-gated q/k-norm attention (dense Qwen3)
メンテナーはふだん 2 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 半日
- 初心者へのやさしさ
- 18/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
調査の方向性
Start in install_decode_attention, where the gated [q|gate] check compares q_proj.out_features against head_dim, and compare it with find_glu_segments. The failing test is TestArenaWeightViews::test_glu_only_model_refresh_clears_backend_cat_cache, and _decode_attn_forward assumes Qwen3.5 semantics. Linked PR #9165 is already open against this issue, so check it before starting.
索引モデルが issue の本文から書いたものです。
説明
TestArenaWeightViews::test_glu_only_model_refresh_clears_backend_cat_cache fails on master (039bfc9f3) with AttributeError: 'Qwen3RMSNorm' object has no attribute 'eps'. Earlier PR comments (#9077, #9079, #9127) attributed this to a Transformers API change. That is not the cause: it fails the same way on Transformers 5.17.0.
Root cause
install_decode_attention treats a layer as the gated [q|gate] layout when q_proj.out_features is divisible by 2 * head_dim. Dense Qwen3-0.6B has 16 heads × 128 = 2048 = 2 × 8 × 128, so it passes and is patched as 8 gated heads with a (1+w) q/k norm. It then reaches self.q_norm.eps, but Qwen3RMSNorm stores variance_epsilon. Without that crash the output would be wrong anyway, because the head count, the gate split and the norm scale all differ.
In Transformers 5.17, about 40 attention classes have per-head q_norm/k_norm: Qwen3/MoE/VL, Gemma3/4, GLM4-MoE, OLMo2/3, MiniMax-M2, Exaone4, and others. Any of them with an even head count passes the current check. Only qwen3_5, qwen3_5_moe, qwen3_next and qwen4_exp actually use the gated layout.
Proposed fix
Also require q_proj.out_features == 2 * o_proj.in_features. In the gated layout, o_proj consumes only the attention half; in plain attention the two are equal. Both are per-rank under AutoTP, so the ratio holds there too. With Transformers 5.17 this selects exactly the four gated families above. The check only excludes layers, so currently supported models are unaffected. Locally the segKI kernel suite passes (28/28 on L20), and a CPU test covers both the gated and the dense case.
Question
This is still a structural check. A future model with a 2×-wide q_proj but different semantics (plain w norm, a different gate split) would pass it, while _decode_attn_forward already assumes Qwen3.5 semantics (it imports apply_rotary_pos_emb from qwen3_5). Would you prefer:
- the structural check above, consistent with
find_glu_segments; or - additionally an explicit allowlist (attention class or
config.model_type)?
@delock happy to send the PR either way.
- 主要言語
- Python
- スター
- 43.3k
- フォーク
- 5.1k
- 平均マージ
- 5日 10時間
- マージ済み PR(30日)
- 85
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
deepspeedai/DeepSpeed のほかの issue
-
[Bug] DeepSpeedEngine.step leaves _running_engine_step=True permanently on exception, corrupting is_gradient_accumulation_boundary()対応中かも @its-amann が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
deepspeedai/DeepSpeed#9190 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
[Bug] PipelineEngine._exec_reduce_grads and _exec_optimizer_step leave _force_grad_boundary=True permanently after any exception対応中かも @bantianyue が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
deepspeedai/DeepSpeed#9183 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
deepspeedai/DeepSpeed#9019 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
fp16 `hysteresis: 0` (or negative) makes DynamicLossScaler never lower the loss scale, so every overflowing step is skipped forever対応中かも @damienen が 26 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
deepspeedai/DeepSpeed#8982 ·
メンテナーはふだん 2 日以内に返信
-
[BUG] OneCycle applies the minimum momentum to the first Adam update対応中かも @ai-yang が 30 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
deepspeedai/DeepSpeed#8951 ·
メンテナーはふだん 2 日以内に返信
deepspeedai/DeepSpeed の issue をすべて見る
似ている issue
-
area/auth comp/agent P3 type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
NousResearch/hermes-agent#161417 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
Dao-AILab/flash-attention#3251 ·
メンテナーはふだん 2 日以内に返信
-
[New Check]: sqlserver_public_network_access_disabled対応中かも @pouria-l が今日担当しました。 オープンfeature-request status/needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
prowler-cloud/prowler#13607 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
external langchain
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
langchain-ai/docs#8184 ·
メンテナーはふだん 1 日以内に返信