View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Videos

Open Menu Close Menu
  • Collections
  • All Videos
  • About

Back to WWDC26

  • About
  • Summary
  • Code
  • What’s new in the Foundation Models framework

    Explore what's new in the Foundation Models framework. Learn how to access Private Cloud Compute, integrate third-party and open source models, and work with vision capabilities. Discover context management APIs, built-in semantic search, and powerful primitives for creating agentic experiences in your apps.

    Chapters

    • 0:00 - Introduction
    • 2:34 - New on-device model
    • 3:21 - Vision: image understanding
    • 4:20 - Private Cloud Compute
    • 6:46 - Model abstraction layer
    • 7:32 - Partner model integrations
    • 9:40 - System tools: Vision and Spotlight
    • 10:57 - Dynamic Profiles for agentic apps
    • 13:46 - Composing models and configurations
    • 15:30 - Evaluations framework
    • 16:02 - The fm command line tool
    • 17:13 - Foundation Models Python SDK
    • 17:55 - Open source and framework utilities
    • 19:24 - Next steps

    Resources

    • Expanding generation with tool calling
    • Analyzing images with multimodal prompting
    • Composing dynamic sessions with instructions and profiles
    • Adding server-side intelligence with Private Cloud Compute
      • HD Video
      • SD Video
  • Search this video…
    • 2:46 - Context size and token counting

      // Context size and token counting
        
        let model = SystemLanguageModel()
        print(model.contextSize)
        // 8192
        
        let count = try await model.tokenCount(for: "What are the Japanese characters for origami?")
        print(count)
    • 3:52 - Attachable image types

      // Insert c// Attachable image types
      
        let response = try await session.respond {
            "What animal is this?"
            Attachment(UIImage(...))
        }ode snippet.
    • 8:45 - Inspecting usage

      // Inspecting usage
        
        let response = try await session.respond(
            to: "Recommend a craft that doesn't require scissors.",
            contextOptions: ContextOptions(reasoningLevel: .light)
        )
      
        print(response.usage.input.totalTokenCount)
        print(response.usage.input.cachedTokenCount)
      
        print(response.usage.output.totalTokenCount)
        print(response.usage.output.reasoningTokenCount)
    • 11:55 - Routing between craft analysis and brainstorm

      // Routing between craft analysis and brainstorm
        
        @Observable
        final class AppStates {
            var mode: Mode
        }
      
        let appStates: AppStates
        var session: LanguageModelSession?
      
        func updateSession() {
            let originalTranscript = session?.transcript.dropFirstInstructions() ?? Transcript()
      
            // Create a new session with new instructions and tools
            switch appStates.mode {
            case .craftAnalysis:
                session = LanguageModelSession(
                    tools: [
                        RecordImageAnalysisTool(),
                        SwitchModeTool(states: appStates)
                    ],
                    instructions: "Analyze the user's craft project...",
                    transcript: originalTranscript
                )
            case .brainstorm:
                session = LanguageModelSession(
                    tools: [
                        RecordBrainstormTool(),
                    ],
                    instructions: "Brainstorm some ideas...",
                    transcript: originalTranscript
                )
            }
        }
        
        struct SwitchModeTool: Tool {
            let description = "Switch to a different mode."
            let states: AppStates
      
            @Generable
            struct Arguments {
                let mode: Mode
            }
      
            func call(arguments: Arguments) async throws -> some PromptRepresentable {
                appStates.mode = arguments.mode
                return "Successfully switched to \(arguments.mode)."
            }
        }
        
        // If mode changes, update the session
        withObservationTracking {
            appStates.mode
        } onChange: {
            updateSession()
        }
    • 12:42 - Describing the profile for craft app

      // Describing the profile for craft app
      
        struct CraftProfile: LanguageModelSession.DynamicProfile {
            var body: some DynamicProfile {
                Profile {
                    Instructions {
                        """
                        You are an expert crafting assistant. \
                        Record craft project image analyses   \
                        using the recordImageAnalysis tool.
                        """
                    }
                    RecordImageAnalysisTool()
                }
            }
        }
      
        let session = LanguageModelSession(
            profile: CraftProfile()
        )
    • 14:36 - Describing the profile for craft app

      // Describing the profile for craft app
        
        struct CraftProfile: LanguageModelSession.DynamicProfile {
            let states: CraftProjectStates
      
            var body: some DynamicProfile {
                switch states.mode {
                case .craftAnalysis:
                    Profile {
                        Instructions { /* ... */ }
                        RecordImageAnalysisTool()
                        SwitchModeTool(states: states)
                    }
                case .brainstorm:
                    Profile {
                        Instructions { /* ... */ }
                        BrainstormRecordTool()
                    }
                    .model(states.privateCloudCompute)
                    .reasoningLevel(.deep)
                }
            }
        }
    • 18:29 - Foundation Models SDK for Python

      # Foundation Models SDK for Python
        
        import apple_fm_sdk as fm
      
        model = fm.SystemLanguageModel()
      
        # Check the model's availability
        is_available, reason = model.is_available()
      
        if is_available:
      
            # Create a session
            session = fm.LanguageModelSession(model=model)
      
            # Generate a response
            response = await session.respond(prompt="Hello!")
            print(response)
    • 0:00 - Introduction
    • Erik Hornberger and Zhen Li introduce this year's Foundation Models release, going open source with a new utilities package, and preview the agenda: model updates, system tools, dynamic profiles, evaluations, and tooling.

    • 2:34 - New on-device model
    • A rebuilt on-device model with better reasoning and tool calling, plus new APIs (from iOS 26.4) for inspecting context size and counting tokens, and refined guardrails that reduce false positives.

    • 3:21 - Vision: image understanding
    • The on-device model gains vision. Add image attachments to a prompt to ask about images, accepting UIImage, NSImage, CGImage, Core Image, CoreVideo pixel buffers, and file URLs at any size, though larger images cost more tokens.

    • 4:20 - Private Cloud Compute
    • Access Apple's server models via PrivateCloudComputeLanguageModel, a 32K context window with reasoning levels, with no account setup, auth, or API keys, fully private, and now available on watchOS 27.

    • 6:46 - Model abstraction layer
    • A new LanguageModel protocol lets local and server models back a LanguageModelSession. Existing models conform already, plus open-source CoreAILanguageModel and MLXLanguageModel for running local models on the Neural Engine and GPU.

    • 7:32 - Partner model integrations
    • Anthropic and Google publish Swift packages for their frontier models. Swap models via Swift Package Manager with everything downstream unchanged, handle auth and billing securely with OAuth and Keychain, and track per-token usage including cache and reasoning tokens.

    • 9:40 - System tools: Vision and Spotlight
    • New built-in tools: BarcodeReaderTool and OCRTool (Vision-backed) for reasoning over visual information, and a Spotlight-powered search tool enabling fully local Retrieval-Augmented Generation (RAG).

    • 10:57 - Dynamic Profiles for agentic apps
    • Dynamic Profiles, a declarative primitive for agentic experiences. Using the Crafts app, a single session swaps instructions and tools between modes (craft analysis vs. brainstorm) by conforming a struct to DynamicProfile.

    • 13:46 - Composing models and configurations
    • Use modifiers to vary the model and reasoning level per profile branch, for example SystemLanguageModel for quick analysis and Private Cloud Compute with deep reasoning for brainstorming, while preserving conversation history. A profile resolves to one active profile at a time.

    • 15:30 - Evaluations framework
    • A new Swift framework to measure the quality of intelligence features, quantifying accuracy as you tweak prompts so you can understand the statistical impact of changes and ship with confidence.

    • 16:02 - The fm command line tool
    • In macOS 27, the models come to the terminal. The fm CLI gives on-device and PCC access for everyday productivity: fm chat for interactive use and piping into shell scripts to summarize, extract, or generate content.

    • 17:13 - Foundation Models Python SDK
    • A Python SDK exposes the same on-device model as the Swift framework, checking availability and generating structured responses in a few lines, for data scientists and researchers in the Python ecosystem.

    • 17:55 - Open source and framework utilities
    • The Foundation Models framework utilities package offers building blocks (transcript management, a skill API, chat-completions interfacing), and the core framework is open-sourced to run wherever Swift runs, including Linux servers.

    • 19:24 - Next steps
    • Download the sample app, get familiar with dynamic profiles and the Evaluations framework, and watch the deep-dive sessions on PCC, evaluations, the Xcode instrument, and dynamic profiles.

Developer Footer

  • Videos
  • WWDC26
  • What’s new in the Foundation Models framework
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines