Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- executorch
|
| 5 |
+
- xnnpack
|
| 6 |
+
- pte
|
| 7 |
+
- on-device
|
| 8 |
+
- text-generation
|
| 9 |
+
base_model:
|
| 10 |
+
- Qwen/Qwen3.5-4B
|
| 11 |
+
---
|
| 12 |
+
# Qwen3.5-4B — ExecuTorch XNNPACK 8da4w + 8-bit embedding
|
| 13 |
+
|
| 14 |
+
`qwen3_5_4b_xnnpack_8da4w_e8.pte` (2815.1 MB)
|
| 15 |
+
|
| 16 |
+
- **Source**: Qwen/Qwen3.5-4B
|
| 17 |
+
- **License**: Apache-2.0
|
| 18 |
+
- **Quantization**: 8da4w linear + 8-bit embedding (`embedding_quantize: "8,0"`). The
|
| 19 |
+
248320-row embedding is the reason: left in fp32 it is a gigabyte on its own, and at this
|
| 20 |
+
vocabulary size that is most of what a small model weighs.
|
| 21 |
+
- **Export**: executorch 1.4.0 `export_llm`, static shape (seq_len=1), max_seq_length 2048,
|
| 22 |
+
XNNPACK extended_ops
|
| 23 |
+
- **Config**: `llm_params/qwen3_5_4b_xnnpack_8da4w_e8.yaml`
|
| 24 |
+
|
| 25 |
+
## Verification (Mac arm64, 2026-08-21)
|
| 26 |
+
|
| 27 |
+
`llm_params/gen_static.py`, token-by-token prefill then greedy decode, a fresh process per
|
| 28 |
+
prompt so no answer is read through the previous one's cache:
|
| 29 |
+
|
| 30 |
+
| prompt | answer | decode |
|
| 31 |
+
|---|---|---|
|
| 32 |
+
| capital of France? | opens a `<think>` block, reasons, answers Paris | 8.6 tok/s |
|
| 33 |
+
| 日本の首都は? | reads the question back in both languages, then answers | 8.0 tok/s |
|
| 34 |
+
|
| 35 |
+
This size reaches for its thinking mode on questions the 2B answers outright, so a short
|
| 36 |
+
`max_new` may cut it off mid-thought. Budget for it.
|
| 37 |
+
|
| 38 |
+
Chat template: ChatML, bos 248045, eos [248046, 248044].
|
| 39 |
+
|
| 40 |
+
Not measured on a phone, and at 2.8 GB it is the largest text model on this shelf. The
|
| 41 |
+
[0.8B](https://huggingface.co/mlboydaisuke/Qwen3.5-0.8B-ExecuTorch) runs at 10.5 tok/s on an
|
| 42 |
+
iPhone 17 Pro at 651 MB; the
|
| 43 |
+
[2B](https://huggingface.co/mlboydaisuke/Qwen3.5-2B-ExecuTorch) is the middle of the three.
|
| 44 |
+
|
| 45 |
+
## Running it
|
| 46 |
+
|
| 47 |
+
```bash
|
| 48 |
+
python llm_params/gen_static.py \
|
| 49 |
+
--pte qwen3_5_4b_xnnpack_8da4w_e8.pte \
|
| 50 |
+
--tokenizer tokenizer.json \
|
| 51 |
+
--prompt $'<|im_start|>user\nWhat is the capital of France?<|im_end|>\n<|im_start|>assistant\n' \
|
| 52 |
+
--eos_ids "[248046,248044]"
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
The 8-bit embedding needs `from executorch.kernels import quantized` before the program is
|
| 56 |
+
loaded. Without it the method will not even load — `kernel
|
| 57 |
+
'quantized_decomposed::embedding_byte.dtype_out' not found` — which reads like a broken
|
| 58 |
+
export rather than a runtime missing its kernels.
|
| 59 |
+
|
| 60 |
+
(conversion scripts: [executorch-models](https://github.com/john-rocky/executorch-models) ·
|
| 61 |
+
iOS sample: [executorch-samples](https://github.com/john-rocky/executorch-samples))
|