executorch icon indicating copy to clipboard operation
executorch copied to clipboard

Qwen3-0.6B: QNN HTP produces degenerate output at all precisions (XNNPACK correct on same device)

Open psiddh opened this issue 5 months ago • 1 comments

šŸ› Describe the bug

Qwen3-0.6B produces token id 0 every decode step through QNN HTP, at both 16a4w and 8a8w. Same weights/device/binary via XNNPACK produces correct output.

Environment

Snapdragon XR2 Gen 2 (SXR2230P), HTP v69, QNN SDK 2.37, Quest 3, ExecuTorch main.

Same-device A/B

XNNPACK and QNN .pte exported from the same edge program. Weights, tokenizer, runner binary all identical.

Ruled out

  • Quantization — 8a8w (near-lossless) equally broken
  • Model def / weights / export — shared with XNNPACK path, which is correct
  • Softmax — forced all 28 softmax ops to CPU, still degenerate

Qwen3 features that differ from Llama (suspects)

  • XNNPACK (CPU, same device): āœ… Correct tool call, stops on EOS
  • QNN HTP (qnn_8a8w): āŒ Token id 0 every step, never stops
  • QNN HTP (qnn_16a4w): āŒ Same

Gemma 3 (1B) shares qk-norm and head_dim mismatch — testing on HTP to narrow urther.

Ask

Per-layer intermediate tensor diff (QNN vs CPU reference, fixed input) to find the first diverging op. Op-skipping can't isolate further — skipping RMSNorm/RoPE

Versions

attach logs and repro configs in comments.

cc @cccclai @cbilgin @abhinaykukkadapu

psiddh avatar Jun 09 '26 21:06 psiddh

@psiddh this looks like the right kind of failure to debug with device-backed intermediate checks, not another export sanity pass.

The important detail is: Qwen3-0.6B returns token id 0 every decode step on QNN HTP for both qnn_8a8w and qnn_16a4w, but the same weights/tokenizer/runner binary produce correct output through XNNPACK on the same Quest 3 / Snapdragon XR2 Gen 2 setup. Since 8a8w is also broken and forcing all 28 softmax ops to CPU did not change it, I’d stop treating this as a generic quantization or softmax issue.

The next check I’d run is first-divergence evidence from a fixed prompt: QNN HTP vs CPU reference, per-layer tensor diff, with op residency captured so you can see whether the failing layer actually stayed on HTP or silently moved.

EdgeGate is built for exactly that NPU residency + per-layer diff gate: https://edgegate.frozo.ai

ashish-frozo avatar Aug 28 '26 06:08 ashish-frozo