mlboydaisuke commited on
Commit
303538f
Β·
verified Β·
1 Parent(s): 56b74ab

head-quant docs: per-block-32 absmax ship shape (per-channel = beta delegate bug; naming note)

Browse files
Files changed (1) hide show
  1. README.md +23 -12
README.md CHANGED
@@ -27,17 +27,24 @@ engine** β€” the first non-Qwen architecture on that fast path, with zero custom
27
 
28
  | Surface | Bundle | Prefill | Decode |
29
  |---|---|---:|---:|
30
- | **M4 Max**, release `llm-benchmark` | `gpu-pipelined/lfm2_5_1_2b_instruct_decode_int8lin/` (1.5 GB) | 253.3 tok/s | **253.3 tok/s** |
31
- | **iPhone 17 Pro**, one-shot runner | same bundle | 39.2–39.4 | **38.0–39.6 tok/s** |
32
- | iPhone 17 Pro, chat app (CoreAIChat LFM mode, 200-tok turn) | same bundle | 30.7 | **35.8 tok/s** |
33
-
34
- - ~39 tok/s on iPhone β‰ˆ **~87% of the naive bandwidth ceiling** (~60 GB/s Γ· ~1.4 GB/token) β€”
35
- effectively memory-bandwidth saturated. Cold GPU specialization 6.8 s, warm load 1.6 s; no
36
- AOT compile needed.
 
 
 
 
 
 
 
37
  - iPhone greedy sequences are **24/24 token-identical to the M4 Max GPU** on both fixed
38
- verification prompts.
39
- - For scale: our Qwen3.5-0.8B on the same engine does 204 tok/s on M4 Max β€” this 1.2B does
40
- 253.
41
 
42
  ## What the bundle is
43
 
@@ -46,7 +53,11 @@ One full **LanguageBundle** (`.aimodel` + `tokenizer/` + `metadata.json`): decod
46
  `coreai-pipelined`: async non-blocking encode, on-GPU argmax sampling, on-device KV growth).
47
  Weights are **int8 linear per-block-32** (scale-multiply dequant β€” no LUT; k-means LUT
48
  gathers measure slower on this GPU delegate) with the embedding, depthwise convs, norms,
49
- lm_head, and the four attention projections kept high-precision. The attention projections
 
 
 
 
50
  are fp32 on purpose: under a dynamic-shape graph the delegate's fp16 attention-prologue
51
  matmuls lose ~1.3% relative accuracy, which LFM2.5's large q/k-norm gains amplify into wrong
52
  logits β€” fp32 there restores layer-level exactness (+126 MB). Full write-up:
@@ -64,7 +75,7 @@ git -C coreai-models apply ../coreai-model-zoo/apps/coreai-shared-product.patch
64
  # download this bundle into coreai-models/exports/, then:
65
  cd coreai-models && swift build -c release
66
  COREAI_CHUNK_THRESHOLD=1 ./.build/release/llm-benchmark \
67
- --model exports/lfm2_5_1_2b_instruct_decode_int8lin -p 128 -g 256 -n 3
68
  ```
69
 
70
  Run contract (each of these matters):
 
27
 
28
  | Surface | Bundle | Prefill | Decode |
29
  |---|---|---:|---:|
30
+ | **M4 Max**, release `llm-benchmark` | β˜…β˜…β˜… `gpu-pipelined/lfm2_5_1_2b_instruct_decode_int8hu_block32_sym/` (1.6 GB) | 277.8 tok/s | **276.5 tok/s** |
31
+ | **iPhone 17 Pro**, one-shot runner | β˜…β˜…β˜… same bundle | 44.2–46.6 | **44.1–46.6 tok/s** |
32
+ | M4 Max, release `llm-benchmark` | β˜…β˜… `gpu-pipelined/lfm2_5_1_2b_instruct_decode_int8lin/` (1.5 GB) | 253.3 tok/s | **253.3 tok/s** |
33
+ | iPhone 17 Pro, one-shot runner | β˜…β˜… same bundle | 39.2–39.4 | **38.0–39.6 tok/s** |
34
+ | iPhone 17 Pro, chat app (CoreAIChat LFM mode, 200-tok turn) | int8lin bundle | 30.7 | **35.8 tok/s** |
35
+
36
+ - **β˜…β˜…β˜… = the ship config** (`int8hu_block32_sym`): int8lin + the tied lm_head untied and
37
+ quantized **absmax per-block-32 int8** (`symmetric`, no clipping β€” clipping corrupts
38
+ big-vocab heads). +9% on M4 Max, **+15–20% on iPhone** (44.1–46.6 β‰ˆ ~94–98% of the naive
39
+ bandwidth ceiling, ~60 GB/s Γ· ~1.27 GB/token); warm engine load 0.3 s. Greedy rollouts are
40
+ token-identical to the int8lin bundle on both verification prompts; oracle gate 16/16 +
41
+ decode step, device numerics 24/24 ≑ Mac-GPU on all 3 runs.
42
+ - β˜…β˜… int8lin: the fp16-head variant (what CoreAIChat currently downloads); ~87% of its
43
+ ceiling on iPhone. Cold GPU specialization 6.8 s, warm load 1.6 s; no AOT compile needed.
44
  - iPhone greedy sequences are **24/24 token-identical to the M4 Max GPU** on both fixed
45
+ verification prompts (both bundles).
46
+ - For scale: our Qwen3.5-0.8B on the same engine does 210 tok/s on M4 Max β€” this 1.2B does
47
+ 276.5.
48
 
49
  ## What the bundle is
50
 
 
53
  `coreai-pipelined`: async non-blocking encode, on-GPU argmax sampling, on-device KV growth).
54
  Weights are **int8 linear per-block-32** (scale-multiply dequant β€” no LUT; k-means LUT
55
  gathers measure slower on this GPU delegate) with the embedding, depthwise convs, norms,
56
+ and the four attention projections kept high-precision; in the β˜…β˜…β˜… bundle the lm_head is
57
+ untied and quantized absmax per-block-32 int8 too (in the β˜…β˜… bundle it stays fp16/tied).
58
+ Do NOT re-quantize the head per-channel: per-channel (axis-0) int8 weights are broken on
59
+ the current beta GPU delegate (garbage logits β€” delegate lowering bug, documented in the
60
+ zoo knowledge base). The attention projections
61
  are fp32 on purpose: under a dynamic-shape graph the delegate's fp16 attention-prologue
62
  matmuls lose ~1.3% relative accuracy, which LFM2.5's large q/k-norm gains amplify into wrong
63
  logits β€” fp32 there restores layer-level exactness (+126 MB). Full write-up:
 
75
  # download this bundle into coreai-models/exports/, then:
76
  cd coreai-models && swift build -c release
77
  COREAI_CHUNK_THRESHOLD=1 ./.build/release/llm-benchmark \
78
+ --model exports/lfm2_5_1_2b_instruct_decode_int8hu_block32_sym -p 128 -g 256 -n 3
79
  ```
80
 
81
  Run contract (each of these matters):