1---2name: ios-ai-ml3description: Use when implementing or reviewing iOS AI and ML features with Apple on-device frameworks, model evaluation, and privacy controls; use ios-architecture for general module boundaries.4---56# iOS AI/ML7Acknowledgement: Shared by Peter Bamuhigire, techguypeter.com, +256 784 464178.89<!-- dual-compat-start -->10## Use When1112- Building or reviewing iOS, iPadOS, or macOS AI/ML features using Foundation Models, Core AI, Core ML, Vision, NaturalLanguage, Speech, SoundAnalysis, Create ML, Evaluations, Private Cloud Compute, or a third-party Language Model provider.13- The work includes on-device inference, custom models, multimodal prompts, agentic model tool use, AI evaluation, model-provider selection, privacy-sensitive AI, or Apple Intelligence availability gates.1415## Do Not Use When1617- The task is plain iOS implementation with no AI/ML path; use `ios-development`.18- The task is AI product architecture outside Apple platforms; use `ai-app-architecture`, `ai-llm-integration`, or `ai-evaluation`.19- The task is only AI security, prompt injection, or action authorization; use this skill with `ios-security-and-rbac`.2021## Required Inputs2223- Feature goal, model/provider choices, target Apple platforms, device/OS floor, privacy constraints, offline expectations, data inputs, tools/actions the model may call, and evaluation criteria.24- Confirm whether the deliverable is design, implementation, migration, review, evaluation plan, or release evidence.2526## Workflow27281. Load `ios-development` for Apple-platform implementation rules and availability policy.292. Load `references/apple-intelligence-stack-wwdc26.md` for Foundation Models, Core AI, provider routing, Evaluations, and availability gates.303. Load `references/skill-deep-dive.md` only when you need legacy Core ML, Vision, NaturalLanguage, Create ML, or model-optimization recipes.314. Choose the lowest-risk model path that solves the task: deterministic API, Core ML/Core AI owned model, on-device Foundation Models, Private Cloud Compute, or third-party provider.325. Define privacy, fallback, telemetry, evaluation, and security gates before writing production code.3334## Quality Standards3536- Every AI feature has a provider boundary, availability gate, privacy path, fallback state, and evaluation set.37- On-device claims must be true: no network dependency unless the code path is explicitly cloud or third-party.38- Agentic or tool-calling model features require authorization, audit logging, and security review.39- Model performance work must include device, latency, memory, battery, and thermal evidence.4041## Anti-Patterns4243- Treating Core ML, Core AI, and Foundation Models as interchangeable.44- Sending sensitive user data to a cloud model because the on-device path was harder.45- Shipping prompt-only tests for model behavior that changes by tool, locale, region, model, or data state.46- Logging prompts, model context, OCR text, tool payloads, or generated sensitive content without a privacy review.4748## Outputs4950- AI feature architecture, provider decision matrix, model integration plan, evaluation suite, privacy/fallback checklist, performance budget, or review findings.5152## Evidence Produced5354| Category | Artifact | Format | Example |55|----------|----------|--------|---------|56| Correctness | AI evaluation plan | Markdown doc covering prompts, providers, tools, unavailable states, and regression cases | `docs/ios/ai-evaluations-checkout.md` |57| Performance | On-device inference budget | Markdown doc covering per-device latency, memory, battery, and thermal budget | `docs/ios/ai-perf-budget.md` |58| Data safety | AI data-flow record | Markdown doc identifying on-device, PCC, third-party, logs, and retention | `docs/ios/ai-data-flow.md` |5960## References6162- `references/apple-intelligence-stack-wwdc26.md` for Foundation Models, Core AI, Evaluations, provider routing, availability gates, and security handoffs.63- `references/skill-deep-dive.md` for Core ML, Vision, NaturalLanguage, Create ML, model updates, optimization, privacy-preserving patterns, and older Apple ML recipes.64<!-- dual-compat-end -->6566## Quick Apple AI Stack Map6768## Inputs6970| Artefact | Produced by | Required? | Why |71|---|---|---|---|72| Use-case and harm definition | Product and security review | required | Bounds model behaviour and prohibited outcomes |73| Representative evaluation set | Domain owner | required | Measures quality on real inputs |74| Device and OS support matrix | `ios-quality-and-release` | required | Selects framework and fallback paths |7576## Decision Rules7778| Constraint | Choice |79|---|---|80| Sensitive input and supported on-device task | On-device framework |81| Unsupported device or unavailable model | Deterministic non-AI fallback |82| Safety-critical or irreversible action | Require human confirmation; AI may only propose |83| Quality cannot be measured on representative data | Stop before release |8485## Capability Contract8687Read and search are required; model downloads, network calls, device execution, and edits require task authority. Never upload private input merely because local inference is unavailable.8889## Domain Anti-Patterns9091- Shipping a demo prompt as an evaluation. Fix: use versioned representative cases and failure thresholds.92- Hiding model unavailability behind a spinner. Fix: expose a deterministic fallback state.93- Letting generated output perform irreversible actions. Fix: validate and confirm structured intent.94- Logging prompts containing personal data. Fix: redact or disable payload logging.95- Claiming support from simulator results alone. Fix: test the declared physical-device matrix.9697| Layer | Use For |98| --- | --- |99| Foundation Models | LLM-backed app features using Apple Foundation Models, PCC, Claude, Gemini, or another Language Model provider. |100| Core AI | Bring-your-own model runtime on Apple Silicon, on-device. |101| Core ML | Packaged or downloaded `.mlmodel` inference, typed wrappers, batch prediction, classic ML. |102| Vision | OCR, barcode, image analysis, camera understanding, and model-callable visual tools. |103| NaturalLanguage | Deterministic language tagging/classification when an LLM is not needed. |104| Speech/SoundAnalysis/Music Understanding | Audio transcription, classification, and local audio understanding. |