Skip to content

npu: the int8 outlier split covers ffn_down only; CodeLlama-7b loses EOS at the gate/up input (host f32 there restores it) #2576

Closed

Description

@bong-water-water-bong

What

amd/CodeLlama-7b-Instruct-hf_rai_1.7.1_hybrid on --device npu (kernels kernels-h4096-mha-b8, main with #2552's outlier split on by default) answers correctly and then never emits </s>: ' Sure! 12 times 7 is 84. package.\n\n\n…' runs to the length cap, so a 3-prompt chat times out at ~1 tok/s.

It is the int8 activations again, at the gate/up input this time

Measured at the failing position (chat prompt + ' Sure! 12 times 7 is 84.', token ids, greedy). The device-mode rows use a local per-projection host-f32 diagnostic (the #2536 instrument), under NPU_NO_WCACHE=1 NPU_FFN_CACHE=0:

path next tokens
device (i8) #12times / #1
NPU_INFER_HOST_GEMM=i8 #12times
NPU_INFER_HOST_GEMM=1 (f32, same container) `` (EOS)
device, only ffn_gate_up in host f32 `` (EOS)
device, only ffn_down in host f32 #answer
device, only attn_qkv / attn_output in host f32 #1
device, NPU_ACT_OUTLIER_TAU 20 / 10 / 5 (ffn_down split only) #12times

#2552 split the outlier channels of the ffn_down input, which is where Qwen2.5-3B lost its token. CodeLlama loses it in the gate/up input, the post-attention norm output, which the split did not cover.

Fix (PR follows)

The same split applied to ffn_gate_up (fused: outputs [gate | up] along N, the order q4nx_assemble_B lays down) and to the split ffn_gate / ffn_up designs, with the columns taken from the layer's gate_proj / up_proj.

Measured on the same container at default tau 40: the prefix ends with EOS, and chat answers 'The capital of France is Paris.' (stop), 'Sure! 12 times 7 is 84.' (stop, 14 tokens), and '… Neil Armstrong … Apollo 11 mission in 1969 …' (stop).

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions