--- license: apache-2.0 tags: [qhexrt, hexagon, npu, qnn, llm, gated-delta-net] base_model: Qwen/Qwen3.5-2B pipeline_tag: text-generation --- # Qwen3.5-2B — Hexagon NPU (QHexRT) — v81 A prebuilt **QHexRT** bundle of **Qwen/Qwen3.5-2B** (the **Qwen3-Next "GatedDeltaNet" hybrid** lineage) running on the **Qualcomm Hexagon v81 NPU** (SM8850). text→text. The text decoder is a **hybrid**: 3 of every 4 layers are a **recurrent gated delta-rule linear attention** (`Qwen3_5GatedDeltaNet`: a short causal-conv FIFO + an SSM state + gated RMSNorm), and every 4th layer is **gated softmax attention** (q-proj output gate, per-head q/k RMSNorm, **partial-rotary** M-RoPE θ=1e7). The runtime drives it with the `qwen3_5_generate` host-op (decode-over-prompt; conv + SSM + KV state carried host-side), the lm-head as a separate graph. ## What's here (`v81/` — the flat artifacts root) | file | role | ~size | |---|---|---| | `qwen3.5-2b-1024.json` | QHexRT manifest (the declarative run plan) | 2 KB | | `qwen352b_decode_f16.bin` | decode context binary (24 layers, hid 2048, fp16) | 2.76 GB | | `qwen352b_lmhead_f16.bin` | lm-head context binary (tied embed, fp16) | 1.0 GB | | `qwen352b_embed_f16.bin` | embedding table (host lookup, fp16) | 1.0 GB | | `tokenizer.json` | Qwen2-style BPE tokenizer | 20 MB | Arch-pinned: a v81 binary will not load on another Hexagon arch. The QNN runtime libs come from the QAIRT SDK, not this repo. ## Run ```bash hf download runanywhere/qwen3_5_2b_HNPU --local-dir q35_2b adb push q35_2b/v81 /data/local/tmp/wq/qwen35-2b # also stage the QAIRT runtime libs + a qhx_generate built with the qwen3_5_generate host-op (see caveats) adb shell "cd /data/local/tmp/wq && LD_LIBRARY_PATH=. \ ./qhx_generate qwen35-2b/qwen3.5-2b-1024.json libQnnHtp.so libQnnSystem.so qwen35-2b 64 'The capital of France is'" ``` ## Measured (device: SM8850 / v81, QAIRT 2.47) - **Decode: ~11.0 tok/s** (fp16). - **Parity: greedy-EXACT** — on-device tokens match the HF `Qwen/Qwen3.5-2B` greedy continuation **41/41** (prompt "The capital of France is"). ## Caveats - **fp16** decode + lm-head (strict greedy parity). W8 weight-only is the next perf lever (~2×, weight-bound). - The fp16 decode weights (2.7 GB) exceed the 2 GB model-lib relocation limit, so the build uses a **large-code-model** path (weight blob → `.lrodata` + `-mcmodel=large`); this is baked into the published bin. - **Text-LLM path only** — the vision tower + MTP head are not exported. - Needs a `qhx_generate` that includes the **`qwen3_5_generate`** host-op (QHexRT branch `smonga/qwen_fam`). - Built by the in-repo `forge` pipeline (oracle-gated export 10/10 → QAIRT-2.47 O3 compile → device greedy gate).