Core ML: Apple's On-Device AI Framework
Core ML is Apple's machine learning framework that enables developers to integrate trained models into iOS, macOS, watchOS, and tvOS applications with optimized performance on Apple hardware.
Hardware Optimized
Automatically leverages Neural Engine, GPU, and CPU for optimal performance
Privacy First
All processing happens on-device—no data leaves the user's device
Power Efficient
Optimized for mobile devices with minimal battery impact
What is Core ML?
Core ML is Apple's foundational machine learning framework, first introduced in iOS 11 (2017). It provides a unified interface for running machine learning models on Apple devices, abstracting away the complexity of hardware-specific optimizations while delivering exceptional performance.
Core ML supports a wide variety of model types including neural networks, tree ensembles, support vector machines, and linear models. The framework handles all aspects of model execution including memory management, batch processing, and hardware acceleration.
How Core ML Powers Lumia Studio
Lumia Studio uses Core ML to run FastVLM, Apple's state-of-the-art vision-language model, directly on your iPhone. This enables:
- •Real-time image understanding — Process photos in milliseconds
- •Private search — Your photos never leave your device
- •Offline capability — Works without internet connection
- •Battery efficiency — Optimized inference with minimal power draw
The Apple Neural Engine (ANE)
Core ML automatically leverages the Apple Neural Engine (ANE), a dedicated hardware accelerator built into Apple Silicon chips. The ANE is specifically designed for machine learning workloads and can perform up to 15.8 trillion operations per second on the latest chips.
Neural Engine Performance by Device
| Chip | Neural Engine | Performance |
|---|---|---|
| A17 Pro | 6th Gen, 16-core | 35 TOPS |
| A16 Bionic | 5th Gen, 16-core | 17 TOPS |
| A15 Bionic | 4th Gen, 16-core | 15.8 TOPS |
| M3 Pro/Max | 16-core | 18 TOPS |
| M4 | 16-core | 38 TOPS |
TOPS = Trillion Operations Per Second
Core ML Model Formats
Core ML uses two primary model formats:
- •.mlmodel — The original Core ML format, containing the model architecture and weights in a single file
- •.mlpackage — The newer format introduced in iOS 15, which stores models as a directory bundle with improved organization and support for larger models
Converting Models to Core ML
Apple provides coremltools, a Python package for converting models from popular frameworks to Core ML format:
import coremltools as ct
# Convert from PyTorch
model = ct.convert(
torch_model,
inputs=[ct.TensorType(shape=(1, 3, 224, 224))],
compute_units=ct.ComputeUnit.ALL
)
# Save as mlpackage
model.save("MyModel.mlpackage")The compute_units parameter allows you to specify which hardware the model should run on: ALL (automatic), CPU_ONLY, CPU_AND_GPU, or CPU_AND_NE (CPU and Neural Engine).
Core ML Optimizations
Core ML supports several optimization techniques to improve model performance:
Quantization
Reducing model precision from 32-bit floating point to 16-bit or even 8-bit integers. This can reduce model size by 2-4x while maintaining accuracy.
Palettization
Compressing weights using a lookup table of unique values. Particularly effective for models with repetitive weight patterns.
Pruning
Removing unnecessary weights that don't significantly contribute to model output, reducing computation requirements.
Integration with Other Frameworks
Core ML works seamlessly with other Apple frameworks:
- •Vision — High-level computer vision APIs that can use Core ML models
- •Natural Language — Text processing and analysis
- •Speech — Speech recognition and synthesis
- •Sound Analysis — Audio classification and analysis
- •MLX — Apple's research framework for model training
Why Core ML for Vision-Language Models?
Running vision-language models like FastVLM on-device presents unique challenges:
- •Large model sizes — VLMs can be several gigabytes
- •Complex architectures — Multiple encoders and attention mechanisms
- •Real-time requirements — Users expect instant responses
Core ML addresses these challenges through efficient memory management, hardware-aware optimization, and support for advanced model compression techniques. This is what enables Lumia Studio to run sophisticated AI search on your entire photo library without compromising privacy or battery life.
Getting Started with Core ML
If you're a developer interested in adding machine learning to your iOS apps, here are the essential resources:
Official Resources
Related Technologies
Experience Core ML in Action
Lumia Studio brings the power of Core ML and FastVLM to your photo library. Search your memories using natural language, all processed privately on your device.
Join the Waitlist