← All courses ← Course home

Lesson 03 of 05

When to use Core AI

Core AI is Apple's current tool for running your own neural model on the device. You need iOS 27 or later, or macOS 27 or later, and Xcode 27.

Agent brief (llms.md)

Core AI is a Swift API for on-device inference on Apple silicon. You load a model in the app. The model runs on the device. There is no server step and no token bill for that run.

File.aimodel
APICore AI in Swift

The portable file is a .aimodel. Apple also publishes Core AI assets and recipes in apple/coreai-models. If you train in PyTorch, you convert with the Core AI PyTorch tools, often called coreai-torch. PyTorch to Core AI in Xcode shows that conversion with a clothing classifier.

TrainPyTorch model
Convertcoreai-torch
File.aimodel

OS and Xcode limits

The official coreai-models repository lists macOS 27 or later, iOS 27 or later, and Xcode 27 or later. If the app must support an older OS, use Core ML instead. Do not plan a Core AI ship date on iOS 26.

File.aimodel
AppSwift Core AI API
OSiOS or macOS 27+
import CoreAI

let modelURL = Bundle.main.url(
    forResource: "clothing",
    withExtension: "aimodel"
)!

let model = try await AIModel(contentsOf: modelURL)
let function = try model.loadFunction(named: "main")

That load path matches the clothing course. Exact method names can change in the Xcode 27 SDK. Check the installed Core AI docs before you copy a name.

What Core AI is for

Use Core AI when you bring your own neural network, including transformer and other generative work. Apple says Core AI is the inference framework behind on-device Apple Intelligence, and that developers can now use it for their own models. See developer.apple.com/core-ai.

Foundation Models is still a different product. It gives your app Apple's system language model through a Swift API. Core AI is the product you use when the weights are yours, or they come from a recipe you exported.

Core AI models, typed explains the official preset list. Model architectures in plain English explains language and image shapes before you pick a file.

Rule. Ship a custom neural or generative model on 27 or later with Core AI. Keep Core ML for classic ML and older OS targets.

Next, look at MLX, the Mac training and research tool.

Key concepts

  • Core AI is Apple's Swift API for on-device inference of your own model on Apple silicon.
  • The portable file is .aimodel. PyTorch export uses coreai-torch.
  • It needs macOS 27 or later, iOS 27 or later, and Xcode 27.
  • Use it for your own neural network, including transformer and generative work.
  • Foundation Models is a different API. It does not load your weights.

Takeaways

  • You can describe .aimodel to the Swift Core AI API on OS 27 or later.
  • You can sketch AIModel and loadFunction(named: "main") and check names in your Xcode 27 docs.
  • You will not plan a Core AI ship on iOS 26.