5
stars
18
commits
4
linked in READMEs
Sep 7, 2026
updated
Core AI is Apple's on-device ML runtime in iOS 27 / macOS 27 and the successor to Core ML: PyTorch models are exported with Apple's coreai-torch (LLMs: coreai.llm.export) into .aimodel bundles that run on the GPU or the Neural Engine, e.g. Qwen3-8B 4-bit decodes at 94 tok/s on an M4 Max GPU, MLX 90 under the same protocol (apple-silicon-llm-bench, macOS 27 beta, 2026-06).
gather_qmm kernel, 2.1× faster)Apple Core AI (.aimodel) conversion of Qwen/Qwen3.6-35B-A3B
(text decoder): Qwen3.5's hybrid GatedDeltaNet + gated-attention body with a 256-expert top-8
sparse MoE (+ shared expert). 35B total / ~3B active per token.
Part of the community Core AI model zoo: https://github.com/john-rocky/coreai-model-zoo
(full card: zoo/qwen3.6.md).
⚡ One line — run the kit's task op on this model
(import CoreAIOps; no session, no model plumbing, downloads on first use):
let tldr = try await CoreAI.summarize(text, options: .model("qwen3.6-35b-a3b"))
Every op, one shape — Cookbook.
▶️ Run it (source) — the ChatDemo runner (GUI + CLI, one app for every chat model in the catalog):
git clone https://github.com/john-rocky/coreai-kit
open coreai-kit/Examples/ChatDemo/ChatDemo.xcodeproj
# → Run, then pick "Qwen3.6-35B-A3B (MoE)" in the model picker
# agents / headless (macOS):
cd coreai-kit/Examples/ChatDemo
swift run chat-cli --model qwen3.6-35b-a3b --prompt "What can you do, offline?"
💻 Build with it — complete; the glue is kit API, copy-paste runs:
import CoreAIKit
let chat = try await ChatSession(catalog: "qwen3.6-35b-a3b")
let reply = try await chat.respond(to: prompt)
// reply: the answer, generated fully on-device
Also runs behind Apple's FoundationModels API — CoreAIKit's KitLanguageModel plugs this bundle into the system LanguageModelSession; capabilities (tool calling, guided generation) auto-detect per model.
The take-home is 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.
Integration checklist
https://github.com/john-rocky/coreai-kit → product CoreAIKitdownloadProgress callback)gather_qmm kernel — 30.9 → 64.9 tok/s (2.1×)Apple's GatherMM composite gathers the routed experts then runs a dense matmul that reads all
256 experts' weights every token — over-read-bound at 30.9 tok/s. This bundle uses a custom
coreai_torch.TorchMetalKernel that takes the routed indices as a kernel input and reads only the
8 routed experts' weight slabs (8/256), so decode runs at active-param (~3B) bandwidth: 64.9
tok/s, 2.1×.
Quality is clean and unchanged. The kernel reads the sym8 scheme = the same
symmetric-linear int8 (per-K-block-32) recipe the standard int8 bundle uses, via a bit-exact
gather: 0 introduced flips / 18 vs fp16 (the shipped GatherMM int8 was 14/16 vs the bf16 oracle;
this matches it). So this is a pure speed win at the same quality.
| bundle | size | decode tok/s | quality |
|---|---|---|---|
gpu-pipelined/qwen3_6_35b_a3b_decode_sym8_gather/ | 35 GB | 64.9 | clean (0 flips/18 vs fp16) ✅ |
Mac-only (35 GB int8 is far past the iPhone limit; this is the 64/128 GB-Mac flagship).
COREAI_CHUNK_THRESHOLD=1 llm-benchmark --model gpu-pipelined/qwen3_6_35b_a3b_decode_sym8_gather -p 128 -g 256 -n 3
The decode graph's input_ids is static [1,1]; prefill runs as S=1 pipelined steps. Convert your
own with conversion/export_qwen3_6_moe_metal_decode_pipelined.py.
Apache-2.0 (upstream Qwen license). Conversion + gather_qmm kernel: community.
More models in this format: Core AI Model Zoo — 75 models, each with the recipe that produced it.
Want a different model on-device? Open a request — free, open weights only; the export and its measured numbers get published publicly.
18 commits
5
stars
18
commits
4
linked in READMEs
Sep 7, 2026
updated
Core AI is Apple's on-device ML runtime in iOS 27 / macOS 27 and the successor to Core ML: PyTorch models are exported with Apple's coreai-torch (LLMs: coreai.llm.export) into .aimodel bundles that run on the GPU or the Neural Engine, e.g. Qwen3-8B 4-bit decodes at 94 tok/s on an M4 Max GPU, MLX 90 under the same protocol (apple-silicon-llm-bench, macOS 27 beta, 2026-06).
gather_qmm kernel, 2.1× faster)Apple Core AI (.aimodel) conversion of Qwen/Qwen3.6-35B-A3B
(text decoder): Qwen3.5's hybrid GatedDeltaNet + gated-attention body with a 256-expert top-8
sparse MoE (+ shared expert). 35B total / ~3B active per token.
Part of the community Core AI model zoo: https://github.com/john-rocky/coreai-model-zoo
(full card: zoo/qwen3.6.md).
⚡ One line — run the kit's task op on this model
(import CoreAIOps; no session, no model plumbing, downloads on first use):
let tldr = try await CoreAI.summarize(text, options: .model("qwen3.6-35b-a3b"))
Every op, one shape — Cookbook.
▶️ Run it (source) — the ChatDemo runner (GUI + CLI, one app for every chat model in the catalog):
git clone https://github.com/john-rocky/coreai-kit
open coreai-kit/Examples/ChatDemo/ChatDemo.xcodeproj
# → Run, then pick "Qwen3.6-35B-A3B (MoE)" in the model picker
# agents / headless (macOS):
cd coreai-kit/Examples/ChatDemo
swift run chat-cli --model qwen3.6-35b-a3b --prompt "What can you do, offline?"
💻 Build with it — complete; the glue is kit API, copy-paste runs:
import CoreAIKit
let chat = try await ChatSession(catalog: "qwen3.6-35b-a3b")
let reply = try await chat.respond(to: prompt)
// reply: the answer, generated fully on-device
Also runs behind Apple's FoundationModels API — CoreAIKit's KitLanguageModel plugs this bundle into the system LanguageModelSession; capabilities (tool calling, guided generation) auto-detect per model.
The take-home is 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.
Integration checklist
https://github.com/john-rocky/coreai-kit → product CoreAIKitdownloadProgress callback)gather_qmm kernel — 30.9 → 64.9 tok/s (2.1×)Apple's GatherMM composite gathers the routed experts then runs a dense matmul that reads all
256 experts' weights every token — over-read-bound at 30.9 tok/s. This bundle uses a custom
coreai_torch.TorchMetalKernel that takes the routed indices as a kernel input and reads only the
8 routed experts' weight slabs (8/256), so decode runs at active-param (~3B) bandwidth: 64.9
tok/s, 2.1×.
Quality is clean and unchanged. The kernel reads the sym8 scheme = the same
symmetric-linear int8 (per-K-block-32) recipe the standard int8 bundle uses, via a bit-exact
gather: 0 introduced flips / 18 vs fp16 (the shipped GatherMM int8 was 14/16 vs the bf16 oracle;
this matches it). So this is a pure speed win at the same quality.
| bundle | size | decode tok/s | quality |
|---|---|---|---|
gpu-pipelined/qwen3_6_35b_a3b_decode_sym8_gather/ | 35 GB | 64.9 | clean (0 flips/18 vs fp16) ✅ |
Mac-only (35 GB int8 is far past the iPhone limit; this is the 64/128 GB-Mac flagship).
COREAI_CHUNK_THRESHOLD=1 llm-benchmark --model gpu-pipelined/qwen3_6_35b_a3b_decode_sym8_gather -p 128 -g 256 -n 3
The decode graph's input_ids is static [1,1]; prefill runs as S=1 pipelined steps. Convert your
own with conversion/export_qwen3_6_moe_metal_decode_pipelined.py.
Apache-2.0 (upstream Qwen license). Conversion + gather_qmm kernel: community.
More models in this format: Core AI Model Zoo — 75 models, each with the recipe that produced it.
Want a different model on-device? Open a request — free, open weights only; the export and its measured numbers get published publicly.
18 commits