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
{{ message }}
Repository navigation
npu: a qwen3_5 gated q_proj is per-head [q_h|gate_h] in the pack and block-wise in the forward, so the d3 attention attends over gate rows #903
i.e. the q_proj row block is [q_h | gate_h] per head. The forward assembles the fused QKV as [q block | gate block | k | v] (what the FLM/OGA packs store, whose attn_q/attn_gate tensors are
concatenated). tools/safetensors_to_q4nx.py was a pure rename, so a vllm-sr/d3-lite container kept the per-head
order and the forward attended over half-gate rows and gated with half-query ones.
Measured (engine#796, layer 3 = first full attention, last prompt position, bf16 container)
The engine's own dump of the slices it attends over, against the pack's runtime:
comparison
cos
rel L2
engine q slice vs HF q (per-head, what the container holds)
0.0774
3.6499
engine q slice vs HF q (block reading)
0.999992
0.0045
engine gate vs HF gate (per-head)
0.5989
0.8088
engine gate vs HF gate (block reading)
0.999994
0.0042
engine v vs HF v
0.999964
0.0086
So the container was right and the slice was wrong: the two layouts are unrelated (cos 0.077), which is why this
survives every statistical check and only shows up as "the first full-attention layer is 0.45 off".
Effect of the fix on the whole forward
Per-layer last-position residual (24 layers, one 94-token prompt, causal):
before
after
first layer with cos < 0.999
3 (cos 0.452)
none
layer 3
0.452
0.999968
layer 23
0.975
0.999998
/v1/systemone vs d3_runtime.py, 9 cases, worst |Δp|
0.4140
0.0061
choice argmax flips
2/5
0/5
(0.6367 → 0.4140 was engine#901's norm convention; this closes the rest.)
Activity