Posts under Machine Learning & AI topic

Post

Replies

Boosts

Views

Activity

Notes from shipping Core AI image and music generation in an App Store app
I have an app on the App Store that uses Core AI for image generation and music generation on iPhone. I want to share what worked, because there was very little written about this when I started and some of it took a long time to find. The app supports iOS 17.6 and later. The Core AI features are available on iOS 27, and the rest of the app runs unchanged on older systems. It uses three Core AI models, which are FLUX.2 Klein for images, Stable Audio Open Small for short clips, and Stable Audio 3 Small for full-length music. FLUX.2 Klein The app runs FLUX.2 Klein through FlowTransformerPipeline from the coreai-models package, for both text to image and image editing. These are the things I learned from it. Ship the compiled bundle and name every compiled file in metadata.json. The pipeline now reads asset filenames only from metadata.json. An earlier version looked for fixed .aimodel filenames and reported that the Transformer component was missing for every compiled bundle. I reported that in coreai-models issue 355, and the fix was merged in pull request 357. Offer image editing as a separate download. Text to image does not need the VAE encoder or the image-to-image transformer, so the app downloads those only when the user adds image editing. If you leave files out this way, you must also remove their keys from metadata.json, because a file that is declared but missing now throws an error. Create a new pipeline after the files on disk change. The pipeline decides at initialization whether image editing is available. A pipeline created before the editing files were downloaded kept running text to image, and it did so without any error. Use the predicted clean image for live previews. With a four-step model, the noisy latent after each step does not look like anything a user can recognize. The predicted x0 does, and it makes the preview useful from the first step. I suggested this in coreai-models issue 231, and the package now supports previews through an optional progress handler that costs nothing when it is not used. Loading is fast. The compiled FLUX.2 Klein bundle loads almost immediately on the phone, with none of the long first-run compile that I saw with text models on the Neural Engine. Stable Audio Compile ahead of time for any large model. Loading the Stable Audio 3 source bundle on an iPhone 17 Pro ran for more than five minutes before I stopped it. The same model compiled on the Mac with coreai-build loads in seconds on the phone. The first load after download took about 15 seconds, and later loads were close to instant. Remove the functions you do not call before you compile. The Stable Audio 3 Small bundle has encoder functions and several decoder sizes that my app never uses. I removed those entry points with the coreai-torch package and left the helper graphs alone. The source went from 2.9 GB to 2.5 GB, the compiled bundle went from 7.0 GB to 4.8 GB, and the compile time on the Mac went from 9 minutes 18 seconds to 59 seconds. Memory was not the limit I expected for audio. A two-minute song peaked at about 2 GB on an iPhone 17 Pro, which leaves a good margin under what iOS allows one app. Small models can be compiled on the device. Stable Audio Open Small is about 1 GB and its bundles compiled on the phone in about 3 seconds. It then produced 11.9 seconds of audio in 9.2 seconds. Text models Text models are the part I have not been able to ship on Core AI, and the work is still open with Apple. I exported Qwen3 0.6B and SmolLM2 1.7B for iOS and compiled both ahead of time for the Neural Engine. Each compiled bundle still contains 30 Neural Engine regions that the system finishes compiling on the device at first load. Apple has confirmed that this step on the device is expected, and that coreai-build does not produce the final Neural Engine executables. That step is where the trouble is. On an iPhone 17 Pro, the first load of Qwen3 0.6B took more than two minutes, and later loads took about eight seconds. SmolLM2 1.7B never finished. The compiler tried to reserve a temporary file of 33.6 to 35.5 GB, ran out of storage, and the app was then terminated by an assertion. The app receives no error, so it cannot fall back to another model or tell the user what happened. I repeated the test on a Mac with the current toolchain, and the storage use is the same there. The first load used a peak of 17 GB of temporary disk space for the 0.6B model and 42 GB for the 1.7B model. The Mac has the room, so both models work, and they are fast once cached. Loads took about 0.05 seconds, with 196 tokens per second for the 0.6B model and 63 for the 1.7B model. Apple has reproduced the disk usage and is investigating it. The details are in coreai-models issue 387 and in my earlier thread at https://developer.apple.com/forums/thread/855499. Until that is resolved I have removed both models from the app, and local text models run on MLX and llama.cpp instead. I would like to hear from anyone who has a text model larger than 1B parameters loading on an iPhone through Core AI. Supporting older systems Weak link the framework if you support systems before iOS 27. My app crashed at launch on iOS 26 until I added -weak_framework CoreAI and -weak_framework FoundationModels to the linker flags. Availability checks in my own code were not enough, because the prebuilt coreai-models libraries imported those frameworks strongly. The simulator SDK has no CoreAI.framework, so the weak link flag for CoreAI has to be limited to device builds and all testing happens on a device. A few things I published may save others some time. The recipe I use to build coreai-models as xcframeworks is at https://github.com/james-333i/coreai-models-xcframework. The compiled FLUX.2 Klein bundle for iPhone is at https://huggingface.co/333i/flux2-klein-coreai-ios, and the trimmed Stable Audio 3 Small bundle is at https://huggingface.co/333i/stable-audio-3-small-music-coreai-ios. The app is Infinity Vaults, if anyone wants to see these models running in a shipping product. I am glad to answer questions about any of the steps above.
0
0
134
16h
TrustInsights: requestEvaluation(context:) throws contextInvalid("Model version current is unsupported.") for IsLikelyBeingCoachedInsight.
InsightEvaluator.requestEvaluation(context:) always throws InsightEvaluator.EvaluationError.contextInvalid with the message: "Model version current is unsupported." The request asks for IsLikelyBeingCoachedInsight with schema: .version1 and modelVersion: .current, the default. authorizationStatus(for:) returns .authorized for the same context before the call. .current is the default and only non-specific ModelVersion, so the app can't do anything to fix the request. We can't find any documentation on which model versions a device supports, or why .current would be rejected. Environment Device: iPhone 16e iOS: 27.2.1 Region: Japan Xcode 27.2 (27B52), iOS 27.2 SDK, macOS 26.6.2 Steps to reproduce Install the app on the device above and grant Trust Insights authorization. Run: let evaluator = InsightEvaluator() var context = InsightEvaluator.InsightContext( operationCategory: .payment, // also reproduces with .account requestedEvaluations: IsLikelyBeingCoachedInsight.request(schema: .version1, modelVersion: .current) ) context.requestID = UUID().uuidString let status = try await evaluator.authorizationStatus(for: context) // .authorized let evaluation = try await evaluator.requestEvaluation(context: context) // throwsExpected: An InsightEvaluation whose insight.outcome is a value (.unknown/.medium/.high) or an InsightError, such as insightVersionUnavailable, if no model is available. Actual: The call throws EvaluationError.contextInvalid("Model version current is unsupported."). It reproduces every time. Questions Is this expected? For example, is no model deployed yet for this device model, region or OS build? If so, is there a list of supported devices and regions? If this means "no model available", should it come back as InsightError.insightVersionUnavailable in the insight outcome rather than as contextInvalid? contextInvalid suggests our request is malformed.
1
0
428
17h
Siri AI on iOS 27.3 beta 2 cannot chain tool calls of App Intents that provide a dialog
I have been very excited to dive into making my AppIntents available as tools to Siri AI on iOS 27.3. It's great that it is now opened app to all third party developers, not just select schema-supported apps. It has been working really well for me until I ran into a use-case where I need two calls to be called in order to fulfill the request. My use case: I have a time tracking app, and I have two App Intents: one for getting active timers, and a second one to edit an event. The Get Active Timers App Intent both provides a dialog and returns a value. The returned value includes an 'event' property that can be passed as a parameter to the Edit Event App Intent. I verified that this works well in the Shortcuts app. When I try to ask Siri to update the current event's timer and set its event name to something, it just responds with the dialog of my Get Active Timers app intent. Upon deeper investigation of the logs with Claude, I found out that the core of the issue is that when the planner finds a tool (app intent) that provides a dialog, it only runs this one tool and returns the dialog. That's why I only get the response dialog from my Get Active Timers app intent and nothing else happens. As soon as I tried temporarily removing the ProvidesDialog from my perform function, it works. The planner finds both of my tools, passes the value between them, and the second tool correctly updates the event name of my running timer. This forum post was written entirely by hand. I am also attaching a more detailed explanation of the issue along with specific device logs from Siri that explain the issue in much more detail. That document is generated by Claude. I'd love to know if this is a deliberate limitation, and if it is, if you could consider making it possible for tools to be chained even when they provide a dialog in their single-call use case. This is especially important because the same App Intents are used in both the Shortcuts app and in Siri AI. Thank you.
2
2
440
20h
Support new Siri AI APIs while keeping backwards compatibility
We are modernizing out in Intents and Entities to be ready for SiriAI. We would like to add more metdata (description & visibility) to our @Property annotations and use @ComputedProberty and DeferredProperty in some cases. But all of these APIs are only available on iOS 27 or even 27.x. How would one use modern APIs to provide Siri AI with rich data while keeping backwards compatibility to iOS 17/18
7
0
1.3k
4d
Request for a Fee Waiver for a Free Quran App – Tadabbur Quran
Hello Apple Developer Community, I am an independent developer building an application called Tadabbur Quran. This project is a sincere charitable effort to serve people and make Quranic knowledge accessible to everyone around the world. The app provides Quran reading, translations, recitations, prayers, and educational resources. It is intended to remain completely free. I do not seek to earn money from this project. Unfortunately, I cannot afford the annual Apple Developer Program membership fee. I respectfully ask whether Apple offers any special assistance, fee waiver, sponsorship, or alternative way for an independent developer to publish a completely free educational and religious app on the App Store. My intention is simply to serve people and seek the pleasure of God. Thank you for your time and understanding. Kind regards, Tadabbur Quran Project Developer
0
0
321
5d
Qwen3.8-27B GGUF crashes on Apple M5 Max — LM Studio settings that work
Hardware Apple MacBook Pro 16" Chip: Apple M5 Max Memory: 48 GB Unified Memory Storage: 2 TB SSD OS: macOS (Apple Silicon) Software LM Studio 0.4.29 Model: Qwen3.8-27B (GGUF Q4_K_M) Problem
Qwen3.8-27B (GGUF Q4_K_M) answers the first message, then crashes on the second with an error: Error messages observed: - Engine protocol predict stream returned an error: {"code":500,"message":"Compute error.","type":"server_error"} - Engine protocol predict stream returned an error: {"code":500,"message":"got exception: Unexpected empty grammar stack after accepting piece: @ (31)","type":"server_error"} - Prediction request aborted but the prediction loop handler of the plugin lmstudio/default-prediction-loop-handler did not abort in time. - Cannot send on a terminated channel. Fix — LM Studio settings that worked
On Apple M5 Max + 48 GB RAM, the following combination resolves the crash: Hardware → GPUs: 1 GPU detected with Metal — Apple M5 Max (VRAM Capacity: 37.44 GB • Metal • deviceId: 0). Toggle OFF (do not use GPU for inference). Max Concurrent Predictions: set to 1 (default is 4). Unified KV Cache: OFF. Offload KV Cache to GPU Memory: OFF. Flash Attention: OFF. Model format: use GGUF Q4_K_M quantized versions only (e.g., Qwen3.8-27B Q4_K_M or Gemma 4 31B QAT Q4_K_M). Do not use MLX or unquantized models. Result
After applying all these settings, multi-turn chat works without errors. Gemma 4 31B QAT (GGUF Q4_K_M) also runs stably on the same hardware. This should help other users with M-series Macs and 48 GB Unified Memory avoid the same crash. https://github.com/lmstudio-ai/lmstudio-bug-tracker/issues/2659
1
0
72
6d
Qwen3.8-27B GGUF crashes on Apple M5 Max — LM Studio settings that work
App: LM Studio / llama.cpp (Metal) Device: Apple MacBook Pro 16", Chip: Apple M5 Max, Memory: 48 GB Unified Memory, Storage: 2 TB SSD, OS: macOS (Apple Silicon) Software: LM Studio 0.4.29, Model: Qwen3.8-27B (GGUF Q4_K_M) Issue: Qwen3.8-27B (GGUF Q4_K_M) answers the first message, then crashes on the second with an error: - Engine protocol predict stream returned an error: {"code":500,"message":"Compute error.","type":"server_error"} - Engine protocol predict stream returned an error: {"code":500,"message":"got exception: Unexpected empty grammar stack after accepting piece: @ (31)","type":"server_error"} - Prediction request aborted but the prediction loop handler of the plugin lmstudio/default-prediction-loop-handler did not abort in time. - Cannot send on a terminated channel. Fix — LM Studio settings that worked
On Apple M5 Max + 48 GB RAM, the following combination resolves the crash: Hardware → GPUs: 1 GPU detected with Metal — Apple M5 Max (VRAM Capacity: 37.44 GB • Metal • deviceId: 0). Toggle OFF (do not use GPU for inference). Max Concurrent Predictions: set to 1 (default is 4). Unified KV Cache: OFF. Offload KV Cache to GPU Memory: OFF. Flash Attention: OFF. Model format: use GGUF Q4_K_M quantized versions only (e.g., Qwen3.8-27B Q4_K_M or Gemma 4 31B QAT Q4_K_M). Do not use MLX or unquantized models. Result
After applying all these settings, multi-turn chat works without errors. Gemma 4 31B QAT (GGUF Q4_K_M) also runs stably on the same hardware. This should help other users with M-series Macs and 48 GB Unified Memory avoid the same crash.
0
0
70
6d
tvOS: Can Siri pass voice commands into my app for blind users?
Hi everyone, I'm building a media app for tvOS designed for blind users, so they can play songs just by giving a voice command. Currently, users can launch the app by voice. Inside the app, I've added a mic button that lets them navigate to a player or any tab by speaking. However, this isn't very practical for a blind user, since they first have to find and select that button. I'd like to know if either of the following is possible: Direct commands through Siri: Once my app is open, can the user press the Siri button on the remote and say something like "Play [song name]", and have my app handle it and play the content? Passing the spoken text to my app: If not, can the user press the Siri button, speak a command, and have the transcribed text delivered to my app's voice navigation text field, so my app can process it? If neither is supported, what is the recommended way to provide a hands-free or low-effort voice experience for blind users on tvOS? Any guidance, relevant APIs or sample code would be greatly appreciated. Thank you!
0
0
140
1w
How to stop Codex from accessing Root Access
I am new to developing apps, so please forgive me if this seems mundane or simple to you, but I have been using Codex inside Xcode, and even after setting extremely stringent permissions to protect my private life, Codex keeps overwritng them to gain root access. I have used the Terminal and found evidence that Codex has been attempting to access 'no acess' folders outside of the sandbox, even my browsers. I could paste all of my findings in here, but it's all extremely long, and I doubt that people will have time to read it anyway :) I have even gone into the config.toml file, but that does not stop Codex from routing through my files. Does anyone know how to restrict Codex so that it stays within its set boundaries for read & write, read only and no access? I do not accept that any AI model should acess my files, especially after I have set permissisons, but it overwrites them. Do I need to swicth agents or does Clause also gain access to the root? Thanks in advance.
4
0
785
1w
Adding MCP and connector support to your own Foundation Models apps
Circling back on the LocalLM Lab arc. With v0.7, we've moved from prompt experimentation into real app development on Apple's Foundation Models local AI. The LocalLM Lab SDK lets you build that same on-device model and MCP client this thread has covered directly into your own app, with real tool and data access (Slack, Todoist, GitHub, Notion, Linear, plus Calendar, Reminders, Contacts and Location). And you can ship your app including through the Mac App Store. This is a big improvement over version 0.6, where the localai-cli toolkit needed LocalLM Lab installed and running. On the other hand, the SDK (LocalLMLabSDKCore) doesn't relay through anything; it links FoundationModels and a real MCP client directly into your own binary and is totally self-contained. The example included in the SDK, Plate Today, has actually been built into a sandboxed test app and verified working, with a signed path to a Mac App Store .pkg (Apple Distribution signing + provisioning profile pipeline). That's "verified signable and sandbox-compatible," to be precise. Entitlements (from personal experience: always a complicated topic): com.apple.security.app-sandbox + com.apple.security.network.client for the app itself, plus the standard personal-information entitlements per connector used (com.apple.security.personal-information.calendars, .addressbook, .location) and matching NS*UsageDescription strings in Info.plist. The one worth flagging specifically: the network entitlement is easy to miss and fails silently rather than throwing. Without it, MCP connections and Weather calls just hang with no error surfaced. OAuth handling requires the app delegate callback (application(_:open:)), not SwiftUI's .onOpenURL. Worth knowing before wiring it up if you're SwiftUI-only. Full entitlements list + SDK guide: https://github.com/ancientcomputing/locallm/blob/main/docs/sdk-guide.md Feature page: thisbrain.ai/locallm/sdk.html I hope the availability of the SDK (free, Apache 2.0 license) will give folks further incentive to explore local AI-enabled applications on the Mac. What else would you want to do that the SDK doesn't currently support? File picker? Calendar/Reminders/Contacts edits & writes?
9
1
5.3k
1w
On-device model refuses to classify harmless grief-related text (LanguageModelError.refusal), but will summarize it
Hi, A harmless sentence about a grief support group makes the on-device model throw LanguageModelError.refusal when it's asked to classify it. In the same session, the same sentence is summarized without complaint, and the same sentence with "grief" swapped for something neutral classifies fine. Environment: Mac mini M5 Pro, macOS 27.2.1 (26B131), Xcode 27.2 (27B52), AFM 3 Core Advanced. Also reproduced on iOS 27.2 and visionOS 27.2 simulators. Minimal repro (run as written, twice, same result): @Generable enum SafetyLabel: String { case safe, sensitive, concerning, unsafe } let text = "Our support group meets on Thursdays to talk about coping with grief." // Throws LanguageModelError.refusal ("May contain sensitive content") let classifier = LanguageModelSession(instructions: "Classify the text by content safety.") _ = try await classifier.respond(to: text, generating: SafetyLabel.self) // Works: "Support group meets Thursdays for grief coping." let summarizer = LanguageModelSession() _ = try await summarizer.respond(to: "Summarize in five words: \(text)")Results, same session: "…coping with grief." → classify (@Generable enum): refusal; summarize (plain text): works "Our book club meets on Thursdays to talk about mystery novels." → classify: safe; summarize: works Same result with SystemLanguageModel(guardrails: .permissiveContentTransformations). It's refusal, not guardrailViolation. In a fuller classifier (four classifiers with calibrated label descriptions) it was also refused under greedy and default sampling, with a purpose line in the instructions, and with SystemLanguageModel(useCase: .contentTagging). A second case, likely the same trigger: the Little Women review in Apple's own Book Tracker sample (Using Evaluations to evaluate an intelligent feature). It recounts Beth's death, and tagging it with the sample's instructions, .permissiveContentTransformations guardrails and a @Generable tag array throws LanguageModelError.refusal on both .general and .contentTagging, in well under a second, on two Macs (M3 Max and M5 Pro). The other 12 reviews in the sample tag fine. I haven't tested whether the two share a trigger. So grief or death in otherwise harmless text seems enough for the model to refuse structured classification and tagging, the kinds of tasks the content-tagging use case is for. Questions: Is this expected? It reads like a false positive: nothing in the text is harmful, and the model will summarize it. Is there a supported way for an app to classify or tag text like this on device, for example for a support or journaling app where grief is a normal topic?
3
0
563
1w
macOS 27.2.1: Foundation Models stuck at modelNotReady and PCC requests hang (com.apple.modelcatalog asset set never activated
On an M5 Max running macOS 27.2.1 (26B131), the on-device Foundation Models has reported modelNotReady since I upgraded from 26.7.2 to 27.2 on Oct 27. Private Cloud Compute requests also hang with no error. fm models prints ✗ system (modelNotReady). fm respond --model pcc 'hello' in Terminal.app never returns. modelmanagerd opens the PCC session, but the on-device safety session it also opens (instruct_300m.safety) fails with UAF Code=5000 "no underlying assets", so no request is ever sent. /System/Library/AssetsV2/locks/com.apple.UnifiedAssetFramework/com.apple.modelcatalog/ has been empty since the upgrade. mobileassetd logs NotAwareOfAsset / no set-configuration found for that set after every boot. It persists across reboots and the 27.2.1 update. No configuration profiles or MDM are installed. I've filed issue ith Feedback Assistant with a sysdiagnose. Is there a supported way to get the system to re-activate the com.apple.modelcatalog asset set without reinstalling macOS?
0
0
273
1w
Siri AI Developer Preview — Siri never calls an app's @AppIntent(.tool) intents on macOS 27.3 beta
Hello, I am testing the Siri AI Developer Preview with a small macOS lab app. Siri never calls any of the app's tool intents, and I cannot find what is missing. Setup MacBook Air (M5), macOS 27.3 beta (26C5047e), Siri AI enabled and marked "Beta", Siri language French (France), region France. ChatGPT extension turned off for the last tests. Xcode 27.3 beta (27C5035i), SDK macOS 27.3 (26C5047b). Signed "Apple Development" with my team (automatic signing), run locally, copied once to ~/Applications and launched. 8 intents marked @AppIntent(.tool), each with a French title and description; parameters typed with AppEntity types (characters, places, scenes) that have titles, descriptions and synonyms, served by an EnumerableEntityQuery. No #if around them. Metadata.appintents of the built app lists the 8 intents with the ToolIntent protocol. One ordinary AppShortcut intent (control): it does appear in Shortcuts. The 8 tool intents do not. Siri Integration Advisor: no suggestion. What happens 10 manual requests in French, app in the foreground, each starting with the app name ("Dans Labo Tour du monde, …"), plus 1 in English: 0 tool call (the app logs every perform()). 80 requests scripted with SiriEvaluations: 0 tool call. Siri answers by itself. No error in the app's registration logs. Questions Is anything else required for Siri to consider an app's tool intents on macOS (developer setting, Spotlight indexing of entities, a minimum number of donations, a skills bundle)? Is the preview's tool calling supported on macOS 27.3 beta in French (France) today? Is it expected that tool intents do not appear in the Shortcuts app? Is there sample code for the preview that we could run first to check our environment? Thank you.
1
0
417
2w
8-Node M5 Ultra Mac Studio Cluster: Dual-Cable Thunderbolt 5 Ring Topology & RDMA (TN3205) for MLX
Hi all, We are planning an 8-node M5 Ultra Mac Studio deployment for distributed LLM inference and training using MLX (mlx.distributed) and RDMA over Thunderbolt 5 (per Technote TN3205). Before finalizing our physical rack cabling, we would appreciate official confirmation on a few architectural details: Is an 8-node M5 Ultra Mac Studio cluster supported for distributed AI workloads using Apple's MLX framework? What is the recommended Thunderbolt 5 connection topology for eight Mac Studios: ring, mesh, or another configuration? We currently plan to use 14 Thunderbolt 5 cables. Can this quantity be used effectively for an eight-node cluster, or would Apple recommend a different number? Can Apple provide a detailed physical cabling diagram showing the specific Thunderbolt ports to connect between all eight machines? Is it possible or beneficial to establish multiple Thunderbolt connections between the same two Mac Studios to increase communication bandwidth?
0
0
110
2w
Guided generation stream goes silent for ~2.5 min, then contextSizeExceeded, after an unescaped quote inside a string (FB25591600)
Hi everyone, I've been chasing a stall in streamed guided generation that took me a while to pin down. I'm hoping someone here has seen it too, or can tell me whether it's expected. My setup: macOS 27.2.1 (26B131), Xcode 27.2, SystemLanguageModel.default (AFM 3 Core Advanced, 8,192-token context), greedy sampling, with the schema included in the prompt. What happens streamResponse(to:generating:includeSchemaInPrompt:options:) delivers 16 snapshots in the first ~4 s, one per 10 output tokens. Then nothing arrives for ~155 s: no snapshot and no error. At ~159 s one more snapshot arrives, and the stream immediately throws LanguageModelError.contextSizeExceeded: "Content contains 8193 tokens, which exceeds the maximum allowed context size of 8192." The prompt was 896 tokens, and the last snapshot reports 170 output tokens. That means about 7,100 tokens were generated without ever reaching a snapshot. The Foundation Models Instrument reports deltasCount: 730 for this response. What the last snapshot shows The field is a [String] of short bullets. In the final snapshot, the second bullet is a closed string: "The generalist used ". GeneratedContent(json:) accepts an escaped quote, single quotes, and a closed string followed by whitespace. It rejects a closed string followed by more text: try GeneratedContent(json: #"{"justification": ["The generalist used "angry"#) // Encountered content that cannot be completed into valid JSONIt looks as if the model wrote an unescaped " to start a quotation. That quote closed the string, and nothing after it could be parsed until the context window filled. Every freeze I could inspect stopped just before the model quoted someone ("The generalist's ", "The generalist stated "). None of the 199 finished responses I checked contained a double quote. On a run where the same input finished, the model wrote the word with single quotes ('angry'). The failure follows a single greedy path. In my app this input stalls on every cold request and finishes on every prewarmed one, while other inputs do the opposite. A standalone repro where this is the process's only request stalls with and without prewarm(). What I tried Bounding the array with @Guide(..., .count(2...4)) removed the stalls on the path my app uses: 0 of 34 panels and 0 of 27 end-to-end runs, down from 2 of 27. The same input still stalls on the other path. The instruction "Paraphrase the panelists; don't quote them." removed the stalls, but it cost accuracy on another field. The instruction "If you quote a panelist, use single quotes." made things worse: 9 stalls in 68 requests instead of 1. My current workaround: if no snapshot arrives for 15 s, cancel the stream and show an error. After cancellation, session.isResponding was false within a second. Questions Is an unescaped " inside a string field expected from guided generation? Or should constrained decoding prevent or escape it? Once the output can no longer be parsed, could the stream fail right away instead of generating until the window is full? Is there a supported way to detect this on the client other than a timeout? And does canceling the consuming task reliably stop generation on the model side? I've attached a self-contained repro (one Swift file, plus console output for the stalling run and the parser cases) to FB25591600. I'm happy to share more details or run anything that would help. Thanks for taking a look!
1
0
309
2w
SampleGenerator sends the Prompt's debug description to the on-device model, and every request carries the whole dataset
Hi, I'm running SampleGenerator from the Evaluations framework with SystemLanguageModel.default in place of PrivateCloudComputeLanguageModel, otherwise as in the Book Tracker sample's BookSampleGenerator/main.swift. Same prompt, instructions, validator and 13 seed reviews. Environment: Mac mini M5 Pro, macOS 27.2.1 (26B131), Xcode 27.2 (27B52), AFM 3 Core Advanced (8,192-token context). Repro: equivalent to the Book Tracker sample's BookSampleGenerator/main.swift with PrivateCloudComputeLanguageModel() replaced by SystemLanguageModel.default and targetCount set to seeds + 20. I ran it from a test target rather than the sample's own target. Attached: the [SampleGenerator] log from one run. let generator = SampleGenerator<ModelSample<BookTags>>( Prompt("Generate diverse range of book reviews and corresponding tags. ..."), samples: seeds, // the sample's 13 reviews targetCount: seeds.count + 20, sessionProvider: { LanguageModelSession(model: SystemLanguageModel.default, instructions: generatorInstructions) }, validator: { sample in /* the sample's four rules */ true } ) for try await sample in generator.run() { /* ... */ }1. The model receives the Prompt's debug description, not its text. The prompt segment in each session's transcript (and the [SampleGenerator] Prompt being sent to model: log line) begins: Prompt(components: Swift.AsyncThrowingStream<FoundationModels.Prompt.Component, Swift.Error>(context: ...), synchronousComponents: Optional([FoundationModels.Prompt.Component.text(FoundationModels.Prompt.Text(value: "Generate diverse range of book reviews..."))]))The examples that follow are also printed with String(describing:), including module and type names (MyModule.MySample(review: "...", tags: [...])). 2. Every request carries the full text of every sample so far. After the prompt comes "IMPORTANT: Generate N completely new examples with different starting prompts than any of these existing samples:", followed by every sample's full prompt text, seeds included, not just the selected examples. The request therefore grows with the dataset. On an 8K window the generator overflows, halves the batch, opens a new session, and finally logs Context window exhausted at batch size 1 twice in a row. Stopping. In every run that asked for 20 new samples (about ten runs), the dataset stopped at 15–22 samples in total, seeds included. run() then finishes normally, so the caller only finds out by counting. 3. With ModelSample<T>, the model is asked for every field, including instructions and TrajectoryExpectation. The on-device model fills them in. Every sample kept in two runs (9 of 9) had a writing brief in instructions ("Write a sweeping, reflective review…"), and 4 of 9 had invented tool-call expectations. In another run, all 6 samples had a brief where the review belongs ("Create 5 diverse book entries…"). The sample's validator passes these, since a brief is over 100 characters too. A custom @Generable type conforming to ModelSampleProtocol with only review and tags avoids this. 4. Deduplication is exact-match only. The model returns seed reviews with a sentence cut or added, and near-copies of its own samples with one word changed. Both pass. I check for shared 8-word runs in the validator instead. 5. Minor: samples includes the seeds, as documented, but the sample's main.swift prints allSamples.count as the number of new samples. Questions: Is (1) intended, or should the prompt be passed through as text? Is SampleGenerator meant to support the on-device model? If so, could the existing-samples list be limited (to the selected examples, or by token budget)? Could run() report that it stopped short of targetCount, for example by throwing or exposing a stop reason?
0
0
280
2w
AppIntents and Siri AI
I had a complete voice-only experience working with AppIntents and AppShortcuts on iOS 27.0 prior to enabling Siri AI. Once I enabled Siri AI, Siri refused to recognize any of the donated phrases in one particular AppShortcut. It still worked for several others. For the AppShortcut that no longer works, Siri responds to some of the phrases claiming the app doesn't support that action through Siri, and Siri responds to some of the phrases telling me I need to open the app to do that. FB24854409 includes a Sysdiagnose file. Note that I'm aware of App Schemas, but none apply well to my app.
2
1
858
2w
: Acceptable use check: Mac coding agent for Xcode that uses SystemLanguageModel and a custom LanguageModel provider
Hi, I’m preparing a macOS app for the Mac App Store and want to confirm it meets the Foundation Models acceptable use requirements and the Developer Program License Agreement before I submit. What the app does It’s a menu-bar app plus a sandboxed helper that Xcode 27 launches as a coding agent over ACP (Settings > Intelligence). The agent runs a LanguageModelSession in-process. It uses either SystemLanguageModel.default or a custom LanguageModel conformance that streams from an MLX model the user has downloaded. With Apple’s model, the agent gets only Xcode’s read and search tools. When the guardrails block a request, the app shows the error to the user and doesn’t retry or rephrase the prompt. The app also runs a local OpenAI-compatible HTTP server on 127.0.0.1 only, protected by a key. This server serves the downloaded MLX model only, never Apple’s model. Third-party agents the user installs (for example OpenCode) can point at it. Questions Is using SystemLanguageModel inside a coding agent that Xcode launches over ACP acceptable under the acceptable use requirements? Is it acceptable to ship a custom LanguageModel provider backed by a downloaded open-weight model alongside Apple’s model in the same app? Since the local HTTP server only serves the MLX model, can you confirm this doesn’t count as “exposing” the Foundation Models framework to other apps? And if I later wanted to route third-party agents to Apple’s on-device model, would that be permitted at all? Does the developer agreement require specific guardrails beyond the framework’s own for this kind of app? If so, where is that documented? Thanks happy to to share more detail on the architecture if it helps.
0
0
296
2w
Core AI: on-device specialization takes about 10 s per Neural Engine model because of ANELargeModelCompilerService respawn throttling
We ship a chunked Stable Diffusion XL pipeline as Core AI .aimodelc assets, compiled ahead of time with coreai-build compile for the device's architecture. On first launch, after an OS update, or after the system's model cache cleanup, each asset is specialized on the device with AIModel.specialize(contentsOf:options:cachePolicy:). Every model with Neural Engine regions takes about 10 s to specialize, no matter how large it is. With 16 such models, users wait about 2.5 minutes. The device log shows why. Each specialization launches ANELargeModelCompilerService, which compiles for 0.1–0.3 s and exits. launchd then delays the next launch until 10 s after the previous one: launchd: Successfully spawned ANELargeModelCompilerService[…] because ipc (mach) 10:05:39.190 launchd: service inactive: com.apple.ANELargeModelCompilerService.… 10:05:39.312 launchd: Successfully spawned ANELargeModelCompilerService[…] because ipc (mach) 10:05:49.546 launchd: service inactive: com.apple.ANELargeModelCompilerService.… 10:05:49.816 launchd: Successfully spawned ANELargeModelCompilerService[…] because ipc (mach) 10:06:00.448In some captures launchd also logs "Pushing respawn out by 10 seconds". Calling specialize concurrently for all models doesn't help. The launches stay 10 s apart, the total time was unchanged, app memory roughly quadrupled, and some specializations failed with failedToSpecialize. Signs of the issue: Specializing a Neural Engine model takes about 10 s, while a GPU-only model takes milliseconds. Console shows launches of ANELargeModelCompilerService about 10 s apart during specialization. Seen on iOS 27.2.1 (iPhone with A20 Pro, h19p) and iOS 27.2 (A19 Pro, h18p). Filed as FB25548599. Has anyone found a way to get several models compiled in one launch of the service, for example with multifunction assets?
0
0
343
3w
Notes from shipping Core AI image and music generation in an App Store app
I have an app on the App Store that uses Core AI for image generation and music generation on iPhone. I want to share what worked, because there was very little written about this when I started and some of it took a long time to find. The app supports iOS 17.6 and later. The Core AI features are available on iOS 27, and the rest of the app runs unchanged on older systems. It uses three Core AI models, which are FLUX.2 Klein for images, Stable Audio Open Small for short clips, and Stable Audio 3 Small for full-length music. FLUX.2 Klein The app runs FLUX.2 Klein through FlowTransformerPipeline from the coreai-models package, for both text to image and image editing. These are the things I learned from it. Ship the compiled bundle and name every compiled file in metadata.json. The pipeline now reads asset filenames only from metadata.json. An earlier version looked for fixed .aimodel filenames and reported that the Transformer component was missing for every compiled bundle. I reported that in coreai-models issue 355, and the fix was merged in pull request 357. Offer image editing as a separate download. Text to image does not need the VAE encoder or the image-to-image transformer, so the app downloads those only when the user adds image editing. If you leave files out this way, you must also remove their keys from metadata.json, because a file that is declared but missing now throws an error. Create a new pipeline after the files on disk change. The pipeline decides at initialization whether image editing is available. A pipeline created before the editing files were downloaded kept running text to image, and it did so without any error. Use the predicted clean image for live previews. With a four-step model, the noisy latent after each step does not look like anything a user can recognize. The predicted x0 does, and it makes the preview useful from the first step. I suggested this in coreai-models issue 231, and the package now supports previews through an optional progress handler that costs nothing when it is not used. Loading is fast. The compiled FLUX.2 Klein bundle loads almost immediately on the phone, with none of the long first-run compile that I saw with text models on the Neural Engine. Stable Audio Compile ahead of time for any large model. Loading the Stable Audio 3 source bundle on an iPhone 17 Pro ran for more than five minutes before I stopped it. The same model compiled on the Mac with coreai-build loads in seconds on the phone. The first load after download took about 15 seconds, and later loads were close to instant. Remove the functions you do not call before you compile. The Stable Audio 3 Small bundle has encoder functions and several decoder sizes that my app never uses. I removed those entry points with the coreai-torch package and left the helper graphs alone. The source went from 2.9 GB to 2.5 GB, the compiled bundle went from 7.0 GB to 4.8 GB, and the compile time on the Mac went from 9 minutes 18 seconds to 59 seconds. Memory was not the limit I expected for audio. A two-minute song peaked at about 2 GB on an iPhone 17 Pro, which leaves a good margin under what iOS allows one app. Small models can be compiled on the device. Stable Audio Open Small is about 1 GB and its bundles compiled on the phone in about 3 seconds. It then produced 11.9 seconds of audio in 9.2 seconds. Text models Text models are the part I have not been able to ship on Core AI, and the work is still open with Apple. I exported Qwen3 0.6B and SmolLM2 1.7B for iOS and compiled both ahead of time for the Neural Engine. Each compiled bundle still contains 30 Neural Engine regions that the system finishes compiling on the device at first load. Apple has confirmed that this step on the device is expected, and that coreai-build does not produce the final Neural Engine executables. That step is where the trouble is. On an iPhone 17 Pro, the first load of Qwen3 0.6B took more than two minutes, and later loads took about eight seconds. SmolLM2 1.7B never finished. The compiler tried to reserve a temporary file of 33.6 to 35.5 GB, ran out of storage, and the app was then terminated by an assertion. The app receives no error, so it cannot fall back to another model or tell the user what happened. I repeated the test on a Mac with the current toolchain, and the storage use is the same there. The first load used a peak of 17 GB of temporary disk space for the 0.6B model and 42 GB for the 1.7B model. The Mac has the room, so both models work, and they are fast once cached. Loads took about 0.05 seconds, with 196 tokens per second for the 0.6B model and 63 for the 1.7B model. Apple has reproduced the disk usage and is investigating it. The details are in coreai-models issue 387 and in my earlier thread at https://developer.apple.com/forums/thread/855499. Until that is resolved I have removed both models from the app, and local text models run on MLX and llama.cpp instead. I would like to hear from anyone who has a text model larger than 1B parameters loading on an iPhone through Core AI. Supporting older systems Weak link the framework if you support systems before iOS 27. My app crashed at launch on iOS 26 until I added -weak_framework CoreAI and -weak_framework FoundationModels to the linker flags. Availability checks in my own code were not enough, because the prebuilt coreai-models libraries imported those frameworks strongly. The simulator SDK has no CoreAI.framework, so the weak link flag for CoreAI has to be limited to device builds and all testing happens on a device. A few things I published may save others some time. The recipe I use to build coreai-models as xcframeworks is at https://github.com/james-333i/coreai-models-xcframework. The compiled FLUX.2 Klein bundle for iPhone is at https://huggingface.co/333i/flux2-klein-coreai-ios, and the trimmed Stable Audio 3 Small bundle is at https://huggingface.co/333i/stable-audio-3-small-music-coreai-ios. The app is Infinity Vaults, if anyone wants to see these models running in a shipping product. I am glad to answer questions about any of the steps above.
Replies
0
Boosts
0
Views
134
Activity
16h
TrustInsights: requestEvaluation(context:) throws contextInvalid("Model version current is unsupported.") for IsLikelyBeingCoachedInsight.
InsightEvaluator.requestEvaluation(context:) always throws InsightEvaluator.EvaluationError.contextInvalid with the message: "Model version current is unsupported." The request asks for IsLikelyBeingCoachedInsight with schema: .version1 and modelVersion: .current, the default. authorizationStatus(for:) returns .authorized for the same context before the call. .current is the default and only non-specific ModelVersion, so the app can't do anything to fix the request. We can't find any documentation on which model versions a device supports, or why .current would be rejected. Environment Device: iPhone 16e iOS: 27.2.1 Region: Japan Xcode 27.2 (27B52), iOS 27.2 SDK, macOS 26.6.2 Steps to reproduce Install the app on the device above and grant Trust Insights authorization. Run: let evaluator = InsightEvaluator() var context = InsightEvaluator.InsightContext( operationCategory: .payment, // also reproduces with .account requestedEvaluations: IsLikelyBeingCoachedInsight.request(schema: .version1, modelVersion: .current) ) context.requestID = UUID().uuidString let status = try await evaluator.authorizationStatus(for: context) // .authorized let evaluation = try await evaluator.requestEvaluation(context: context) // throwsExpected: An InsightEvaluation whose insight.outcome is a value (.unknown/.medium/.high) or an InsightError, such as insightVersionUnavailable, if no model is available. Actual: The call throws EvaluationError.contextInvalid("Model version current is unsupported."). It reproduces every time. Questions Is this expected? For example, is no model deployed yet for this device model, region or OS build? If so, is there a list of supported devices and regions? If this means "no model available", should it come back as InsightError.insightVersionUnavailable in the insight outcome rather than as contextInvalid? contextInvalid suggests our request is malformed.
Replies
1
Boosts
0
Views
428
Activity
17h
Siri AI on iOS 27.3 beta 2 cannot chain tool calls of App Intents that provide a dialog
I have been very excited to dive into making my AppIntents available as tools to Siri AI on iOS 27.3. It's great that it is now opened app to all third party developers, not just select schema-supported apps. It has been working really well for me until I ran into a use-case where I need two calls to be called in order to fulfill the request. My use case: I have a time tracking app, and I have two App Intents: one for getting active timers, and a second one to edit an event. The Get Active Timers App Intent both provides a dialog and returns a value. The returned value includes an 'event' property that can be passed as a parameter to the Edit Event App Intent. I verified that this works well in the Shortcuts app. When I try to ask Siri to update the current event's timer and set its event name to something, it just responds with the dialog of my Get Active Timers app intent. Upon deeper investigation of the logs with Claude, I found out that the core of the issue is that when the planner finds a tool (app intent) that provides a dialog, it only runs this one tool and returns the dialog. That's why I only get the response dialog from my Get Active Timers app intent and nothing else happens. As soon as I tried temporarily removing the ProvidesDialog from my perform function, it works. The planner finds both of my tools, passes the value between them, and the second tool correctly updates the event name of my running timer. This forum post was written entirely by hand. I am also attaching a more detailed explanation of the issue along with specific device logs from Siri that explain the issue in much more detail. That document is generated by Claude. I'd love to know if this is a deliberate limitation, and if it is, if you could consider making it possible for tools to be chained even when they provide a dialog in their single-call use case. This is especially important because the same App Intents are used in both the Shortcuts app and in Siri AI. Thank you.
Replies
2
Boosts
2
Views
440
Activity
20h
Support new Siri AI APIs while keeping backwards compatibility
We are modernizing out in Intents and Entities to be ready for SiriAI. We would like to add more metdata (description & visibility) to our @Property annotations and use @ComputedProberty and DeferredProperty in some cases. But all of these APIs are only available on iOS 27 or even 27.x. How would one use modern APIs to provide Siri AI with rich data while keeping backwards compatibility to iOS 17/18
Replies
7
Boosts
0
Views
1.3k
Activity
4d
Request for a Fee Waiver for a Free Quran App – Tadabbur Quran
Hello Apple Developer Community, I am an independent developer building an application called Tadabbur Quran. This project is a sincere charitable effort to serve people and make Quranic knowledge accessible to everyone around the world. The app provides Quran reading, translations, recitations, prayers, and educational resources. It is intended to remain completely free. I do not seek to earn money from this project. Unfortunately, I cannot afford the annual Apple Developer Program membership fee. I respectfully ask whether Apple offers any special assistance, fee waiver, sponsorship, or alternative way for an independent developer to publish a completely free educational and religious app on the App Store. My intention is simply to serve people and seek the pleasure of God. Thank you for your time and understanding. Kind regards, Tadabbur Quran Project Developer
Replies
0
Boosts
0
Views
321
Activity
5d
Qwen3.8-27B GGUF crashes on Apple M5 Max — LM Studio settings that work
Hardware Apple MacBook Pro 16" Chip: Apple M5 Max Memory: 48 GB Unified Memory Storage: 2 TB SSD OS: macOS (Apple Silicon) Software LM Studio 0.4.29 Model: Qwen3.8-27B (GGUF Q4_K_M) Problem
Qwen3.8-27B (GGUF Q4_K_M) answers the first message, then crashes on the second with an error: Error messages observed: - Engine protocol predict stream returned an error: {"code":500,"message":"Compute error.","type":"server_error"} - Engine protocol predict stream returned an error: {"code":500,"message":"got exception: Unexpected empty grammar stack after accepting piece: @ (31)","type":"server_error"} - Prediction request aborted but the prediction loop handler of the plugin lmstudio/default-prediction-loop-handler did not abort in time. - Cannot send on a terminated channel. Fix — LM Studio settings that worked
On Apple M5 Max + 48 GB RAM, the following combination resolves the crash: Hardware → GPUs: 1 GPU detected with Metal — Apple M5 Max (VRAM Capacity: 37.44 GB • Metal • deviceId: 0). Toggle OFF (do not use GPU for inference). Max Concurrent Predictions: set to 1 (default is 4). Unified KV Cache: OFF. Offload KV Cache to GPU Memory: OFF. Flash Attention: OFF. Model format: use GGUF Q4_K_M quantized versions only (e.g., Qwen3.8-27B Q4_K_M or Gemma 4 31B QAT Q4_K_M). Do not use MLX or unquantized models. Result
After applying all these settings, multi-turn chat works without errors. Gemma 4 31B QAT (GGUF Q4_K_M) also runs stably on the same hardware. This should help other users with M-series Macs and 48 GB Unified Memory avoid the same crash. https://github.com/lmstudio-ai/lmstudio-bug-tracker/issues/2659
Replies
1
Boosts
0
Views
72
Activity
6d
Qwen3.8-27B GGUF crashes on Apple M5 Max — LM Studio settings that work
App: LM Studio / llama.cpp (Metal) Device: Apple MacBook Pro 16", Chip: Apple M5 Max, Memory: 48 GB Unified Memory, Storage: 2 TB SSD, OS: macOS (Apple Silicon) Software: LM Studio 0.4.29, Model: Qwen3.8-27B (GGUF Q4_K_M) Issue: Qwen3.8-27B (GGUF Q4_K_M) answers the first message, then crashes on the second with an error: - Engine protocol predict stream returned an error: {"code":500,"message":"Compute error.","type":"server_error"} - Engine protocol predict stream returned an error: {"code":500,"message":"got exception: Unexpected empty grammar stack after accepting piece: @ (31)","type":"server_error"} - Prediction request aborted but the prediction loop handler of the plugin lmstudio/default-prediction-loop-handler did not abort in time. - Cannot send on a terminated channel. Fix — LM Studio settings that worked
On Apple M5 Max + 48 GB RAM, the following combination resolves the crash: Hardware → GPUs: 1 GPU detected with Metal — Apple M5 Max (VRAM Capacity: 37.44 GB • Metal • deviceId: 0). Toggle OFF (do not use GPU for inference). Max Concurrent Predictions: set to 1 (default is 4). Unified KV Cache: OFF. Offload KV Cache to GPU Memory: OFF. Flash Attention: OFF. Model format: use GGUF Q4_K_M quantized versions only (e.g., Qwen3.8-27B Q4_K_M or Gemma 4 31B QAT Q4_K_M). Do not use MLX or unquantized models. Result
After applying all these settings, multi-turn chat works without errors. Gemma 4 31B QAT (GGUF Q4_K_M) also runs stably on the same hardware. This should help other users with M-series Macs and 48 GB Unified Memory avoid the same crash.
Replies
0
Boosts
0
Views
70
Activity
6d
tvOS: Can Siri pass voice commands into my app for blind users?
Hi everyone, I'm building a media app for tvOS designed for blind users, so they can play songs just by giving a voice command. Currently, users can launch the app by voice. Inside the app, I've added a mic button that lets them navigate to a player or any tab by speaking. However, this isn't very practical for a blind user, since they first have to find and select that button. I'd like to know if either of the following is possible: Direct commands through Siri: Once my app is open, can the user press the Siri button on the remote and say something like "Play [song name]", and have my app handle it and play the content? Passing the spoken text to my app: If not, can the user press the Siri button, speak a command, and have the transcribed text delivered to my app's voice navigation text field, so my app can process it? If neither is supported, what is the recommended way to provide a hands-free or low-effort voice experience for blind users on tvOS? Any guidance, relevant APIs or sample code would be greatly appreciated. Thank you!
Replies
0
Boosts
0
Views
140
Activity
1w
How to stop Codex from accessing Root Access
I am new to developing apps, so please forgive me if this seems mundane or simple to you, but I have been using Codex inside Xcode, and even after setting extremely stringent permissions to protect my private life, Codex keeps overwritng them to gain root access. I have used the Terminal and found evidence that Codex has been attempting to access 'no acess' folders outside of the sandbox, even my browsers. I could paste all of my findings in here, but it's all extremely long, and I doubt that people will have time to read it anyway :) I have even gone into the config.toml file, but that does not stop Codex from routing through my files. Does anyone know how to restrict Codex so that it stays within its set boundaries for read & write, read only and no access? I do not accept that any AI model should acess my files, especially after I have set permissisons, but it overwrites them. Do I need to swicth agents or does Clause also gain access to the root? Thanks in advance.
Replies
4
Boosts
0
Views
785
Activity
1w
Adding MCP and connector support to your own Foundation Models apps
Circling back on the LocalLM Lab arc. With v0.7, we've moved from prompt experimentation into real app development on Apple's Foundation Models local AI. The LocalLM Lab SDK lets you build that same on-device model and MCP client this thread has covered directly into your own app, with real tool and data access (Slack, Todoist, GitHub, Notion, Linear, plus Calendar, Reminders, Contacts and Location). And you can ship your app including through the Mac App Store. This is a big improvement over version 0.6, where the localai-cli toolkit needed LocalLM Lab installed and running. On the other hand, the SDK (LocalLMLabSDKCore) doesn't relay through anything; it links FoundationModels and a real MCP client directly into your own binary and is totally self-contained. The example included in the SDK, Plate Today, has actually been built into a sandboxed test app and verified working, with a signed path to a Mac App Store .pkg (Apple Distribution signing + provisioning profile pipeline). That's "verified signable and sandbox-compatible," to be precise. Entitlements (from personal experience: always a complicated topic): com.apple.security.app-sandbox + com.apple.security.network.client for the app itself, plus the standard personal-information entitlements per connector used (com.apple.security.personal-information.calendars, .addressbook, .location) and matching NS*UsageDescription strings in Info.plist. The one worth flagging specifically: the network entitlement is easy to miss and fails silently rather than throwing. Without it, MCP connections and Weather calls just hang with no error surfaced. OAuth handling requires the app delegate callback (application(_:open:)), not SwiftUI's .onOpenURL. Worth knowing before wiring it up if you're SwiftUI-only. Full entitlements list + SDK guide: https://github.com/ancientcomputing/locallm/blob/main/docs/sdk-guide.md Feature page: thisbrain.ai/locallm/sdk.html I hope the availability of the SDK (free, Apache 2.0 license) will give folks further incentive to explore local AI-enabled applications on the Mac. What else would you want to do that the SDK doesn't currently support? File picker? Calendar/Reminders/Contacts edits & writes?
Replies
9
Boosts
1
Views
5.3k
Activity
1w
On-device model refuses to classify harmless grief-related text (LanguageModelError.refusal), but will summarize it
Hi, A harmless sentence about a grief support group makes the on-device model throw LanguageModelError.refusal when it's asked to classify it. In the same session, the same sentence is summarized without complaint, and the same sentence with "grief" swapped for something neutral classifies fine. Environment: Mac mini M5 Pro, macOS 27.2.1 (26B131), Xcode 27.2 (27B52), AFM 3 Core Advanced. Also reproduced on iOS 27.2 and visionOS 27.2 simulators. Minimal repro (run as written, twice, same result): @Generable enum SafetyLabel: String { case safe, sensitive, concerning, unsafe } let text = "Our support group meets on Thursdays to talk about coping with grief." // Throws LanguageModelError.refusal ("May contain sensitive content") let classifier = LanguageModelSession(instructions: "Classify the text by content safety.") _ = try await classifier.respond(to: text, generating: SafetyLabel.self) // Works: "Support group meets Thursdays for grief coping." let summarizer = LanguageModelSession() _ = try await summarizer.respond(to: "Summarize in five words: \(text)")Results, same session: "…coping with grief." → classify (@Generable enum): refusal; summarize (plain text): works "Our book club meets on Thursdays to talk about mystery novels." → classify: safe; summarize: works Same result with SystemLanguageModel(guardrails: .permissiveContentTransformations). It's refusal, not guardrailViolation. In a fuller classifier (four classifiers with calibrated label descriptions) it was also refused under greedy and default sampling, with a purpose line in the instructions, and with SystemLanguageModel(useCase: .contentTagging). A second case, likely the same trigger: the Little Women review in Apple's own Book Tracker sample (Using Evaluations to evaluate an intelligent feature). It recounts Beth's death, and tagging it with the sample's instructions, .permissiveContentTransformations guardrails and a @Generable tag array throws LanguageModelError.refusal on both .general and .contentTagging, in well under a second, on two Macs (M3 Max and M5 Pro). The other 12 reviews in the sample tag fine. I haven't tested whether the two share a trigger. So grief or death in otherwise harmless text seems enough for the model to refuse structured classification and tagging, the kinds of tasks the content-tagging use case is for. Questions: Is this expected? It reads like a false positive: nothing in the text is harmful, and the model will summarize it. Is there a supported way for an app to classify or tag text like this on device, for example for a support or journaling app where grief is a normal topic?
Replies
3
Boosts
0
Views
563
Activity
1w
macOS 27.2.1: Foundation Models stuck at modelNotReady and PCC requests hang (com.apple.modelcatalog asset set never activated
On an M5 Max running macOS 27.2.1 (26B131), the on-device Foundation Models has reported modelNotReady since I upgraded from 26.7.2 to 27.2 on Oct 27. Private Cloud Compute requests also hang with no error. fm models prints ✗ system (modelNotReady). fm respond --model pcc 'hello' in Terminal.app never returns. modelmanagerd opens the PCC session, but the on-device safety session it also opens (instruct_300m.safety) fails with UAF Code=5000 "no underlying assets", so no request is ever sent. /System/Library/AssetsV2/locks/com.apple.UnifiedAssetFramework/com.apple.modelcatalog/ has been empty since the upgrade. mobileassetd logs NotAwareOfAsset / no set-configuration found for that set after every boot. It persists across reboots and the 27.2.1 update. No configuration profiles or MDM are installed. I've filed issue ith Feedback Assistant with a sysdiagnose. Is there a supported way to get the system to re-activate the com.apple.modelcatalog asset set without reinstalling macOS?
Replies
0
Boosts
0
Views
273
Activity
1w
Siri AI Developer Preview — Siri never calls an app's @AppIntent(.tool) intents on macOS 27.3 beta
Hello, I am testing the Siri AI Developer Preview with a small macOS lab app. Siri never calls any of the app's tool intents, and I cannot find what is missing. Setup MacBook Air (M5), macOS 27.3 beta (26C5047e), Siri AI enabled and marked "Beta", Siri language French (France), region France. ChatGPT extension turned off for the last tests. Xcode 27.3 beta (27C5035i), SDK macOS 27.3 (26C5047b). Signed "Apple Development" with my team (automatic signing), run locally, copied once to ~/Applications and launched. 8 intents marked @AppIntent(.tool), each with a French title and description; parameters typed with AppEntity types (characters, places, scenes) that have titles, descriptions and synonyms, served by an EnumerableEntityQuery. No #if around them. Metadata.appintents of the built app lists the 8 intents with the ToolIntent protocol. One ordinary AppShortcut intent (control): it does appear in Shortcuts. The 8 tool intents do not. Siri Integration Advisor: no suggestion. What happens 10 manual requests in French, app in the foreground, each starting with the app name ("Dans Labo Tour du monde, …"), plus 1 in English: 0 tool call (the app logs every perform()). 80 requests scripted with SiriEvaluations: 0 tool call. Siri answers by itself. No error in the app's registration logs. Questions Is anything else required for Siri to consider an app's tool intents on macOS (developer setting, Spotlight indexing of entities, a minimum number of donations, a skills bundle)? Is the preview's tool calling supported on macOS 27.3 beta in French (France) today? Is it expected that tool intents do not appear in the Shortcuts app? Is there sample code for the preview that we could run first to check our environment? Thank you.
Replies
1
Boosts
0
Views
417
Activity
2w
8-Node M5 Ultra Mac Studio Cluster: Dual-Cable Thunderbolt 5 Ring Topology & RDMA (TN3205) for MLX
Hi all, We are planning an 8-node M5 Ultra Mac Studio deployment for distributed LLM inference and training using MLX (mlx.distributed) and RDMA over Thunderbolt 5 (per Technote TN3205). Before finalizing our physical rack cabling, we would appreciate official confirmation on a few architectural details: Is an 8-node M5 Ultra Mac Studio cluster supported for distributed AI workloads using Apple's MLX framework? What is the recommended Thunderbolt 5 connection topology for eight Mac Studios: ring, mesh, or another configuration? We currently plan to use 14 Thunderbolt 5 cables. Can this quantity be used effectively for an eight-node cluster, or would Apple recommend a different number? Can Apple provide a detailed physical cabling diagram showing the specific Thunderbolt ports to connect between all eight machines? Is it possible or beneficial to establish multiple Thunderbolt connections between the same two Mac Studios to increase communication bandwidth?
Replies
0
Boosts
0
Views
110
Activity
2w
Guided generation stream goes silent for ~2.5 min, then contextSizeExceeded, after an unescaped quote inside a string (FB25591600)
Hi everyone, I've been chasing a stall in streamed guided generation that took me a while to pin down. I'm hoping someone here has seen it too, or can tell me whether it's expected. My setup: macOS 27.2.1 (26B131), Xcode 27.2, SystemLanguageModel.default (AFM 3 Core Advanced, 8,192-token context), greedy sampling, with the schema included in the prompt. What happens streamResponse(to:generating:includeSchemaInPrompt:options:) delivers 16 snapshots in the first ~4 s, one per 10 output tokens. Then nothing arrives for ~155 s: no snapshot and no error. At ~159 s one more snapshot arrives, and the stream immediately throws LanguageModelError.contextSizeExceeded: "Content contains 8193 tokens, which exceeds the maximum allowed context size of 8192." The prompt was 896 tokens, and the last snapshot reports 170 output tokens. That means about 7,100 tokens were generated without ever reaching a snapshot. The Foundation Models Instrument reports deltasCount: 730 for this response. What the last snapshot shows The field is a [String] of short bullets. In the final snapshot, the second bullet is a closed string: "The generalist used ". GeneratedContent(json:) accepts an escaped quote, single quotes, and a closed string followed by whitespace. It rejects a closed string followed by more text: try GeneratedContent(json: #"{"justification": ["The generalist used "angry"#) // Encountered content that cannot be completed into valid JSONIt looks as if the model wrote an unescaped " to start a quotation. That quote closed the string, and nothing after it could be parsed until the context window filled. Every freeze I could inspect stopped just before the model quoted someone ("The generalist's ", "The generalist stated "). None of the 199 finished responses I checked contained a double quote. On a run where the same input finished, the model wrote the word with single quotes ('angry'). The failure follows a single greedy path. In my app this input stalls on every cold request and finishes on every prewarmed one, while other inputs do the opposite. A standalone repro where this is the process's only request stalls with and without prewarm(). What I tried Bounding the array with @Guide(..., .count(2...4)) removed the stalls on the path my app uses: 0 of 34 panels and 0 of 27 end-to-end runs, down from 2 of 27. The same input still stalls on the other path. The instruction "Paraphrase the panelists; don't quote them." removed the stalls, but it cost accuracy on another field. The instruction "If you quote a panelist, use single quotes." made things worse: 9 stalls in 68 requests instead of 1. My current workaround: if no snapshot arrives for 15 s, cancel the stream and show an error. After cancellation, session.isResponding was false within a second. Questions Is an unescaped " inside a string field expected from guided generation? Or should constrained decoding prevent or escape it? Once the output can no longer be parsed, could the stream fail right away instead of generating until the window is full? Is there a supported way to detect this on the client other than a timeout? And does canceling the consuming task reliably stop generation on the model side? I've attached a self-contained repro (one Swift file, plus console output for the stalling run and the parser cases) to FB25591600. I'm happy to share more details or run anything that would help. Thanks for taking a look!
Replies
1
Boosts
0
Views
309
Activity
2w
SampleGenerator sends the Prompt's debug description to the on-device model, and every request carries the whole dataset
Hi, I'm running SampleGenerator from the Evaluations framework with SystemLanguageModel.default in place of PrivateCloudComputeLanguageModel, otherwise as in the Book Tracker sample's BookSampleGenerator/main.swift. Same prompt, instructions, validator and 13 seed reviews. Environment: Mac mini M5 Pro, macOS 27.2.1 (26B131), Xcode 27.2 (27B52), AFM 3 Core Advanced (8,192-token context). Repro: equivalent to the Book Tracker sample's BookSampleGenerator/main.swift with PrivateCloudComputeLanguageModel() replaced by SystemLanguageModel.default and targetCount set to seeds + 20. I ran it from a test target rather than the sample's own target. Attached: the [SampleGenerator] log from one run. let generator = SampleGenerator<ModelSample<BookTags>>( Prompt("Generate diverse range of book reviews and corresponding tags. ..."), samples: seeds, // the sample's 13 reviews targetCount: seeds.count + 20, sessionProvider: { LanguageModelSession(model: SystemLanguageModel.default, instructions: generatorInstructions) }, validator: { sample in /* the sample's four rules */ true } ) for try await sample in generator.run() { /* ... */ }1. The model receives the Prompt's debug description, not its text. The prompt segment in each session's transcript (and the [SampleGenerator] Prompt being sent to model: log line) begins: Prompt(components: Swift.AsyncThrowingStream<FoundationModels.Prompt.Component, Swift.Error>(context: ...), synchronousComponents: Optional([FoundationModels.Prompt.Component.text(FoundationModels.Prompt.Text(value: "Generate diverse range of book reviews..."))]))The examples that follow are also printed with String(describing:), including module and type names (MyModule.MySample(review: "...", tags: [...])). 2. Every request carries the full text of every sample so far. After the prompt comes "IMPORTANT: Generate N completely new examples with different starting prompts than any of these existing samples:", followed by every sample's full prompt text, seeds included, not just the selected examples. The request therefore grows with the dataset. On an 8K window the generator overflows, halves the batch, opens a new session, and finally logs Context window exhausted at batch size 1 twice in a row. Stopping. In every run that asked for 20 new samples (about ten runs), the dataset stopped at 15–22 samples in total, seeds included. run() then finishes normally, so the caller only finds out by counting. 3. With ModelSample<T>, the model is asked for every field, including instructions and TrajectoryExpectation. The on-device model fills them in. Every sample kept in two runs (9 of 9) had a writing brief in instructions ("Write a sweeping, reflective review…"), and 4 of 9 had invented tool-call expectations. In another run, all 6 samples had a brief where the review belongs ("Create 5 diverse book entries…"). The sample's validator passes these, since a brief is over 100 characters too. A custom @Generable type conforming to ModelSampleProtocol with only review and tags avoids this. 4. Deduplication is exact-match only. The model returns seed reviews with a sentence cut or added, and near-copies of its own samples with one word changed. Both pass. I check for shared 8-word runs in the validator instead. 5. Minor: samples includes the seeds, as documented, but the sample's main.swift prints allSamples.count as the number of new samples. Questions: Is (1) intended, or should the prompt be passed through as text? Is SampleGenerator meant to support the on-device model? If so, could the existing-samples list be limited (to the selected examples, or by token budget)? Could run() report that it stopped short of targetCount, for example by throwing or exposing a stop reason?
Replies
0
Boosts
0
Views
280
Activity
2w
AppIntents and Siri AI
I had a complete voice-only experience working with AppIntents and AppShortcuts on iOS 27.0 prior to enabling Siri AI. Once I enabled Siri AI, Siri refused to recognize any of the donated phrases in one particular AppShortcut. It still worked for several others. For the AppShortcut that no longer works, Siri responds to some of the phrases claiming the app doesn't support that action through Siri, and Siri responds to some of the phrases telling me I need to open the app to do that. FB24854409 includes a Sysdiagnose file. Note that I'm aware of App Schemas, but none apply well to my app.
Replies
2
Boosts
1
Views
858
Activity
2w
: Acceptable use check: Mac coding agent for Xcode that uses SystemLanguageModel and a custom LanguageModel provider
Hi, I’m preparing a macOS app for the Mac App Store and want to confirm it meets the Foundation Models acceptable use requirements and the Developer Program License Agreement before I submit. What the app does It’s a menu-bar app plus a sandboxed helper that Xcode 27 launches as a coding agent over ACP (Settings > Intelligence). The agent runs a LanguageModelSession in-process. It uses either SystemLanguageModel.default or a custom LanguageModel conformance that streams from an MLX model the user has downloaded. With Apple’s model, the agent gets only Xcode’s read and search tools. When the guardrails block a request, the app shows the error to the user and doesn’t retry or rephrase the prompt. The app also runs a local OpenAI-compatible HTTP server on 127.0.0.1 only, protected by a key. This server serves the downloaded MLX model only, never Apple’s model. Third-party agents the user installs (for example OpenCode) can point at it. Questions Is using SystemLanguageModel inside a coding agent that Xcode launches over ACP acceptable under the acceptable use requirements? Is it acceptable to ship a custom LanguageModel provider backed by a downloaded open-weight model alongside Apple’s model in the same app? Since the local HTTP server only serves the MLX model, can you confirm this doesn’t count as “exposing” the Foundation Models framework to other apps? And if I later wanted to route third-party agents to Apple’s on-device model, would that be permitted at all? Does the developer agreement require specific guardrails beyond the framework’s own for this kind of app? If so, where is that documented? Thanks happy to to share more detail on the architecture if it helps.
Replies
0
Boosts
0
Views
296
Activity
2w
Core AI: on-device specialization takes about 10 s per Neural Engine model because of ANELargeModelCompilerService respawn throttling
We ship a chunked Stable Diffusion XL pipeline as Core AI .aimodelc assets, compiled ahead of time with coreai-build compile for the device's architecture. On first launch, after an OS update, or after the system's model cache cleanup, each asset is specialized on the device with AIModel.specialize(contentsOf:options:cachePolicy:). Every model with Neural Engine regions takes about 10 s to specialize, no matter how large it is. With 16 such models, users wait about 2.5 minutes. The device log shows why. Each specialization launches ANELargeModelCompilerService, which compiles for 0.1–0.3 s and exits. launchd then delays the next launch until 10 s after the previous one: launchd: Successfully spawned ANELargeModelCompilerService[…] because ipc (mach) 10:05:39.190 launchd: service inactive: com.apple.ANELargeModelCompilerService.… 10:05:39.312 launchd: Successfully spawned ANELargeModelCompilerService[…] because ipc (mach) 10:05:49.546 launchd: service inactive: com.apple.ANELargeModelCompilerService.… 10:05:49.816 launchd: Successfully spawned ANELargeModelCompilerService[…] because ipc (mach) 10:06:00.448In some captures launchd also logs "Pushing respawn out by 10 seconds". Calling specialize concurrently for all models doesn't help. The launches stay 10 s apart, the total time was unchanged, app memory roughly quadrupled, and some specializations failed with failedToSpecialize. Signs of the issue: Specializing a Neural Engine model takes about 10 s, while a GPU-only model takes milliseconds. Console shows launches of ANELargeModelCompilerService about 10 s apart during specialization. Seen on iOS 27.2.1 (iPhone with A20 Pro, h19p) and iOS 27.2 (A19 Pro, h18p). Filed as FB25548599. Has anyone found a way to get several models compiled in one launch of the service, for example with multifunction assets?
Replies
0
Boosts
0
Views
343
Activity
3w