Dunfey · Hotel WWDC as data, est. 1983
Front desk everything
Years
Topics

2026 AI & Machine Learning

WWDC26 · 24 min · AI & Machine Learning

Integrate on-device AI models into your app using Core AI

Discover a curated collection of popular open-source models — including Qwen, Mistral, SAM3, and more — optimized for Apple silicon using the new Core AI Framework. Learn how to download, run, and benchmark models on your Mac, and integrate them into your app with just a few lines of code. Explore a new workflow for model compilation and on-device specialization to speed up first-time model load. Find out how to profile and optimize runtime performance with Core AI tools in Xcode.

Watch at developer.apple.com ↗

Transcript all transcripts

Chapters

  • 0:00 — Introduction
  • 1:16 — App concept: camera-based vocab learning
  • 2:52 — Model discovery
  • 7:40 — Getting models with the Core AI models repository
  • 8:37 — Integration
  • 10:55 — Writing the Swift integration code
  • 13:05 — Diagnosing model specialization latency
  • 14:40 — Deployment
  • 17:00 — Ahead-of-time (AOT) compilation
  • 18:03 — iOS demo
  • 19:57 — Multiplatform
  • 23:06 — Next steps

Code shown on screen · 4 snippets

Load and run SAM3 image segmentation swift · at 11:01 ↗
import CoreAIImageSegmenter

// Load
let segmenter = try await ImageSegmenter(resourcesAt: sam3ModelURL)

// Use
let response = try await segmenter.segment(image: inputImage, prompt: "flower")
let mask = response.segments.first?.mask
Load a language model and create a session swift · at 11:28 ↗
import FoundationModels
import CoreAILanguageModels

// Create model instance
let model = try await CoreAILanguageModel(resourcesAt: qwen3ModelURL)

// Create session using the model
let session = LanguageModelSession(model: model)

// Generate response
let response = try await session.respond(to: "...")
Generate structured output with @Generable swift · at 12:29 ↗
import FoundationModels
import CoreAILanguageModels

@Generable
struct VocabCard {
    let chineseWord: String
    let englishMeaning: String
    let exampleSentence: String
}

let model = try await CoreAILanguageModel(resourcesAt: modelURL)
let session = LanguageModelSession(model: model)
let response = try await session.respond(
    to: "Create a vocab card for flower",
    generating: VocabCard.self
)
let card: VocabCard = response.content
Compile a Core AI model ahead of time bash · at 17:22 ↗
$ xcrun coreai-build compile MyModel.aimodel --platform iOS

Resources