mlboydaisuke commited on
Commit
e1167c9
·
verified ·
1 Parent(s): d8c6525

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +71 -0
README.md ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-4B
11
+ ---
12
+ # Qwen3-4B — ExecuTorch XNNPACK 8da4w + 8-bit embedding
13
+
14
+ `qwen3_4b_xnnpack_8da4w_e8.pte` (2469.4 MB)
15
+
16
+ - **Source**: Qwen/Qwen3-4B
17
+ - **License**: Apache-2.0
18
+ - **Quantization**: 8da4w linear + 8-bit embedding (`embedding_quantize: "8,0"`)
19
+ - **Export**: executorch 1.4.0 `export_llm`, static shape (seq_len=1), max_seq_length 2048,
20
+ XNNPACK extended_ops
21
+ - **Config**: `llm_params/qwen3_4b_xnnpack_8da4w_e8.yaml`
22
+
23
+ ## Verification (Mac arm64, 2026-08-21)
24
+
25
+ `llm_params/gen_static.py`, token-by-token prefill then greedy decode, a fresh process per
26
+ prompt so no answer is read through the previous one's cache:
27
+
28
+ | prompt | answer |
29
+ |---|---|
30
+ | capital of France? | opens a `<think>` block and reasons before answering |
31
+ | 17 times 4? | same, working the multiplication out in the block |
32
+
33
+ Decode **28.9 tok/s**, from one pass over every model on this shelf with nothing else
34
+ running. That matters more than it sounds: the same file measured a quarter of its rate
35
+ while an export was running alongside.
36
+
37
+ Chat template: ChatML, bos 151643, eos [151645, 151643].
38
+
39
+ Not measured on a phone.
40
+
41
+ ## Three things checked before exporting
42
+
43
+ - **`use_sdpa_with_kv_cache` is on.** Upstream's `qwen3_5` config leaves it off with no
44
+ reason given while the equally hybrid `lfm2` config has it on; measured on Qwen3.5-2B in
45
+ one run, that is 8.20 tok/s against 16.64.
46
+ - **`dim` and `hidden_dim` both divide by the quantizer's group size.** 8da4w only touches a
47
+ linear whose in_features divide by it, and skips the rest silently — SmolLM2-135M, which
48
+ is 576 wide, came out at 475 MB against fp32's 540 with no warning at all.
49
+ - **Every field of the params json is read by the generic path**, via
50
+ `convert/check_params_used.py`. SmolLM3 sets `no_rope_layer_interval`, which `ModelArgs`
51
+ declares and only the MLX and Qualcomm backends read, and it exports fine and then repeats
52
+ a single word forever.
53
+
54
+ ## Running it
55
+
56
+ ```bash
57
+ python llm_params/gen_static.py \
58
+ --pte qwen3_4b_xnnpack_8da4w_e8.pte \
59
+ --tokenizer tokenizer.json \
60
+ --prompt $'<|im_start|>user\nWhat is the capital of France?<|im_end|>\n<|im_start|>assistant\n' \
61
+ --eos_ids "[151645, 151643]"
62
+ ```
63
+
64
+ The 8-bit embedding needs `from executorch.kernels import quantized` before the program is
65
+ loaded, and `portable_lib._load_for_executorch` rather than `executorch.runtime`. Without
66
+ that the method will not load at all — `kernel
67
+ 'quantized_decomposed::embedding_byte.dtype_out' not found` — which reads like a broken
68
+ export rather than a runtime missing its kernels.
69
+
70
+ (conversion scripts: [executorch-models](https://github.com/john-rocky/executorch-models) ·
71
+ iOS sample: [executorch-samples](https://github.com/john-rocky/executorch-samples))