Skip to content
Inference Academy

Shipping an on-device model: ExecuTorch, LiteRT, llama.cpp and platform APIs

The practical routes for putting a language model inside an iOS or Android app: built-in platform models, Google's LiteRT and MediaPipe LLM APIs, PyTorch ExecuTorch with hardware backends, and llama.cpp or MLX. How each export pipeline works, how to choose, model delivery, and a test plan for real devices.

By

15 min · verified 2026-11Pro
Share

Phones, NPUs and embedded devices covers the constraints: memory budgets, bandwidth, thermals and battery. This lesson is about the route from a model to an app in the store: which runtime, which export pipeline, and how to test it.

What we checked. This lesson describes each toolchain's documented workflow as of November 2026. We have not built and profiled these pipelines on phones for this lesson; mobile toolchains change quickly, so follow each project's current guide for exact commands.

#Four routes

Route What you ship Hardware use Best for
Platform models (Apple's Foundation Models framework, Android's on-device Gemini Nano APIs) Nothing; the OS provides the model Tuned by the vendor Common tasks (summarise, rewrite, extract) on supported devices
Google AI Edge: LiteRT and the MediaPipe LLM Inference API A converted model bundle CPU and GPU, some NPUs Android-first apps with supported open models
PyTorch ExecuTorch A .pte program plus the runtime CPU (XNNPACK), Apple (Core ML, MPS), Qualcomm, MediaTek, Vulkan and other backends Custom PyTorch models, NPU use, both platforms
llama.cpp (or MLX on Apple) A GGUF (or MLX) model plus the engine CPU, Metal, Vulkan One format across phone and desktop; fast iteration

#Route 1: platform models

Recent iOS and Android versions expose an on-device model through system APIs. You get no download, OS-managed memory, and a model tuned for the hardware. You give up the choice of model, some control over prompts and output, and availability: older devices, some regions and some languages are not supported. Always check availability at run time and provide a fallback (a smaller feature, or a server call with consent).

#Route 2: LiteRT and MediaPipe

Google's on-device stack converts supported open models into bundles that its LLM inference API loads, with GPU acceleration on many Android devices and support on iOS and the web. Use it when your model is on its supported list; converting unsupported architectures is much harder.

Pro content

Keep reading with Inference Academy Pro

Unlock the rest of this lesson, plus every advanced lesson, hands-on lab, the larger playground models and completion certificates.

Still to come in this lesson

  1. Route 3: ExecuTorch
  2. Route 4: llama.cpp or MLX
  3. Choosing
  4. Delivering the model
  5. Test plan on real devices
  6. Exercises

You will be able to answer

  • Your feature needs a short summary of a note and must work on recent iPhones and Android flagships with the least effort. What should you try first?
  • What does ExecuTorch's export produce?
  • Why is a 'delegate' or backend choice important on phones?
  • When is llama.cpp a good choice in a mobile app?
  • What must a mobile LLM test plan include that a desktop one does not?