Qwen3-ASR-1.7B - Snapdragon X Elite precompiled QNN (SM8380)
Precompiled EPContext build of Qwen/Qwen3-ASR-1.7B-hf (w8a16m decoder).
The binaries are tied to QAIRT 2.50.40.260831140417 and Snapdragon X Elite (SM8380); rebuild with qwen3_asr_pipeline.py for other devices/SDKs.
Upstream license: apache-2.0 (verify on the upstream model card before redistributing).
Measured on 4 clips (English/Japanese) against the fp32 CPU graphs: macro CER 0.0, worst clip 0.0, mean RTF 0.489, 11.0 tokens/s.
Files
audio_encoder_ctx.onnx,decoder_prefill_ctx.onnx,decoder_decode_ctx.onnx+ their*_ctx_qnn.bin(keep each wrapper next to its bin)model_meta.json(all constants below),metadata.json(build info + exact tensor shapes),tokenizer.json,embeddings_fp16.npy(token embedding table[151936, 2048]),mel_filters.npy([201, 128])
Host loop (everything not on the NPU)
- Audio: 16 kHz mono float32. Split into passes of
windows_per_pass * enc_frames * 160samples (2 x 8 s). - Log-mel per pass (zero-pad audio to whole windows): center reflect-pad 200, periodic hann(400), hop 160, power spectrum,
mel_filters.npy,log10(max(x,1e-10)), drop the last frame, clip tomax-8,(x+4)/4->[128, frames]. audio_encoder(mel[1,128,800])per 8 s window ->audio_embeds[1,104,2048]; concatenate windows.- Prompt ids =
prefix_ids + [audio_token_id] * n_audio_tokens + suffix_ids(+ tokenizedlanguage <Name><asr_text>to force a language). Embeddings =embeddings_fp16[ids], rows of the audio span replaced by the encoder output. - KV cache:
2 * 28float arrays[1,8,384,128], zero-initialised. - Prefill in chunks of
32tokens withdecoder_prefill(pad the last chunk), then decode one token at a time withdecoder_decode. Inputs per call:inputs_embeds[1,T,2048],cos/sin[1,1,T,128],mask[1,1,T,384+T],sel[1,1,T],past_k_i/past_v_i.- positions
pos = past_len + arange(T);freqs = pos * 1e+06^(-arange(0,128,2)/128);cos/sinofconcat(freqs,freqs). - mask
[T, ctx+T]: columnj < ctx: 0 ifj < past_lenelse-100.0; columnj >= ctx: 0 if(j-ctx) <= rowand(j-ctx) < n_validelse-100.0. selis one-hot at rown_valid-1(picks the row whose logits are returned).- Outputs:
logits[1,1,151936],new_k_i/new_v_i[1,8,T,128]; write the firstn_validrows into the cache atpast_len.
- positions
- Greedy argmax; stop on
eos_ids[151643, 151645]; also stop on a 24-token identical run. Output islanguage <Name><asr_text>transcript.