head-quant docs: per-block-32 absmax ship shape (per-channel = beta delegate bug; naming note)
Browse files
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/
|
| 31 |
-
| **iPhone 17 Pro**, one-shot runner | same bundle |
|
| 32 |
-
|
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
| 40 |
-
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/
|
| 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):
|