Per-iPhone Gemma 4 E2B Configuration Report
Key point
Resolved Gemma 4 E2B multimodal OOM in llama.cpp on iOS.
Details
Running Gemma 4 E2B-it-Q3_K_S.gguf with llama.cpp across 20+ iPhones, the cause of a multimodal OOM that only occurred in App Store distribution builds was traced.
It worked fine on development devices, but in production builds, it wasn't resolved by toggling GPU on/off, using a smaller quant, or reducing the image token budget.
Adding the following entitlements eliminated crashes on 6GB+ RAM devices (iPhone 13 Pro and above):
com.apple.developer.kernel.increased-memory-limitcom.apple.developer.kernel.extended-virtual-addressing
On 4GB RAM devices (iPhone 13 mini, 11 Pro), OOM still remained, and it was reported that with settings of n_ctx=1024, n_batch=256, image_tokens=70, n_gpu_layers=99, a multimodal generation speed of 0.2 tok/s was achieved.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.