Loading CoreML model increases app size?

Hi, i have been noticing some strange issues with using CoreML models in my app. I am using the Whisper.cpp implementation which has a coreML option. This speeds up the transcribing vs Metal.

However every time i use it, the app size inside iphone settings -> General -> Storage increases - specifically the "documents and data" part, the bundle size stays consistent. The Size of the app seems to increase by the same size of the coreml model, and after a few reloads it can increase to over 3-4gb!

I thought that maybe the coreml model (which is in the bundle) is being saved to file - but i can't see where, i have tried to use instruments and xcode plus lots of printing out of cache and temp directory etc, deleting the caches etc.. but no effect.

I have downloaded the container of the iphone from xcode and inspected it, there are some files stored inthe cache but only a few kbs, and even though the value in the settings-> storage shows a few gb, the container is only a few mb.

Please can someone help or give me some guidance on what to do to figure out why the documents and data is increasing? where could this folder be pointing to that is not in the xcode downloaded container??

This is the repo i am using https://github.com/ggerganov/whisper.cpp the swiftui app and objective-C app both do the same thing i am witnessing when using coreml.

Thanks in advance for any help, i am totally baffled by this behaviour

I have the same issue here, and the space won't return even when I uninstall the app.

Can anyone from apple help with this? i can't request a code level support because the app size it bigger than the 50mb limit. Any suggestions in getting help?

Hello, I am facing this issue too, to be precise when I use "VNCoreMLModel". However I have seen this happens only when the app is ran from Xcode. If you run it in production nothing strange happens. Could be some sort of debugging bug?

same here, any silustion?? my app's document and data getting larger in every run. but the iphone storeage not getting bigger...

The only solution i found is to turn off using Apple neural engine. When setting up configuration use CPU and GPU (rather than allComputeUnits or CPU and ANE options).

not ideal since it is slower using metal.

i haven’t tried to release it to product and check there - don’t want to get poor feedback from users! maybe I can try to release to test flight and check to see. Will let you know

I have the same issue. I posted it on this StackOverflow Post

Loading CoreML model increases app size?
 
 
Q