Qwen3-4B-Instruct-2507 — QNN / Genie (w4a16, Hexagon HTP)
中文说明:README.zh-CN.md
A Qualcomm QNN (AI Engine Direct) build of Qwen3-4B-Instruct-2507,
quantized to w4a16 and compiled into a Hexagon HTP context binary split across four shards,
packaged for the Qualcomm Genie runtime (GenieDialog API / genie-t2t-run CLI).
It runs entirely on the on-device NPU — no cloud, no CPU fallback path.
This is a converted / repackaged artifact, not a new model. Every capability and every limitation of the upstream checkpoint carries over. Only the execution format changed.
Specifications
| Field | Value |
|---|---|
| Base model | Qwen/Qwen3-4B-Instruct-2507 |
| Architecture | Qwen3ForCausalLM — 36 layers, hidden 2560, 32 heads / 8 KV heads, head dim 128, intermediate 9728 |
| Runtime | Qualcomm Genie (QNN dialog pipeline) |
| Backend | QnnHtp — Hexagon Tensor Processor |
| Quantization | w4a16 (4-bit weights, 16-bit activations) |
| Context length | 4096 tokens (as shipped; see Context length below) |
| Vocab size | 151,936 |
| Tokenizer | Qwen2Tokenizer, tokenizer.json (BPE) |
| Chat template | Qwen3 `< |
| RoPE theta | 5,000,000 |
| Weight format | 4 × HTP context binary (.bin) |
| Weights total | 3,172,663,296 bytes (≈ 3.17 GB / 2.95 GiB) |
| Repository size | 3,184,834,343 bytes (≈ 2.97 GiB / 3.18 GB) across 19 files |
| Built with | Qualcomm AI Stack (QAIRT) 2.45.0.260326154327 |
| Source SoC | SM8750 (Snapdragon 8 Elite), soc_model 69, DSP arch V79 |
| License | Apache-2.0 (inherited from the base model) |
Repository contents
| File | Size (bytes) | SHA-256 | Purpose |
|---|---|---|---|
qwen3_4b_instruct_2507_w4a16_part_1_of_4.bin | 778,178,560 | 1a4c55906f129ef6dc7a6258872e0ef44efcec56889a74bf11e5581ac44fa443 | HTP context binary, shard 1/4 |
qwen3_4b_instruct_2507_w4a16_part_2_of_4.bin | 664,707,072 | 96e9cf9d06e417b9f4a68b9d5a93d6af9ee2a5dbe5413ae59c1992ab6efa253b | HTP context binary, shard 2/4 |
qwen3_4b_instruct_2507_w4a16_part_3_of_4.bin | 664,784,896 | 84488e66202f7957ee71af8b3818a7e8c2e10d75e08b8c3f40bb6fe8cb6219f6 | HTP context binary, shard 3/4 |
qwen3_4b_instruct_2507_w4a16_part_4_of_4.bin | 1,064,992,768 | a17471cf42dffacefe0586cde481d1191d78a1588f04e47ce84fd0ec9a8404ae | HTP context binary, shard 4/4 |
genie_config.json | 1,717 | 040629c03da424d76eebfea865753c5a28c97687af5d5a146344f1cbaa979923 | Main Genie config — dialog / context / sampler / tokenizer / engine (backend + model) |
tokenizer.json | 11,422,654 | aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4 | Tokenizer vocabulary and merges |
tokenizer_config.json | 8,196 | 0f7963638a00d3ae66091154dc735b8af2375adb93328b6c9b6e3cf4b5525917 | Tokenizer metadata + Qwen3 chat_template |
config.json | 728 | 2280d1eb824dbfdc912090c6bbb4062e368f54075081153aa61dbffe638a1dcb | Upstream model config (reference only; Genie does not read it) |
metadata.json | 689,930 | 45a53956ff518c933fc3602ae1d094ad3a348d5ee96a5cd790ef7f6d9a781d31 | Compilation metadata: per-shard tensor names/shapes/dtypes and quantization scales, plus the Genie chat-template fragments |
htp_backend_ext_config.json | 217 | 09d3b915c784116f96fa4d612d8c1f2fac0e32952e5eb2f1a8f79bf48a9cda94 | HTP backend extension config — pins soc_model 69 / dsp_arch V79 |
text-generator.json | 1,725 | d0507f2f7160bd3b5e86b880215e2c6f15bc9a7861603024b0a2076621ff3aba | Genie node config for the genie-app pipeline |
genie-app-script.txt | 518 | 92e0892c403b1d98c6d331510294a43a174a455895cd83ac2230f69a6fb44a9c | genie-app pipeline script (node wiring + sample input) |
sample_prompt.txt | 159 | 53a0f03fee319c52532ebcaae2a04c03278f712bd10b0e5e1b6c0aaa345ee80e | Sample prompt in Qwen3 chat format |
tool-versions.yaml | 27 | 81bf4ff69aa21421f46dec061cceb441c7200a05187ffa1ec3fc5751ff3577b6 | QAIRT version used for compilation |
LICENSE | 11,339 | a1aee62aebd7c746d56c31a8cc25f9c165b9452a4385686b9b935b9f4939fd1a | Apache-2.0 full text |
NOTICE | 4,685 | f0b51e6b733ed9506f0478316c24d6bd830eeaec847a14def486fc5d0121c95f | Copyright and third-party attribution |
.gitattributes | 659 | bed8b8661123d1ba2cb997a1f1443c147dd13cf722e8bd2a83c331a26c381d61 | Git LFS rules for the shards (not a model artifact) |
Requirements
| Item | Requirement |
|---|---|
| Hardware | Snapdragon SoC with Hexagon Tensor Processor (HTP). Non-Qualcomm devices are unsupported. |
| SoC / DSP arch | See the table in Compatibility below — the shipped binaries target V79. |
| Runtime | Qualcomm Genie + QNN HTP runtime, QAIRT 2.45.0 or newer (validated against 2.50.0). |
| Device libraries | libGenie.so, libQnnHtp.so, libQnnSystem.so, libQnnHtpV{arch}Stub.so, libQnnHtpNetRunExtensions.so, and the matching unsigned skels libQnnHtpV{arch}Skel.so / libCalculator_skel.so. These are part of the QAIRT SDK and are not included here. |
| Storage | ≈ 3.2 GB free for the model directory. |
ADSP_LIBRARY_PATH | Must include the directory holding libQnnHtpV{arch}Skel.so. The skel is not loaded by the app linker — host-side adsprpc finds it via the search path. Omitting this is the most common cause of GenieDialog_create failed (it fails after ~300 ms with that single log line). |
Compatibility — read before filing a bug
-
The shipped binaries are V79.
htp_backend_ext_config.jsonpinssoc_model: 69/dsp_arch: "v79"(SM8750 / Snapdragon 8 Elite), and all four context binaries were compiled for Hexagon V79. -
Verified working on V81 hardware. This exact artifact was loaded and generated text on an SM8850 (Snapdragon 8 Elite Gen 5,
soc_model87, DSP arch V81) device. Loading a V79 context binary on a V81 DSP worked, but cross-architecture safety is not guaranteed by Qualcomm — treat it as empirically verified on SM8850, not as an officially supported configuration. -
Override
backend.extensions. The bundledhtp_backend_ext_config.jsontargets SM8750. On any other SoC, pointbackend.extensionsat an extension config matching your device (or use the official minimal form that omitssoc_model/dsp_archand lets the backend probe the device). The DroidLLM app does this automatically — see Using with DroidLLM. -
SoC → DSP arch reference (per the QAIRT support table):
SoC soc_modelHTP arch Notes SM8850 — Snapdragon 8 Elite Gen 5 87 V81 Verified with this artifact SM8750 — Snapdragon 8 Elite 69 V79 Native target of this build SM8650 — Snapdragon 8 Gen 3 57 V75 Not tested SM8550 — Snapdragon 8 Gen 2 43 V73 Not tested For any SoC other than SM8750/SM8850, the four
.binshards would have to be recompiled for the matching arch from the upstream checkpoint. Just editing the JSON is not sufficient. -
Context length is 4096 tokens as shipped. The engine was compiled for context sizes 512 / 1024 / 2048 / 3072 / 4096 (
metadata.json→genie.context_lengths), and the bundledgenie_config.jsonselects4096. Although the upstream model advertises 262,144 positions, this build cannot exceed 4096 — prompts + generation beyond that are outside the compiled graph. -
Cross-version QAIRT usage. Compiled with QAIRT 2.45.0 and successfully run under a 2.50.0 runtime. QNN context binaries are not guaranteed to be forward/backward compatible across SDK releases; validate on your own SDK before depending on it.
-
n-threadsis inert. The HTP schedules its own work; then-threads: 3field in the config is ignored on this backend. Sampling parameters do apply (they are handled by the Genie dialog sampler, not by a CPU sampler).
Measured performance
Single-run acceptance measurement of this artifact on real hardware. Not a benchmark — numbers vary with thermals, clock state, prompt length and generation length.
| Metric | Value |
|---|---|
| Device | HONOR BKQ-AN80, SM8850 (Snapdragon 8 Elite Gen 5), Android 17 |
| Model load | 6,710 ms |
| TTFT (prompt → first token) | 77 ms |
| Decode throughput | 97.25 tok/s |
| Tokens generated | 132 |
| Total generation time | 1,467 ms |
| Process RSS | 325 MB |
| Crashes | 0 |
| Backend runtime | QAIRT 2.50.0 |
Quick start
A. Genie CLI (genie-t2t-run)
Runs the model without any app, and is the only place where Genie prints its own [ERROR]/[WARN] lines
(the Genie SDK logs through an internal callback that Android apps cannot receive).
# 1. Prepare device-side libraries (adjust ARCH to your device: 79, 81, ...)
QAIRT=/path/to/qairt # e.g. .../qairt/2.50.0.260828
ARCH=79 # SM8750 = 79, SM8850 = 81
DEV=//data/local/tmp/qnnval
adb shell mkdir -p $DEV
adb push "$QAIRT/bin/aarch64-android/qnn-platform-validator" \
"$QAIRT/bin/aarch64-android/genie-t2t-run" \
"$QAIRT/lib/aarch64-android/libGenie.so" \
"$QAIRT/lib/aarch64-android/libQnnHtp.so" \
"$QAIRT/lib/aarch64-android/libQnnSystem.so" \
"$QAIRT/lib/aarch64-android/libQnnHtpV${ARCH}Stub.so" \
"$QAIRT/lib/aarch64-android/libQnnHtpV${ARCH}CalculatorStub.so" \
"$QAIRT/lib/aarch64-android/libQnnHtpNetRunExtensions.so" \
"$QAIRT/lib/hexagon-v${ARCH}/unsigned/libQnnHtpV${ARCH}Skel.so" \
"$QAIRT/lib/hexagon-v${ARCH}/unsigned/libCalculator_skel.so" \
$DEV/
adb shell "chmod 755 $DEV/*"
# 2. Confirm what your device actually reports (do this before trusting any table)
adb shell "cd $DEV && LD_LIBRARY_PATH=$DEV ADSP_LIBRARY_PATH=$DEV \
./qnn-platform-validator --backend dsp --coreVersion --testBackend"
# Expected: "Core Version of the backend DSP: Hexagon Architecture Vxx" + "Passed."
# 3. Push the model directory
adb push . $DEV/model
# 4. In the config, set three paths to their absolute device paths:
# backend.extensions -> $DEV/model/htp_backend_ext_config.json (or a config built for your SoC)
# tokenizer.path -> $DEV/model/tokenizer.json
# model.binary.ctx-bins[] -> $DEV/model/<each .bin>
# 5. Run (the first run reads 3.1 GB of context binaries — allow 2+ minutes, it is not hung)
adb shell "cd $DEV && LD_LIBRARY_PATH=$DEV ADSP_LIBRARY_PATH=$DEV \
./genie-t2t-run -c model/genie_config.json -p 'Hi'; echo EXIT=\$?"
Two failure modes worth knowing in advance:
- Missing
libQnnHtpNetRunExtensions.so→[WARN] Failure in initializing backend extensionsfollowed by a segmentation fault (EXIT=139). The load failure is not reported as an error by the library — the crash happens insideGenieDialog_createbefore the model is read. - Missing
ADSP_LIBRARY_PATH→GenieDialog_create failedafter ~300 ms, with nothing else in the log.
B. Android app (DroidLLM)
DroidLLM is an Android app that runs this artifact through the same Genie runtime, and handles the two pitfalls above for you:
- sets
ADSP_LIBRARY_PATHto the app'snativeLibraryDirbefore touching the Genie SDK; - bundles the required QNN libraries (including
libQnnHtpNetRunExtensions.so); - rewrites
backend.extensionsingenie_config.jsonto an HTP config matchingBuild.SOC_MODEL(SM8850 → V81, SM8750 → V79, SM8650 → V75, SM8550 → V73), so the SM8750-targeted config shipped here is replaced on the fly.
Import: Models → + → Genie → select the model directory. A directory is accepted when it contains
genie_config.json, tokenizer.json and at least one *.bin.
Prompt format
Qwen3 chat markup. The default system prompt used during validation was You are a helpful AI assistant.
<|im_start|>system
You are a helpful AI assistant<|im_end|>
<|im_start|>user
What is gravity? Keep the answer under ten words.<|im_end|>
<|im_start|>assistant
Role prefixes/suffixes are also stored in metadata.json under genie.chat_template, which is what the
Genie-based integrations read.
Sampling defaults
From the shipped genie_config.json:
| Parameter | Value |
|---|---|
temp | 0.8 |
top-k | 40 |
top-p | 0.95 |
seed | 42 |
n-threads | 3 (ignored on HTP) |
seed: 42 is a fixed default from the compilation toolchain — change it if you need varied sampling, or set
seed: -1 / omit it in your own config.
How this was produced
Converted from the upstream Qwen/Qwen3-4B-Instruct-2507 checkpoint with the Qualcomm QNN toolchain
(Qualcomm AI Hub export pipeline; QAIRT 2.45.0.260326154327, recorded in tool-versions.yaml):
- weights quantized to w4a16;
- the graph compiled to Hexagon HTP context binaries for context sizes 512–4096, emitted as four shards;
- Genie dialog/node configs generated, with
metadata.jsonrecording per-tensor shapes, dtypes and quantization scales.
No fine-tuning, no weight modification, no merge was performed. Only quantization and compilation.
License, attribution and disclaimer
Model weights: Apache-2.0, © Alibaba Group / Qwen team. This repository redistributes a derived artifact of
Qwen/Qwen3-4B-Instruct-2507 under the same license; the full license text is in LICENSE, and attribution is
in NOTICE. If you redistribute this artifact or a product built on it, keep LICENSE and NOTICE with it.
Qualcomm SDK: the QNN / Genie runtime (QAIRT SDK, including libQnnHtp*.so and the Hexagon skels) is
proprietary Qualcomm software and is not distributed in this repository. You must obtain it from Qualcomm
and comply with the Qualcomm AI Stack license. This repository contains only the compiled model artifact.
No affiliation. This is an independent conversion. It is not affiliated with, endorsed by, or supported by Alibaba Group or Qualcomm Technologies, Inc. "Qualcomm", "Snapdragon" and "Hexagon" are trademarks of Qualcomm Technologies, Inc.
Disclaimer. Provided as-is, without warranty of any kind, express or implied. It is an experimental on-device artifact: device compatibility is limited to the configurations described above, output quality is that of the base model (including its biases and failure modes), and nothing here is suitable for safety-critical use. Verify on your own hardware before relying on it.