
Apple On Device Ai
Ship on-device AI in Swift apps using Foundation Models, Core ML, MLX Swift, or llama.cpp without sending prompts to the cloud.
Install
npx skills add https://github.com/dpearson2699/swift-ios-skills --skill apple-on-device-aiWhat is this skill?
- Framework selection router across Foundation Models, Core ML, MLX Swift, and llama.cpp
- Foundation Models: LanguageModelSession, @Generable, @Guide, structured output, and tool calling on iOS 26+ / Apple Sili
- Core ML pipeline: coremltools conversion, quantization, palettization, pruning, Neural Engine, MLTensor
- MLX Swift transformer inference and unified-memory patterns on Apple Silicon
- Multi-backend architecture guidance plus performance best practices and a review checklist
Adoption & trust: 1.8k installs on skills.sh; 713 GitHub stars; 2/3 security scanners passed (skills.sh audits).
Recommended Skills
Journey fit
Canonical shelf is Build because the skill teaches framework choice, conversion, and inference wiring inside an Apple platform codebase. Integrations fits best: it connects Apple ML stacks (LanguageModelSession, coremltools, GGUF runtimes) into app features rather than owning UI polish alone.
Common Questions / FAQ
Is Apple On Device Ai safe to install?
skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Apple On Device Ai
# On-Device AI for Apple Platforms Guide for selecting, deploying, and optimizing on-device ML models. Covers Apple Foundation Models, Core ML, MLX Swift, and llama.cpp. ## Contents - [Framework Selection Router](#framework-selection-router) - [Apple Foundation Models Overview](#apple-foundation-models-overview) - [Core ML Overview](#core-ml-overview) - [MLX Swift Overview](#mlx-swift-overview) - [Multi-Backend Architecture](#multi-backend-architecture) - [Performance Best Practices](#performance-best-practices) - [Common Mistakes](#common-mistakes) - [Review Checklist](#review-checklist) - [References](#references) ## Framework Selection Router Use this decision tree to pick the right framework for your use case. ### Apple Foundation Models **When to use:** Text generation, summarization, entity extraction, structured output, and short dialog on iOS 26+ / macOS 26+ devices with Apple Intelligence enabled. Zero setup -- no API keys, no network, no model downloads. **Best for:** - Generating text or structured data with `@Generable` types - Summarization, classification, content tagging - Tool-augmented generation with the `Tool` protocol - Apps that need guaranteed on-device privacy **Not suited for:** Complex math, code generation, factual accuracy tasks, or apps targeting pre-iOS 26 devices. ### Core ML **When to use:** Deploying custom trained models (vision, NLP, audio) across all Apple platforms. Converting models from PyTorch, TensorFlow, or scikit-learn with coremltools. **Best for:** - Image classification, object detection, segmentation - Custom NLP classifiers, sentiment analysis models - Audio/speech models via SoundAnalysis integration - Any scenario needing Neural Engine optimization - Models requiring quantization, palettization, or pruning ### MLX Swift **When to use:** Running specific open-source LLMs (Llama, Mistral, Qwen, Gemma) on Apple Silicon with maximum throughput. Research and prototyping. **Best for:** - Highest sustained token generation on Apple Silicon - Running Hugging Face models from `mlx-community` - Research requiring automatic differentiation - Fine-tuning workflows on Mac ### llama.cpp **When to use:** Cross-platform LLM inference using GGUF model format. Production deployments needing broad device support. **Best for:** - GGUF quantized models (Q4_K_M, Q5_K_M, Q8_0) - Cross-platform apps (iOS + Android + desktop) - Maximum compatibility with open-source model ecosystem ### Quick Reference | Scenario | Framework | |---|---| | Text generation, zero setup (iOS 26+) | Foundation Models | | Structured output from on-device LLM | Foundation Models (`@Generable`) | | Image classification, object detection | Core ML | | Custom model from PyTorch/TensorFlow | Core ML + coremltools | | Running specific open-source LLMs | MLX Swift or llama.cpp | | Maximum throughput on Apple Silicon | MLX Swift | | Cross-platform LLM inference | llama.cpp | | OCR and text recognition | Vision framework | | Sentiment analysis, NER, tokenization | Natural Language framework | | Training custom classifiers on device | Create ML | ## Apple Foundation Models Overview On-device language model optimized for Apple Silicon. Available on devices supporting Apple Intelligence (iOS 26+, macOS 26+). - Token budget covers input + output; check `contextSize` for the limit - Check `supportedLanguages` fo