A field guide for iOS & macOS engineers · iOS 26 baseline
Ship AI features with no API bill, no data leaving the device, and no vibes-based engineering.
On-Device Intelligence is a 12-chapter engineer-to-engineer guide to
Apple's Foundation Models framework and MLX: from your first typed, streaming
feature to model selection, memory budgets, App Review, and regression evals that
run entirely on your own hardware.
swift run modelbench --backend fm
run ttft(s) total(s) est-tok/s peak-mem(MB)
cold 1.59 2.13 198 9
warm 0.36 1.03 182 11
swift run localeval goldens/digest.json --backend fm
standup-basic PASS
hostile-formatting PASS
tier-1: 5/5 passed
Real output from the companion tools against the live system model. Not a mockup.
Why this book
The framework docs tell you what compiles. This book tells you what ships.
In 2026 every iOS team faces the same decision: Apple's free on-device model, an open
model you control, or a cloud API with a per-request invoice. The difference between a
demo and a product is a hundred unglamorous details: jetsam budgets, context-window
overflow, availability ladders, model swaps arriving silently in OS updates.
- Every code snippet is compiler-verified against the shipping SDK, including the places where Apple's own sample code and popular blog posts no longer compile.
- Real numbers, stated method: benchmark tables measured by an open harness you can re-run, not leaderboard folklore.
- The whole lifecycle: architecture decision, implementation, memory and thermals, privacy claims that survive legal review, App Review notes, and regression evals with no cloud in the loop.
- Free updates: the iOS 27 revision (the
LanguageModel protocol, Core AI) ships to every buyer at no charge.
Contents
Twelve chapters, four parts, three runnable tools.
Part I · The Decision
- Why Local: the economics, the latency floor, the true capability ceiling
- The Apple AI Stack, Mapped: one decision matrix for FM, MLX, Core ML, llama.cpp
- Your First On-Device Feature FREE
Part II · Foundation Models in Production
- Guided Generation Deep Dive
- Tool Calling
- Sessions, Context, and Memory
- Availability and the Device Matrix
Part III · Owning the Model
- MLX Swift: Bring Your Own Model
- Ollama as Development Infrastructure
Part IV · Shipping
- Memory, Thermals, Battery
- Privacy Architecture and App Review
- Evals Without a Cloud
Plus three appendices: a measured model catalog, prompt patterns for 3B-class models,
and the complete GenerationError troubleshooting table, enumerated by the
compiler rather than copied from docs.
Pricing
One-time purchase. Quarterly updates included.
Book
$59
- 12 chapters + appendices
- PDF & EPUB, DRM-free
- All future updates
Buy the book
Book + Code
$99
- Everything in Book
- Companion repo: DigestKit, ModelBench, LocalEval
- The full benchmark dataset
Buy book + code
Team
$199
- Everything in Book + Code
- License for up to 10 engineers
- Priority errata answers
Buy for your team
30-day refund, no questions. If the compile gates in Chapter 3 don't convince you, ask
for your money back.
Free sample
Chapter 3: your first on-device feature, end to end.
Availability handling, typed guided generation, streaming into SwiftUI, and the three
errors that dominate production. The complete lead chapter, free. It's the same
feature the companion demo app ships.
Author
Written from a home rack, not a content calendar.
%
Written by Roberto Gutierrez, founder of Digital Foundry and a
staff iOS/tvOS engineer with more than twelve years on Apple platforms, who runs
local inference daily: Ollama on a
Mac Studio M2 Ultra serving a LAN, MLX on Apple silicon, evals against golden sets
before anything ships. The same person restores mechanical Nikon film cameras and
modded iPod Classics, which is to say: someone who thinks broken abstractions should
be opened, measured, and fixed. This book treats language models the same way.
Questions
Fair questions, straight answers.
- Isn't this all going to change at the next WWDC?
- Some of it. That's why updates are free and the code pins exact dependency versions. The iOS 27 material (the
LanguageModel protocol, multimodal prompts, Core AI) is already tracked in clearly-marked sections and lands as a free revision when the SDK stabilizes.
- I could read Apple's docs for free. What's the $99 for?
- The docs describe the APIs. The book covers what they don't: which stack to pick and why, the memory budget that jetsams your app twenty turns in, the App Review notes that prevent a rejection cycle, the eval harness that catches Apple swapping the model under you, and the API drift the docs haven't caught up with, verified by compiler, with receipts.
- Does it cover [some giant cloud model]?
- No. This book is about the models that run on the machine in your user's hand, the 1–8B class, and it's plain about what they can't do. Chapter 1 includes the decision framework for when the cloud is still the right answer.
- What do I need to run the code?
- macOS 26+, Xcode 26+, Apple silicon. The eval and benchmark tools run on any M-series Mac; the demo app needs Apple Intelligence enabled. An Ollama-capable Mac (any M-series, more RAM is better) unlocks the Chapter 9–12 workflow.