tell me about foundation models

Asked on 06/18/2025

1 search

The Foundation Models framework, introduced at WWDC 2025, provides access to an on-device large language model through a convenient Swift API. This framework is available on macOS, iOS, iPadOS, and VisionOS, and it allows developers to enhance existing app features or create new ones, such as personalized search suggestions or generating dialogue for game characters. The model runs entirely on-device, ensuring privacy and offline functionality without increasing app size.

Key features of the Foundation Models framework include:

  • Stateful Sessions: The framework is built around stateful sessions, allowing developers to provide custom instructions to guide the model's responses. This helps protect against prompt injection attacks by prioritizing developer-provided instructions over user prompts.

  • Guided Generation: This feature allows the model to produce structured output, such as JSON or CSV, which is easier to integrate into app views. It uses macros like Generable and Guide to describe types and control generated values.

  • Tool Calling: The model can autonomously execute code defined in your app, allowing it to perform tasks like fetching up-to-date content or taking actions based on user input.

  • Privacy and Safety: The framework includes guardrails to block harmful inputs and outputs, ensuring a safe app experience. Developers are encouraged to consider potential misuse and design their apps to handle user input carefully.

For more detailed information, you can explore sessions like Meet the Foundation Models framework and Deep dive into the Foundation Models framework.