How do I prompt Apple Foundation Model? What are the limitations?

Asked on 2025-06-25

1 search

To prompt the Apple Foundation Model, you can use the Foundation Models Framework, which allows you to interact with the model using just a few lines of code. Here's a basic outline of how to prompt the model:

  1. Import the Framework: Start by importing the Foundation Models framework into your project.
  2. Create a Session: Initialize a session with the model. This session is stateful, meaning it can maintain context across multiple interactions.
  3. Send a Prompt: Use the session to send your prompt to the model. You can write prompts in any language supported by Apple Intelligence.

For example, you can use Xcode's Playground feature to experiment with different prompts and see the model's responses in real-time. This is a great way to refine your prompts and find what works best for your app.

Limitations

  1. Safety and Guardrails: The Foundation Models framework includes built-in guardrails to block harmful inputs and outputs. However, developers are still responsible for ensuring their app does not generate inappropriate content. You should carefully design prompts and handle user inputs to maintain safety.

  2. Model Knowledge: The model's knowledge is based on the data it was trained on, which is fixed in time. It may not be as knowledgeable as larger server-scale models and might not contain recent events.

  3. Structured Output: While the model can generate structured responses, it can be challenging to maintain and parse these outputs reliably. The framework offers features like guided generation to help with this.

  4. Privacy and Offline Use: The model runs on-device, ensuring user data privacy and allowing it to work offline. However, this also means it might not have access to live data unless you use tool calling to fetch external information.

For more detailed guidance on prompt design and safety, you can refer to the session Explore prompt design & safety for on-device foundation models (11:03).