If look into the iOS 27 release documentation, and a couple of changes stood out that might explain what you're experiencing.
The most interesting is issue 174796039, documented in Apple's iOS 27 release notes under Core AI. Apple states that Neural Engine memory usage is now attributed to the application process rather than the system.
This could potentially explain the substantial increase in reported memory consumption. It may not necessarily mean the model is allocating more memory than before, but rather that memory previously attributed to the system is now being counted against your application's limit.
However, that wouldn't explain why inference also fails with .cpuOnly.
I also noticed two documented issues involving dynamic tensor shapes:
176807213 – Inference failures involving dynamically shaped outputs.
177354777 – Inference failures or crashes involving control flow over dynamic-shaped tensors.
Although these relate to Core AI and are marked as resolved, I wonder whether there could be a related regression in Core ML's handling of dynamic shapes, particularly given your FlexibleShapeInformation warning and the use of non_zero, gather, and other operations producing variable-sized outputs.
One other consideration is that Core ML specialises models for the operating system and hardware, meaning the same model can undergo different optimisation and compilation steps following an OS update.
Have you tried loading and running the two ML Programs independently on iOS 27? It would be interesting to determine whether the memory spike originates from the segmentation model's NMS operations or the post-processing model's dynamically sized masks.
It might also be worth comparing identical builds produced with Xcode 26 and Xcode 27 to establish whether the behaviour is entirely OS-dependent.
The Neural Engine memory attribution change seems particularly relevant to the memory issue, but I suspect the CPU inference failure may point to a separate dynamic-shape regression.
Apple's release notes: https://developer.apple.com/documentation/ios-ipados-release-notes/ios-ipados-27-release-notes
Hope this helps narrow down the investigation.
Topic:
Machine Learning & AI
SubTopic:
Core ML
Tags: