Views
No views yet
.aimodel)[!NOTE] Update 2026-07-15:gpu-pipelined-b2/addslfm2_5_1_2b_instruct_decode_int8hu_block32_symre-exported withcoreai-core 1.0.0b2, loadable on the OS 27 beta 3 toolchain (June-era b1 bundles fail to load there with a versioned-IR error). The original b1 tree is retained unchanged so existing apps and pinned catalogs keep working. The b2 decode bundle is the exact artifact measured on DeviceMark.
coreai-pipelined GPU
engine — the first non-Qwen architecture on that fast path, with zero custom kernels.Requires the iOS 27 / macOS 27 beta (Core AI ships with the OS). Conversion code, knowledge base, and the Swift runner: coreai-model-zoo.
import CoreAIOps; no session, no model plumbing, downloads on first use):let tldr = try await CoreAI.summarize(text, options: .model("lfm2.5-1.2b"))1git clone https://github.com/john-rocky/coreai-kit
2open coreai-kit/Examples/ChatDemo/ChatDemo.xcodeproj
3# → Run, then pick "LFM2.5 1.2B" in the model picker
4
5# agents / headless (macOS):
6cd coreai-kit/Examples/ChatDemo
7swift run chat-cli --model lfm2.5-1.2b --prompt "What can you do, offline?"1import CoreAIKit
2
3let chat = try await ChatSession(catalog: "lfm2.5-1.2b")
4let reply = try await chat.respond(to: prompt)
5// reply: the answer, generated fully on-deviceKitLanguageModel plugs this bundle into the system LanguageModelSession; capabilities (tool calling, guided generation) auto-detect per model.Examples/ChatDemo/Sources/QuickStart.swift
— this exact code as one typed function, no UI; the CLI is an argument shell over it, and
the GUI drives the same ChatSession across turns for its transcript.
Multi-turn? Hold the ChatSession and call respond(to:) per turn — it keeps the
conversation history; streamResponse(to:) yields tokens as they decode.https://github.com/john-rocky/coreai-kit → product CoreAIKitdownloadProgress callback)| Surface | Bundle | Prefill | Decode |
|---|---|---|---|
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 |
| iPhone 17 Pro, one-shot runner | ★★★ same bundle | 44.2–46.6 | 44.1–46.6 tok/s |
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 |
| iPhone 17 Pro, one-shot runner | ★★ same bundle | 39.2–39.4 | 38.0–39.6 tok/s |
| iPhone 17 Pro, chat app (CoreAIChat LFM mode, 200-tok turn) | int8lin bundle | 30.7 | 35.8 tok/s |
int8hu_block32_sym): int8lin + the tied lm_head untied and
quantized absmax per-block-32 int8 (symmetric, no clipping — clipping corrupts
big-vocab heads). +9% on M4 Max, +15–20% on iPhone (44.1–46.6 ≈ ~94–98% of the naive
bandwidth ceiling, ~60 GB/s ÷ ~1.27 GB/token); warm engine load 0.3 s. Greedy rollouts are
token-identical to the int8lin bundle on both verification prompts; oracle gate 16/16 +
decode step, device numerics 24/24 ≡ Mac-GPU on all 3 runs..aimodel + tokenizer/ + metadata.json): decode-only graph,
input_ids static [1,1], position_ids + KV seq dynamic (→ the engine factory selects
coreai-pipelined: async non-blocking encode, on-GPU argmax sampling, on-device KV growth).
Weights are int8 linear per-block-32 (scale-multiply dequant — no LUT; k-means LUT
gathers measure slower on this GPU delegate) with the embedding, depthwise convs, norms,
and the four attention projections kept high-precision; in the ★★★ bundle the lm_head is
untied and quantized absmax per-block-32 int8 too (in the ★★ bundle it stays fp16/tied).
Do NOT re-quantize the head per-channel: per-channel (axis-0) int8 weights are broken on
the current beta GPU delegate (garbage logits — delegate lowering bug, documented in the
zoo knowledge base). The attention projections
are fp32 on purpose: under a dynamic-shape graph the delegate's fp16 attention-prologue
matmuls lose ~1.3% relative accuracy, which LFM2.5's large q/k-norm gains amplify into wrong
logits — fp32 there restores layer-level exactness (+126 MB). Full write-up:
knowledge/pipelined-engine.md.1git clone https://github.com/john-rocky/coreai-model-zoo
2git clone https://github.com/apple/coreai-models
3git -C coreai-models apply ../coreai-model-zoo/apps/coreai-shared-product.patch \
4 ../coreai-model-zoo/apps/coreai-pipelined-extra-states.patch
5# (the extra-states patch lets the engine carry the conv state as a fixed-shape extra state)
6
7# download this bundle into coreai-models/exports/, then:
8cd coreai-models && swift build -c release
9COREAI_CHUNK_THRESHOLD=1 ./.build/release/llm-benchmark \
10 --model exports/lfm2_5_1_2b_instruct_decode_int8hu_block32_sym -p 128 -g 256 -n 3COREAI_CHUNK_THRESHOLD=1 before engine creation — prefill must run as pipelined S=1
steps (prompt tok/s ≈ decode tok/s).engine.warmup() on this S=1 bundle (it warms query length 256, which the
static [1,1] graph rejects). A 1-token generate after load is the warmup;
llm-runner needs --warmup exact --warmup-length 1.conversion/export_lfm2_decode_pipelined.py
(+ the models/macos/lfm2.py overlay) from the upstream HF checkpoint. Numerics are gated
the strict way: a teacher-forced S=1 sweep over a 16-position oracle prompt (top-1 vs the
fp32 HF reference at every position, 16/16 required) plus an oracle-cache-seeded decode
step — not long-rollout eyeballing. Model card with the full method and the GPU-delegate
findings: zoo/lfm2.5.md.