Skip to content

qnn_llama_runner on SA8295 outputs repetitive “)” or gibberish with Qwen3-0.6B after ExecuTorch export #15410

@wanglinkun

Description

@wanglinkun

🐛 Describe the bug

When running qnn_llama_runner with Qwen3-0.6B converted via ExecuTorch (hybrid QNN .pte) on a Qualcomm SA8295 device, the model generates either a long sequence of “)” or random multilingual gibberish. Changing temperature does not fix it. Generation usually hits the max length instead of stopping at EOS.

Steps to Reproduce

Using llama.py to convert qwen3-0_6b
python examples/qualcomm/oss_scripts/llama/llama.py -b build-android -m SA8295 --temperature 0 --model_mode hybrid --max_seq_len 1024 --prefill_ar_len 128 --decoder_model qwen3-0_6b --prompt "what is 1+1" --tasks wikitext --limit 1 --compile_only --artifact /workspace/pteModels/qwen_qnn

Command used (one example):
./qnn_llama_runner --decoder_model_version qwen3 --model_path ./hybrid_llama_qnn.pte --tokenizer_path ./tokenizer.json --seq_len 1024 --kv_updater ShiftPointer --prompt "Tell me a story about the Second World War..." --temperature 0.6

Also reproduced with:

  • --temperature 0.0 / 0.7
  • --kv_updater SmartMask
  • tokenizer_path pointing to a directory vs to tokenizer.json

Actual Behavior

The runner prints formatted_prompt in ChatML style, but the output is:
Either 998–1000 identical “)” characters when temperature=0.0
Or long sequences of random words/garbage when temperature>0
It always generates up to max length and never stops at EOS.

Image

What I Tried

  • Adjusted sampling (temperature 0.0/0.6/0.7, also tried lower temperature like 0.1). No fix; behavior changes from repeated “)” to random gibberish but remains incorrect.
  • Shortened seq_len to 128; still nonsense, just shorter.
  • Switched kv_updater between SmartMask and ShiftPointer.
  • Pointed tokenizer_path to a single tokenizer.json vs a directory. BOS/EOS ids changed between runs but output remains nonsense.

Versions

Collecting environment information...
PyTorch version: 2.10.0.dev20251003+cpu
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.5 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: 14.0.0-1ubuntu1.1
CMake version: version 3.31.6
Libc version: glibc-2.35

Python version: 3.10.0 (default, Mar 3 2022, 09:58:08) [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-5.10.84-004.ali5000.alios7.x86_64-x86_64-with-glibc2.35
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
Is XPU available: False
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 46 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 40
On-line CPU(s) list: 0-39
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) Silver 4114 CPU @ 2.20GHz
CPU family: 6
Model: 85
Thread(s) per core: 2
Core(s) per socket: 10
Socket(s): 2
Stepping: 4
CPU max MHz: 3000.0000
CPU min MHz: 800.0000
BogoMIPS: 4400.00
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts pku ospke md_clear flush_l1d
Virtualization: VT-x
L1d cache: 640 KiB (20 instances)
L1i cache: 640 KiB (20 instances)
L2 cache: 20 MiB (20 instances)
L3 cache: 27.5 MiB (2 instances)
NUMA node(s): 1
NUMA node0 CPU(s): 0-39
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Vulnerable, IBPB: disabled, STIBP: disabled
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Mitigation; Clear CPU buffers; SMT vulnerable

Versions of relevant libraries:
[pip3] executorch==1.1.0a0+519c7ff
[pip3] numpy==2.2.6
[pip3] pytorch_tokenizers==0.1.0
[pip3] torch==2.10.0.dev20251003+cpu
[pip3] torchao==0.14.0+git01849b2b1
[pip3] torchaudio==2.8.0.dev20251003+cpu
[pip3] torchdata==0.11.0+cpu
[pip3] torchsr==1.0.4
[pip3] torchtune==0.7.0+cpu
[pip3] torchvision==0.25.0.dev20251003+cpu
[conda] executorch 1.1.0a0+519c7ff pypi_0 pypi
[conda] numpy 2.2.6 pypi_0 pypi
[conda] pytorch-tokenizers 0.1.0 pypi_0 pypi
[conda] torch 2.10.0.dev20251003+cpu pypi_0 pypi
[conda] torchao 0.14.0+git01849b2b1 pypi_0 pypi
[conda] torchaudio 2.8.0.dev20251003+cpu pypi_0 pypi
[conda] torchdata 0.11.0+cpu pypi_0 pypi
[conda] torchsr 1.0.4 pypi_0 pypi
[conda] torchtune 0.7.0+cpu pypi_0 pypi
[conda] torchvision 0.25.0.dev20251003+cpu pypi_0 pypi

cc @cccclai @winskuo-quic @shewu-quic @haowhsu-quic @DannyYuyang-quic @cbilgin

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: qnnIssues related to Qualcomm's QNN delegate and code under backends/qualcomm/partner: qualcommFor backend delegation, kernels, demo, etc. from the 3rd-party partner, Qualcomm

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions