请求加入做种队列,或现在用 pf download assassinshadow/DeepSeek-R1-Distill-Qwen-1.5B-SM8450-ExecuTorch-QNN 获取(CLI 指南)。
deepseek-r1-distill-qwen-1.5b-sm8450-npu-ctx4096.pte is
deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B
compiled for the Hexagon NPU of the Snapdragon 8 Gen 1 (SM8450, Hexagon v69) with ExecuTorch's
Qualcomm AI Engine Direct (QNN) backend. All 28 decoder layers and the lm_head run on the NPU;
only the 4-bit token-embedding lookup runs on the CPU. Built for and measured on a
Samsung Galaxy S22 Ultra (SM-S908E).
Reasoning works: the model thinks inside <think> … </think> and then answers.
This file is compiled for one chip family and needs the patched runner in
runner/. It is also a small, heavily quantized reasoning model: fast, and often wrong. Read "Quality" first.
AutoDroid Studio is the Android app this model was built for and measured in. It
runs this .pte on the NPU of a Snapdragon 8 Gen 1 phone, exactly as published here. "Running it"
below is for people who want to drive it by hand.
Why use it:
adb, no environment variables. The app sets up
the Qualcomm runtime itself and finds and downloads models from Hugging Face in its own browser.Get AutoDroid Studio on Google Play
| Base model | deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B |
| File | deepseek-r1-distill-qwen-1.5b-sm8450-npu-ctx4096.pte, 1.09 GB |
| SHA-256 | c03900ee34ac94990d94282a5154c4a991df9f83eba14eae422642545c951ab2 |
| Target | SM8450 / Snapdragon 8 Gen 1, Hexagon v69 HTP |
| On the NPU | all 28 decoder layers + lm_head, as QNN contexts |
| On the CPU | the token-embedding lookup (4-bit) |
| Context | 4096 tokens, shared by prompt and answer |
| Mode | KV ("kv"): one graph, one token per call, prompt included |
| Weights | 4-bit LPBQ (group 32), lm_head 8-bit |
| Activations | 16-bit |
| KV cache | 8-bit (Hexagon v69 rejects a 16-bit second matmul input) |
| Exporter | ExecuTorch v1.0.1 static llama (examples/qualcomm/oss_scripts/llama), with patches |
| QNN SDK | QAIRT 2.39.0 (compile time and run time) |
| Calibration | the model's own greedy reasoning on a two-part question, capped at 640 tokens |
--kv_updater SmartMask (default) |
--kv_updater ShiftPointer |
|
|---|---|---|
| Load | 1.4 s | 1.5 s |
| Prompt processing | 15.3 tok/s | 14.2 tok/s |
| Generation | 15.1 tok/s | 13.7 tok/s |
Output is byte-identical between the two KV updaters. Inside a backgrounded Android app: first token 1.1–1.3 s, about 13 tok/s streamed.
Be realistic about this one.
Single-turn evaluation, greedy, 9 prompts: 4 of 9 clean. The misses are mostly the model itself: the float original also rambles past 4096 tokens on "What is the capital of Australia?", it is weak in Japanese, and with thinking off it ignores "in French".
Multi-turn evaluation through an Android app, temperature 0.7, thinking on, 6 conversations, 22 turns: 12 of 22 turns passed, and only once the client handled the failure modes below. Without that handling a five-turn chat scored 1 of 5.
<think> on some follow-ups, with no answer after it.<think> in the cache derails the next turn. After a reply was cut off
mid-reasoning, "Forget the story. What is 2 + 2?" continued the story.For multi-turn chat on this phone, the Gemma 4 E2B build made the same way is clearly better (19 of 22 on the same test).
| File | What it is |
|---|---|
deepseek-r1-distill-qwen-1.5b-sm8450-npu-ctx4096.pte |
the model |
tokenizer.json, tokenizer_config.json, special_tokens_map.json |
the tokenizer of the base model |
chat_template.jinja |
the base model's chat template, for reference |
runner/qnn_llama_runner |
ExecuTorch v1.0.1 qnn_llama_runner for Android arm64, patched (see below) |
runner/libqnn_executorch_backend.so |
the QNN backend it links against |
runner/patch_runner.py |
the patch, so you can rebuild the runner yourself |
Not included: the Qualcomm runtime libraries. You need these from QAIRT 2.39.0:
libQnnHtp.so, libQnnSystem.so, libQnnHtpV69Stub.so, libQnnHtpV69Skel.so. They are
Qualcomm's to distribute. QAIRT 2.48 made the DSP restart mid-generation with a sibling model
from the same exporter; stay on 2.39.
The runner version matters. This file was exported with ExecuTorch v1.0.1. A v1.4.1 runner
segfaults deserializing a v1.0 file, so use the one here or build the v1.0.1 tag.
Push everything into one folder on the phone (the tokenizer files into a tok/ subfolder), then:
cd /data/local/tmp/r1
export LD_LIBRARY_PATH=$PWD ADSP_LIBRARY_PATH=$PWD
./qnn_llama_runner \
--decoder_model_version qwen2_5 \
--tokenizer_path tok \
--model_path deepseek-r1-distill-qwen-1.5b-sm8450-npu-ctx4096.pte \
--eval_mode 0 --seq_len 4096 --temperature 0.6 \
--prompt "$P"
$P is the rendered turn. The runner adds the BOS token itself at the start of a conversation.
<|User|>How many days are in a leap year?<|Assistant|><think>
(that is <think> followed by one newline, as the official template's generation prompt). To
skip reasoning, give it a pre-closed block:
<|User|>Say hello.<|Assistant|><think>
</think>
A system prompt, if any, goes as plain text before the first <|User|>. The bars are the
full-width | (U+FF5C) and the separator is ▁ (U+2581), as in the tokenizer.
What matters here:
--decoder_model_version qwen2_5. The runner has no DeepSeek template. Its qwen2_5 mode
passes the prompt through untouched, so the client renders R1's template.--tokenizer_path must be the folder, with special_tokens_map.json in it. Given the
tokenizer.json file alone, the runner guesses BOS/EOS from token names, gets both wrong for
R1, prepends a wrong BOS and never stops at <|end▁of▁sentence|>.--eval_mode 0: this is a KV-only export.<[UNK_BYTE_0x…<|end▁of▁sentence|>]end…. Its byte-level decoder
has no byte for the full-width characters. Generation does stop correctly; cut the text there.The stock runner is one-shot and prints nothing until it finishes. The patched one streams, and
with --serve stays resident so the model loads once and the KV cache carries over between turns:
client -> runner GEN <nbytes>\n + nbytes of UTF-8 generate from this text
FEED <nbytes>\n + nbytes put text in the KV, no reply
REWIND <pos>\n forget the KV from token pos on
STOP\n (during a GEN) end it early
RESET\n new conversation
QUIT\n
runner -> client \x01READY stop rewind feed\n once, after loading
<echo of the prompt, then tokens> streamed
\x1eEND <chars> <secs> <pos>\n end of a GEN; pos = tokens in the KV
\x1eFED <tokens> <pos>\n
\x1eOK <pos>\n / \x1eOK\n
\x1eERR <why>\n
The runner stops on EOS without feeding it back, so a follow-up GEN must begin with
<|end▁of▁sentence|> to close the previous answer. Measured on the phone: STOP ends a
generation in 0.07 s.
STOP, REWIND to the end of the prompt, and GEN the text \n</think>\n\n: the model
answers as if thinking were off. That turned a 192-second babbling turn into a coherent answer
in 96 seconds.<think> with no answer, GEN \n</think>\n\n from where it
stopped.REWIND to before the reply, FEED what the user saw plus
EOS) so no unclosed <think> stays in the cache.Exported on a PC under WSL (about 3–4 hours, most of it calibration on the CPU) with ExecuTorch
v1.0.1's static LLM flow. That release does not know this model, so it was registered by hand:
Qwen2 architecture, rope_theta 10000, an untied lm_head, and its own Hugging Face → Meta
weight-name converter. Changes needed for Hexagon v69:
QNN weight sharing between a prefill graph and a decode graph needs Hexagon v73 or newer. On v69 a hybrid file holds two full copies of the weights. So the file has a single one-token-per-call graph, and prompts are processed at generation speed (15 tok/s).
The model weights derive from deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B (MIT). Compiled with ExecuTorch and Qualcomm AI Engine Direct. This is an unofficial community build, not affiliated with DeepSeek, Meta or Qualcomm.
有文件?提交种子。
发布种子