The Four Patterns That Ship
1. Bundled model
Model inside the app binary. Best under ~500MB; instant first-run, zero network. The right call for fixed-function AI (a translator, an OCR tool) where the model never changes.
2. Download-once
Model fetched to private storage on first launch. Required for 1–4B GGUFs on phones or 7B+ on desktops. Add resume, SHA-256 verification, and a quiet background fetch — and a "Download 2.4GB" screen that doesn't feel like a tax.
3. Hybrid routing
Local model by default; cloud frontier for hard cases or when the user opts in. The product pattern of 2026: privacy by default, capability on request. See the privacy guide for the data story.
4. Model-as-remote-config
Models versioned and pushed like config, not code. Ship the runtime in the app; swap the weights server-side. This is how you improve on-device AI without app-store releases — and how you roll back a bad quant.
The Delegate Layer: NPU, GPU, CPU
| Platform | Path to NPU/GPU | Notes |
|---|---|---|
| iOS / macOS | CoreML (or llama.cpp Metal) | Apple's NPU (ANE) via CoreML is well-supported; GGUF via llama.cpp works too |
| Android | ONNX Runtime + NNAPI, or llama.cpp Vulkan | NNAPI delegates vary wildly per device — test on real hardware, keep CPU fallback |
| Windows / Linux desktop | llama.cpp (CUDA/Vulkan), ONNX Runtime | Desktop is the easiest target — see llama.cpp guide |
| Web (WASM) | WebLLM / transformers.js | Surprisingly viable for 1–3B in 2026; no install required |
The rule that saves every project: benchmark on the worst device you support, and keep a CPU path. NPU support is the fastest-moving and most inconsistent layer in the stack.
Design Decisions That Matter
- Quantize for the store, not for your dev box. Q4_K_M in production; Q8/F16 only in development. The quant guide has the trade-offs.
- Stream tokens to the UI. First-token latency is the UX; full generation can lag behind. Pair with speculative decoding where the runtime supports it.
- Context is a budget. Phones don't do 32K context comfortably. Design features around short context or route long documents to a server-side RAG.
- Battery and thermals are product constraints. A 30-second generation on a phone is a heat event. Prefer 1–4B models for anything interactive.
- Update the model like infrastructure. Version it, A/B test quants, and never force a user's model to change without consent (it's their storage and their behavior).
When On-Device Wins (and When It Doesn't)
| Scenario | Verdict |
|---|---|
| Privacy-sensitive product (health, legal, notes) | On-device, non-negotiable — see regulated industries |
| Offline requirement (travel, field work, air-gap) | On-device |
| Peak reasoning quality as the product | Hybrid — local default, cloud for hard tasks |
| Tiny app size as a constraint | Download-once, or hybrid with aggressive local-first |
| Rapid model iteration (weekly updates) | Model-as-remote-config, not bundled |
Frequently Asked Questions (FAQ)
What is on-device AI?
On-device AI runs models directly on the user's device — phone, laptop, or edge box — instead of calling a cloud API. The model is packaged in the app or downloaded once; inference uses local hardware (CPU, GPU, NPU). Benefits: privacy, offline availability, zero per-request cost, and low latency.
Which models should I run on-device in 2026?
1–4B models are the phone sweet spot (Qwen3.5-4B, Gemma 4 E4B, SmolLM3-3B); 7–14B run on laptops and desktops (Qwen3.5-9B, Gemma 4 12B). Quantize to Q4_K_M and test with the actual NPU/GPU delegate — benchmark numbers beat estimates.
How do I package a model into a mobile app?
Two patterns: bundle small models in the app binary (best under ~500MB, instant first-run) or download once to the app's private storage on first launch (required for anything bigger; add resume + integrity checks). GGUF files work directly with llama.cpp-based runtimes; convert formats (CoreML, ONNX) for native delegates.
What is a hybrid cloud/on-device architecture?
A hybrid architecture routes requests by sensitivity and capability: local model for privacy-sensitive or offline work, cloud frontier model for hard tasks or when local quality isn't enough. The app decides (or asks). This is how 2026 products get both privacy and peak capability.
What are the main challenges of on-device AI?
Device fragmentation (NPU support varies wildly), model size vs app size, update logistics (models aren't code), battery/thermal limits on long generations, and quality gaps versus frontier cloud models. Each has a pattern in this guide.
Is on-device AI cheaper than cloud AI?
At scale, yes — no per-token fees, no bandwidth for inference. But you pay in development complexity, model-update plumbing, and the hardware you ship to users. The break-even point depends on volume; for heavy-use privacy apps, on-device usually wins on cost and privacy simultaneously.
Sources & Further Reading
- Running AI Models on Your Phone: On-Device LLMs 2026
- Voice Assistants You Can Build with Local AI
- Top 10 AI Models Under 12B Parameters
- Q4_K_M vs Q8_0: Which Quantization Should You Use?
- Offline AI for Regulated Industries
- Data Privacy vs Cloud AI: The Real Risks in 2026
- ONNX Runtime (cross-platform inference)