Apple Foundation Models Isn’t Stupid
7 min read1 like

Part 1 of a four-part series on building RAG for iOS apps.
As someone who has been developing iOS apps for many years, I keep hearing the same question: “Apple Foundation Models? Isn’t the model too small?”
I’ve heard developers describe it as useful for generating text and perhaps classifying data.
However, size isn’t the only thing that counts. Sorry, I had to.
Imagine someone who went to medical school and became an excellent doctor. Would we consider them smart? Of course. But if we asked them to fix our car, would they know what to do? After all, they’re smart, aren’t they?
The world doesn’t work like that. Making a good decision requires relevant knowledge, even when you’re very capable.
The same principle applies when we build features with Apple Foundation Models.
A capable model still needs to know your app
First, a clarification: Apple’s Foundation Models framework is the Swift API we use to work with language models. In this article, I’m focusing on Apple’s on-device language model, available on supported devices with Apple Intelligence. The framework also supports other model providers, but we’ll keep our attention on the on-device case.
The model has learned general patterns and information during training. That doesn’t mean it automatically knows your app’s features, your data model, or the business rules your team agreed on last Tuesday.
This applies to larger models, too. Switching to a more powerful model doesn’t automatically give it access to your product’s internal definitions.
If a request depends on knowledge we haven’t supplied, the model may make an assumption, ask for clarification, or produce something that looks reasonable but means the wrong thing in our app.
Before blaming the model, we should ask: did we give it the information it needed?
What does “critical” mean?
Let’s say we’re building an intelligent search feature for a task-management app. The user types:
Give me all my critical tasks for next month.
We already have the tasks stored in Core Data or SwiftData. We’ve also defined a Swift structure using @Generable, so the model can represent the request as structured filters that our app can validate and execute.
At first glance, it seems we have everything we need.
But does the model know what our app considers a critical task?
Perhaps critical means a task with the highest priority. Perhaps it means a task blocking another team. Perhaps our app has a specific rule that combines several properties.
The word alone doesn’t tell the model which definition we use.
Even if our structure contains a priority field with valid values such as P0, P1, and P2, knowing the available values doesn’t necessarily explain how the user’s language maps to them. @Generable describes the output’s structure; it doesn’t automatically supply every product definition needed to fill it correctly.
Now let’s add a small piece of knowledge to the context:
Each task has a priority and an optional due date.
P0: Urgent tasks that require immediate attention and must take precedence over other work.
P1: Important tasks that should be completed soon.
P2: Routine tasks that can wait.
The due date indicates when the task needs to be completed.
These definitions describe the fields independently of the user’s request. They don’t mention “critical” or “next month.” The model must connect the user’s wording to the meaning of the fields.
Given these definitions, we would expect the following interpretation:
| Part of the request | Meaning in our app |
|---|---|
| “critical tasks” | Tasks with priority P0 |
| “for next month” | Tasks due during the next calendar month |
This table describes our expected interpretation, rather than a captured model response. The model has to infer the connection between “critical” and the description of P0, and interpret “next month” as a constraint on the due date. We still need to test whether it does so reliably.
We also need the current date to resolve “next month.” Our app can supply that fact and calculate the exact date boundaries in code.
Let's try to play with it to see how it works:
The model now has a better basis for interpreting the request. We haven’t changed its training or increased its size. We’ve supplied knowledge that was missing.
Our app remains responsible for validating the generated filters, enforcing access rules, and executing the query.
Relevant knowledge is useful everywhere
That example is small, but adding relevant knowledge to the context is useful in many other situations.
Explaining how the app works
Suppose we’re creating a support assistant that answers questions about our app. A user asks:
Can I share a project with someone who doesn’t have an account?
The answer depends on our product. Does it support guest access? Can guests edit, or only view? Does sharing require a particular subscription?
We can supply documentation explaining those features and limitations. The model then has a source for an answer that reflects our app’s actual behavior.
Understanding how data is structured
The task example is one case of a broader problem: users describe what they want in everyday language, while our app stores data using specific fields and relationships.
In a fictional invoicing app, for example, “overdue” might mean an invoice whose due date has passed and whose outstanding balance is greater than zero. A canceled invoice might be excluded, even if its due date is in the past.
Supplying those definitions helps the model translate the user’s request into the concepts our app uses.
Suggesting something useful
Knowledge can also help a model suggest an action.
Imagine a fitness app where a user asks:
I only have 15 minutes and no equipment. What can I do today?
Our app may have a catalog of routines with descriptions, durations, equipment requirements, and difficulty levels. Providing suitable entries gives the model concrete options to explain and compare.
There are two kinds of information here: reusable knowledge about the routines, and current facts about the user’s request. Both contribute to a useful answer.
Adding domain material can improve relevance, but it doesn’t guarantee correctness. The quality of the sources and how the model uses them still matter.
What happens when the knowledge grows?
So far, we’ve manually chosen a few sentences and added them to the context. That’s a perfectly reasonable place to start.
But imagine our task app grows. We now have documentation about priorities, recurring tasks, shared projects, permissions, reminders, subscriptions, and dozens of other features.
We could try to include all of it in every request. Eventually, however, the material may exceed the model’s context window. Even before that happens, unrelated information adds processing work and can make the relevant details harder to use.
A request about critical tasks probably doesn’t need our entire guide to subscription billing.
We need a way to select the knowledge that matters for the current request.
This is where RAG comes in
RAG stands for Retrieval-Augmented Generation. The name describes the idea: retrieve relevant information, add it to the model’s context, and use that context when generating a response.
For our task app, the flow might look like this:
- The user asks for critical tasks due next month.
- Our retrieval system finds the relevant task definitions.
- We add those definitions to the context alongside the request and necessary app facts.
- The model generates structured filters for our app to validate and execute.
Retrieval can use keyword search, semantic search, or a combination of techniques. We’ll explore those choices in the next articles.
The distinction is that adding a fixed paragraph to every prompt is context enrichment. RAG introduces a retrieval step that selects information from a collection for the request at hand.
And the result doesn’t have to be a chat response. In our example, generation produces a structured query. In another feature, it might produce an explanation or a recommendation.
RAG doesn’t retrain the model. It supplies selected knowledge when the model needs it.
Building our first RAG pipeline
Giving the model relevant knowledge is a simple idea. Consistently finding the right knowledge takes more work.
How should we organize our documents? How do we search them? What happens when the user uses different words from the documentation? And how do we know the retrieved information actually improves the result?
In the next article, we’ll build a small RAG pipeline in Swift: prepare a collection of knowledge documents, create keyword and semantic indexes, retrieve relevant passages, and supply them to Apple’s on-device model.
For now, the next time the model misunderstands your app, inspect the context alongside the output. The definition that seems obvious to your team may never have been supplied to the model.
Comments