Aman0runanywhere commited on
Commit
0d5dd95
Β·
verified Β·
1 Parent(s): dca0aef

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +15 -7
README.md CHANGED
@@ -21,20 +21,26 @@ host RAM as int8, dequantized to fp16 on the fly). It reads only the **2 active
21
  16), so it's faster than running them dense. Quant: **int8 experts + fp16 attention / router / lm-head**
22
  (int16 activations break attention; W4 is too coarse). Fits the device in **4 QNN contexts** (the HTP caps
23
  concurrent contexts β‰ˆ 8). The Phi-3 tokenizer + chat template (`<|user|> … <|end|><|assistant|>`) are applied
24
- on-device, so you pass plain **text**.
 
25
 
26
  | Metric | Value |
27
  |---|---|
28
- | **Decode** | **~5–7.7 tok/s** (top-2 dynamic-weight; thermal-dependent) |
29
- | **TTFT** | ~140–190 ms |
30
- | **Accuracy** | **100 % greedy parity** vs the fp32 PyTorch reference (5 prompts) |
31
- | **Peak RSS** | ~4.8 GB |
 
 
 
 
 
32
 
33
  ## Contents (`v79/`)
34
  | file | what | size |
35
  |---|---|---|
36
  | `phimoe.json` | the QHexRT manifest (`phimoe_generate` host-op) | small |
37
- | `a_lo.bin` / `a_hi.bin` | attn+router graphs, layers 0–15 / 16–31 (KV cache) | 648 MB each |
38
  | `ffndyn.bin` | one dynamic-weight expert-FFN graph (reused) | 72 KB |
39
  | `lmhead_ar1.bin` | final LayerNorm + lm-head β†’ logits | 251 MB |
40
  | `experts_i8.bin` | all 512 experts (32Γ—16), per-output-channel int8 | 2.69 GB |
@@ -59,7 +65,9 @@ adb shell "cd /data/local/tmp/phimoe && export ADSP_LIBRARY_PATH='/data/local/tm
59
 
60
  ## Caveats
61
  - **v79 only** (SM8750). Another arch = re-export (the build plane / `npu-forge`).
62
- - MAXCTX 64 in this build (the AR=1 KV cache width); longer contexts = a re-export.
 
 
63
  - Greedy/argmax decode (temperature 0). Weight-only int8 occasionally flips a thin-margin token; output stays
64
  coherent (the prior-port finding β€” int8 is the accuracy/memory sweet spot, W4 too coarse).
65
 
 
21
  16), so it's faster than running them dense. Quant: **int8 experts + fp16 attention / router / lm-head**
22
  (int16 activations break attention; W4 is too coarse). Fits the device in **4 QNN contexts** (the HTP caps
23
  concurrent contexts β‰ˆ 8). The Phi-3 tokenizer + chat template (`<|user|> … <|end|><|assistant|>`) are applied
24
+ on-device, so you pass plain **text**. **MAXCTX = 2048** (16 Q-heads β†’ wide attention is HTP-correct past the
25
+ v79 512 wall β€” verified 12/12 vs the fp32 reference on a 529-token needle-recall prompt).
26
 
27
  | Metric | Value |
28
  |---|---|
29
+ | **Decode** | **~2.1 tok/s** (top-2 dynamic-weight; static 2048-wide attention every token) |
30
+ | **Prefill / TTFT** | **~0.46 s Γ— prompt_length** (decode-over-prompt; β‰ˆ4.6 s @10 tok, β‰ˆ4 min @529 tok) |
31
+ | **Accuracy** | **100 % greedy parity** vs the fp32 reference β€” 5 prompts **+ a 529-token long-context test** |
32
+ | **Context** | **2048** tokens |
33
+ | **Peak RSS** | ~4.9 GB |
34
+
35
+ > Decode speed is set by the compiled MAXCTX (the 2048-wide attention runs every token), so this is the
36
+ > long-context configuration, not the fastest. The two open levers are a **batched prefill graph** (kills the
37
+ > O(L0) prefill) and **GQA-native attention** (the a-graphs currently materialize 4β†’16 KV heads).
38
 
39
  ## Contents (`v79/`)
40
  | file | what | size |
41
  |---|---|---|
42
  | `phimoe.json` | the QHexRT manifest (`phimoe_generate` host-op) | small |
43
+ | `a_lo.bin` / `a_hi.bin` | attn+router graphs, layers 0–15 / 16–31 (KV cache, MAXCTX 2048) | 655 MB each |
44
  | `ffndyn.bin` | one dynamic-weight expert-FFN graph (reused) | 72 KB |
45
  | `lmhead_ar1.bin` | final LayerNorm + lm-head β†’ logits | 251 MB |
46
  | `experts_i8.bin` | all 512 experts (32Γ—16), per-output-channel int8 | 2.69 GB |
 
65
 
66
  ## Caveats
67
  - **v79 only** (SM8750). Another arch = re-export (the build plane / `npu-forge`).
68
+ - **MAXCTX 2048** (prompt + generation ≀ 2048). The decode-over-prompt prefill is ~0.46 s/prompt-token, so very
69
+ long prompts take minutes to the first token; decode is ~2.1 tok/s regardless of length. A faster small-window
70
+ variant (e.g. 512 + sliding KV ring) is a re-export (`MAXCTX=512 build_alo_ahi_2048_v2.sh`).
71
  - Greedy/argmax decode (temperature 0). Weight-only int8 occasionally flips a thin-margin token; output stays
72
  coherent (the prior-port finding β€” int8 is the accuracy/memory sweet spot, W4 too coarse).
73