card: Neural Engine bundle section — 6-bit, why, speed, first-load cost, GSM8K 200
Browse files
README.md
CHANGED
|
@@ -81,22 +81,44 @@ conversation history; `streamResponse(to:)` yields tokens as they decode.
|
|
| 81 |
- Measure in Release — Debug is ~3× slower on per-token host work
|
| 82 |
<!-- gen-cards:use-it end -->
|
| 83 |
|
| 84 |
-
## Neural Engine bundle (iOS static export, AOT h18p) — 2026-09-
|
| 85 |
|
| 86 |
-
`ios-ane-h18p/` is Apple's stock `coreai.llm.export --platform iOS` static export of this checkpoint
|
| 87 |
-
|
|
|
|
| 88 |
contexts {256, 512, 1024, 2048, 4096} × query {8, 16, 64}), AOT-compiled with
|
| 89 |
`xcrun coreai-build compile --platform iOS --preferred-compute neural-engine --architecture h18p`
|
| 90 |
-
(31/31 ANE regions,
|
| 91 |
(iPhone 17-class devices). `ios-static/` is the same export before AOT — the portable IR; compile it
|
| 92 |
-
for another chip yourself.
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
## Measured
|
| 102 |
|
|
|
|
| 81 |
- Measure in Release — Debug is ~3× slower on per-token host work
|
| 82 |
<!-- gen-cards:use-it end -->
|
| 83 |
|
| 84 |
+
## Neural Engine bundle (iOS static export, AOT h18p) — 2026-09-16
|
| 85 |
|
| 86 |
+
`ios-ane-h18p/` is Apple's stock `coreai.llm.export --platform iOS` static export of this checkpoint at
|
| 87 |
+
**6-bit k-means palettization, group 8** (the shape of Apple's own iOS preset for Qwen3-1.7B;
|
| 88 |
+
`conversion/minicpm5_pal6_g8.yaml` in the zoo; embeddings int8; static graphs `prompt_opt`/`extend` ×
|
| 89 |
contexts {256, 512, 1024, 2048, 4096} × query {8, 16, 64}), AOT-compiled with
|
| 90 |
`xcrun coreai-build compile --platform iOS --preferred-compute neural-engine --architecture h18p`
|
| 91 |
+
(31/31 ANE regions, 2.5 GB). It loads through Apple's `EngineFactory` → `StaticShapeEngine` unchanged
|
| 92 |
(iPhone 17-class devices). `ios-static/` is the same export before AOT — the portable IR; compile it
|
| 93 |
+
for another chip yourself.
|
| 94 |
+
|
| 95 |
+
Why 6-bit: the 2026-09-15 bundle was Apple's iOS default (4-bit, group 32). It passed the three short
|
| 96 |
+
gate prompts but diverged from fp32 at the first token of a 109-token free-form answer (and got the
|
| 97 |
+
physics wrong). At 6-bit the same phone matches fp32 token-for-token on the three short prompts (24/24,
|
| 98 |
+
8/8 including the stop, 16/16) and for 33 tokens of the long answer, then diverges on a step where fp32
|
| 99 |
+
itself is nearly tied (top-2 margin 0.17); 5 of its 109 teacher-forced steps differ — transcript
|
| 100 |
+
`models/minicpm5-2b/gate-minicpm5-2b-ane-6bit-device.json` in the zoo. An 8-bit shape is exact in an
|
| 101 |
+
fp32 simulation of the recipe, but the 2B at 8 bits (2.16 GB of weights) loads on the ANE and never
|
| 102 |
+
returns its first token, and 4-bit group 8 does not compile for the ANE at all — zoo
|
| 103 |
+
`knowledge/ane-vs-gpu-iphone-2026-09.md` §9.
|
| 104 |
+
|
| 105 |
+
Speed on an iPhone 17 Pro (iOS 27.0), same day, engine released and idle until the thermal state was
|
| 106 |
+
back at `fair`, then 60 s of 128-token-prompt / 256-token trials: **38.5 tok/s decode** (flat over the
|
| 107 |
+
minute), prefill 1679 tok/s, footprint 2.6 GB. In the same run the `int8/` GPU bundle decoded 23.8 tok/s;
|
| 108 |
+
the previous 4-bit ANE bundle did ~55 (`models/minicpm5-2b/bench-iphone-ane-6bit-vs-gpu-2026-09-16.json`).
|
| 109 |
+
**The first launch on a phone builds the ANE programs: about 23 minutes** (0.2 s afterwards; the cache
|
| 110 |
+
lives in the app's container and is invalidated by an iOS update).
|
| 111 |
+
|
| 112 |
+
Task accuracy, GSM8K test (first 200 questions, 0-shot CoT, greedy, no-think, max 640 new tokens; same
|
| 113 |
+
prompt and scoring as the litertlm-convert evals) — `models/minicpm5-2b/gsm8k-200-2026-09-17.json` in the zoo:
|
| 114 |
+
|
| 115 |
+
| model | correct / 200 |
|
| 116 |
+
|---|---:|
|
| 117 |
+
| fp32 checkpoint (bf16 on a Mac) | 172 (86.0 %) |
|
| 118 |
+
| **`ios-ane-h18p/` 6-bit, on the iPhone 17 Pro** | **173 (86.5 %)** |
|
| 119 |
+
| the same 6-bit recipe applied to the fp32 weights (Mac) | 172 (86.0 %) |
|
| 120 |
+
| the `int8/` recipe applied to the fp32 weights (Mac) | 171 (85.5 %) |
|
| 121 |
+
| the replaced 4-bit bundle, on the iPhone 17 Pro | 131 (65.5 %) |
|
| 122 |
|
| 123 |
## Measured
|
| 124 |
|