Create a study guide for Foundation Model Framework

Asked on 06/14/2025

2 searches

Here's a study guide for the Foundation Model Framework based on the content presented at WWDC 2025:

Overview of the Foundation Models Framework

  1. Introduction to the Framework

    • The Foundation Models Framework provides access to an on-device large language model with a Swift API.
    • It is available on macOS, iOS, iPadOS, and VisionOS.
    • The framework is designed to enhance app features like personalized search suggestions and content generation while maintaining user privacy by running entirely on-device.
  2. Key Features

    • Guided Generation: Allows for structured output in Swift using macros like Generable and Guide. This helps in generating instances of specific types and controlling the values of properties.
    • Tool Calling: Enables the model to autonomously execute code defined in your app, allowing for dynamic interaction and data fetching.
    • Stateful Sessions: Supports multi-turn interactions by maintaining session state, allowing for more complex and context-aware conversations.
  3. Performance and Safety

    • The model is optimized with state-of-the-art quantization techniques and speculative decoding for performance efficiency.
    • The framework includes built-in guardrails to ensure safety and prevent inappropriate content generation. Developers can add custom safety rules for specific use cases.

Practical Implementation

  1. Prompt Engineering

    • Start by importing the Foundation Models framework, creating a session, and sending prompts to the model.
    • Use Xcode's Playground to iterate on prompt design and receive live feedback.
  2. Building Applications

    • The framework can be used to build applications that generate itineraries, dialogue for game characters, and more.
    • Example: An app that plans trips by generating itineraries and autonomously selecting points of interest using tool calling.
  3. Code-Along Session

    • A practical session is available to guide developers through building an app using the Foundation Models framework, focusing on prompt engineering, tool calling, and streaming output.

Sessions to Explore

This study guide should provide a comprehensive understanding of the Foundation Models Framework and how to effectively utilize it in your applications.