Foundation Models are broken in iOS 27 Beta

Hi guys,

I'm testing the Foundation Models Framework with the on-device model in iOS 27 (beta 4) and macOS 27 (beta 4) and is completely failing to respond.

There are many errors. For starters, the model doesn't respond to prompts directly, you need to specify instructions, otherwise it refuses to provide an answer. It is always looking for tools, even when no tool has been provided, and returns an error saying that it couldn't find the tool. Then, when it produces a response, it shows all the thinking process first, which completely ruins the response. Most of the time, the response begins with all the JSON code. And when I try to have a long conversation, it just says "I cannot write content or generate text."

I wonder if someone is experiencing the same issues or maybe the way to implement this model changed and I'm missing something?

Here is a screenshot of one of my interactions when I asked the model to describe a unicorn. It tried to access a tool that doesn't exist. (the app just prints the value of the content property)

Here is the code. It is performing a simple request.

struct ContentView: View {
   @State private var response = ""

   var body: some View {
      VStack {
         Button("Send") {
            let prompt = "Write a paragraph describing a unicorn"
            let session = LanguageModelSession {
               "Respond to the user's request. Never acknowledge the request, add preamble, or comment on what you are about to write."
            }
            if !session.isResponding {
               Task {
                  do {
                     let answer = try await session.respond(to: prompt)
                     response = answer.content
                  } catch {
                     response = "Error accessing the model: \(error)"
                  }
               }
            }
         }
         .buttonStyle(.borderedProminent)

         Text(response)
            .font(Font.system(size: 18))
            .padding()
         Spacer()
      }
      .padding()
   }
}

Thank you for the post and the screenshot. Pretty interesting and hope many engineers comment to your post, but we don't see the code you are using.

I understand that you are utilizing Playgrounds or the macOS app was named that when you mentioned to test the Foundation models. Could you please clarify if you are using the beta 4 version for both macOS and iOS, as well as the latest Xcode 27?

I do not see you code at all on the post, any chance you can produce the simple focused project I can download and run?

What do you get on a simple call like this?

let session = LanguageModelSession(instructions: "You are a helpful assistant. Respond directly and conversationally")
let response = try await session.respond(to: "Describe a unicorn")

Or the sample on the documentation https://developer.apple.com/documentation/foundationmodels/languagemodelsession

I’m sure many developers and engineers here will like to take a look at your focused sample project and see the issue if any. Please provide a link to download the project.

Albert  WWDR

I just added the code to the conversation. It is just performing a simple request, but I had to use instructions because otherwise the model was refusing to respond.

@macrojd

Do you get the same results with just the relevant code in a small test project? If so, please share a link to your test project. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project.

Albert  WWDR

Foundation Models are broken in iOS 27 Beta
 
 
Q