# Apple Core ML Apple's machine learning framework for on-device inference across iOS, iPadOS, macOS, watchOS, and visionOS. Provides a unified API for running models that's hardware-agnostic — the framework decides at runtime whether to execute on the [[Apple Neural Engine]], GPU, or CPU. Documentation: https://developer.apple.com/documentation/coreml ## What It Does - Loads `.mlpackage` / `.mlmodel` files - Compiles models for the target device - Schedules execution across ANE, GPU, and CPU - Provides Swift/Objective-C APIs for inference - Manages memory, batching, and async execution ## Model Sources | Source | How | |---|---| | Apple Core ML Tools | Python lib to convert from PyTorch / TensorFlow / [[ONNX]] | | Hugging Face | Many models distributed pre-converted | | Create ML | Apple's no-code training tool, exports Core ML directly | ## Supported Model Types - Vision: classification, object detection, segmentation - NLP: tokenization, classification, embeddings - Speech: ASR, TTS - Generative: image generation (Stable Diffusion variants), LLMs (since iOS 18 / macOS 15) - Custom: any neural network expressible in the Core ML opset ## Optimization Core ML's optimization toolkit supports: - Palettization (vector quantization) - Pruning - 4-bit and 8-bit [[AI Quantization]] - Stateful models for transformer KV cache These let multi-billion-parameter LLMs run on consumer Apple devices. ## Relationship to Apple Intelligence [[Apple Intelligence]]'s on-device foundation model runs through Core ML. Apple's optimization investments in 2023-2024 (especially around stateful KV cache) were precursors to Apple Intelligence's launch. ## Relationship to Web Standards If Safari implements [[WebNN API]], Core ML is the most likely backing engine — meaning web ML on Apple devices would automatically benefit from ANE acceleration. [[ONNX Runtime Web]] also has a Core ML execution provider for native Apple platforms. ## References - https://developer.apple.com/documentation/coreml - https://github.com/apple/coremltools ## Related - [[Apple Neural Engine]] - [[Apple Intelligence]] - [[Neural Processing Unit (NPU)]] - [[On-Device Machine Learning]] - [[Edge AI]] - [[ONNX]] - [[ONNX Runtime Web]] - [[WebNN API]] - [[AI Inference]] - [[AI Quantization]]