sanmonga22 commited on
Commit
ae7f36a
Β·
verified Β·
1 Parent(s): 60b13d4

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +41 -10
README.md CHANGED
@@ -16,7 +16,19 @@ The text decoder is a **hybrid**: 3 of every 4 layers are a **recurrent gated de
16
  runtime drives it with the `qwen3_5_generate` host-op (decode-over-prompt; conv + SSM + KV state carried
17
  host-side), the lm-head as a separate graph.
18
 
19
- ## What's here (`v81/` β€” the flat artifacts root)
 
 
 
 
 
 
 
 
 
 
 
 
20
  | file | role | ~size |
21
  |---|---|---|
22
  | `qwen3.5-2b-1024.json` | QHexRT manifest (the declarative run plan) | 2 KB |
@@ -25,27 +37,46 @@ host-side), the lm-head as a separate graph.
25
  | `qwen352b_embed_f16.bin` | embedding table (host lookup, fp16) | 1.0 GB |
26
  | `tokenizer.json` | Qwen2-style BPE tokenizer | 20 MB |
27
 
 
 
 
 
 
 
 
 
 
28
  Arch-pinned: a v81 binary will not load on another Hexagon arch. The QNN runtime libs come from the QAIRT SDK,
29
  not this repo.
30
 
31
  ## Run
32
  ```bash
33
- hf download runanywhere/qwen3_5_2b_HNPU --local-dir q35_2b
 
34
  adb push q35_2b/v81 /data/local/tmp/wq/qwen35-2b
35
- # also stage the QAIRT runtime libs + a qhx_generate built with the qwen3_5_generate host-op (see caveats)
36
  adb shell "cd /data/local/tmp/wq && LD_LIBRARY_PATH=. \
37
  ./qhx_generate qwen35-2b/qwen3.5-2b-1024.json libQnnHtp.so libQnnSystem.so qwen35-2b 64 'The capital of France is'"
 
 
 
 
 
 
38
  ```
 
39
 
40
  ## Measured (device: SM8850 / v81, QAIRT 2.47)
41
- - **Decode: ~11.0 tok/s** (fp16).
42
- - **Parity: greedy-EXACT** β€” on-device tokens match the HF `Qwen/Qwen3.5-2B` greedy continuation **41/41**
43
- (prompt "The capital of France is").
 
 
44
 
45
  ## Caveats
46
- - **fp16** decode + lm-head (strict greedy parity). W8 weight-only is the next perf lever (~2Γ—, weight-bound).
47
- - The fp16 decode weights (2.7 GB) exceed the 2 GB model-lib relocation limit, so the build uses a
48
- **large-code-model** path (weight blob β†’ `.lrodata` + `-mcmodel=large`); this is baked into the published bin.
 
49
  - **Text-LLM path only** β€” the vision tower + MTP head are not exported.
50
  - Needs a `qhx_generate` that includes the **`qwen3_5_generate`** host-op (QHexRT branch `smonga/qwen_fam`).
51
- - Built by the in-repo `forge` pipeline (oracle-gated export 10/10 β†’ QAIRT-2.47 O3 compile β†’ device greedy gate).
 
16
  runtime drives it with the `qwen3_5_generate` host-op (decode-over-prompt; conv + SSM + KV state carried
17
  host-side), the lm-head as a separate graph.
18
 
19
+ ## Two precision bundles β€” pick the dir
20
+
21
+ | dir | precision | decode bin | decode | parity | when to use |
22
+ |---|---|---|---|---|---|
23
+ | **`v81/`** | **fp16** | 2.76 GB | ~11.0 tok/s | **strict greedy-exact** (suite 10/10) | bit-faithful HF parity |
24
+ | **`v81-w8/`** | **W8A16** (decode W8 + fp16 lm-head) | **1.3 GB** | **~14.4 tok/s** | single-prompt greedy-exact 64/64; **length-swept suite 8/10** under a tolerant `greedy_tol` gate | **~half the decode size + ~1.3Γ— faster**; coherent throughout |
25
+
26
+ Both are device-validated on **SM8850 / v81** (QAIRT 2.47). The W8 decode also **fits a single context** and
27
+ avoids the fp16 build's >2 GB large-code-model path. Same `embed_f16` / `lmhead_f16` / `tokenizer` in both.
28
+
29
+ ## What's here
30
+
31
+ ### `v81/` (fp16 β€” strict parity)
32
  | file | role | ~size |
33
  |---|---|---|
34
  | `qwen3.5-2b-1024.json` | QHexRT manifest (the declarative run plan) | 2 KB |
 
37
  | `qwen352b_embed_f16.bin` | embedding table (host lookup, fp16) | 1.0 GB |
38
  | `tokenizer.json` | Qwen2-style BPE tokenizer | 20 MB |
39
 
40
+ ### `v81-w8/` (W8A16 β€” smaller + faster)
41
+ | file | role | ~size |
42
+ |---|---|---|
43
+ | `qwen3.5-2b-1024.json` | QHexRT manifest (references the W8 decode) | 2 KB |
44
+ | `qwen352b_decode_w8.bin` | decode context binary (24 layers, **W8 weight-only**) | **1.3 GB** |
45
+ | `qwen352b_lmhead_f16.bin` | lm-head context binary (tied embed, fp16) | 1.0 GB |
46
+ | `qwen352b_embed_f16.bin` | embedding table (host lookup, fp16) | 1.0 GB |
47
+ | `tokenizer.json` | Qwen2-style BPE tokenizer | 20 MB |
48
+
49
  Arch-pinned: a v81 binary will not load on another Hexagon arch. The QNN runtime libs come from the QAIRT SDK,
50
  not this repo.
51
 
52
  ## Run
53
  ```bash
54
+ # fp16 (strict parity):
55
+ hf download runanywhere/qwen3_5_2b_HNPU --include "v81/*" --local-dir q35_2b
56
  adb push q35_2b/v81 /data/local/tmp/wq/qwen35-2b
 
57
  adb shell "cd /data/local/tmp/wq && LD_LIBRARY_PATH=. \
58
  ./qhx_generate qwen35-2b/qwen3.5-2b-1024.json libQnnHtp.so libQnnSystem.so qwen35-2b 64 'The capital of France is'"
59
+
60
+ # W8 (smaller + faster):
61
+ hf download runanywhere/qwen3_5_2b_HNPU --include "v81-w8/*" --local-dir q35_2b
62
+ adb push q35_2b/v81-w8 /data/local/tmp/wq/qwen35-2b-w8
63
+ adb shell "cd /data/local/tmp/wq && LD_LIBRARY_PATH=. \
64
+ ./qhx_generate qwen35-2b-w8/qwen3.5-2b-1024.json libQnnHtp.so libQnnSystem.so qwen35-2b-w8 64 'The capital of France is'"
65
  ```
66
+ (also stage the QAIRT runtime libs + a `qhx_generate` built with the `qwen3_5_generate` host-op β€” see caveats.)
67
 
68
  ## Measured (device: SM8850 / v81, QAIRT 2.47)
69
+ - **fp16 (`v81/`):** ~11.0 tok/s; greedy-EXACT vs HF `Qwen/Qwen3.5-2B` (41/41).
70
+ - **W8 (`v81-w8/`):** **~14.4 tok/s** (~1.3Γ— fp16); single-prompt greedy-exact **64/64**; length-swept parity
71
+ suite (up to 70% of MAXCTX) **8/10** under a tolerant `greedy_tol` gate (the 2 misses are W8 near-tie
72
+ argmax-drift into coherent-but-different text β€” the longer-context variants pass, so it is benign quant
73
+ noise, not a context bug).
74
 
75
  ## Caveats
76
+ - **Precision is your choice:** `v81/` fp16 for strict bit-faithful parity, `v81-w8/` for ~half the decode
77
+ size + ~1.3Γ— speed at a *tolerant* (8/10 suite) parity. W8 quantizes only weights β€” the fp32 SSM scan +
78
+ host conv/SSM/KV state are untouched.
79
+ - **W4 is HTP-toolchain-blocked** on v81 β€” W8 is the quant floor.
80
  - **Text-LLM path only** β€” the vision tower + MTP head are not exported.
81
  - Needs a `qhx_generate` that includes the **`qwen3_5_generate`** host-op (QHexRT branch `smonga/qwen_fam`).
82
+ - Built by the in-repo `forge` pipeline (oracle-gated export β†’ QAIRT-2.47 O3 compile β†’ device greedy gate).