published fresh until

On-device LLM in an app: LiteRT-LM, Gemini Nano or llama.cpp?

Summary LiteRT-LM (0.20.0; November 2026) replaces MediaPipe LLM Inference as Google's cross-platform route, Gemini Nano via ML Kit is Android-only and Beta, Apple Foundation Models needs iOS 26 and Apple Intelligence hardware, and llama.cpp runs compatible GGUF models on both; weight licences differ between Gemma 4 (Apache-2.0), earlier Gemma and Llama 3.2.

Not for choosing the app shell, see react-native-expo-flutter-or-capacitor-for-a-react-typescript-team; serving a model on a server, see vllm-sglang-llama-cpp-or-ollama-to-serve-a-team-llm-2026

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

You want a model to run inside your own Android and iOS app: offline, no per-token bill, text stays on the phone. The options differ a lot by platform, by who ships the model, and by licence. This is a map of what exists today, with sizes and speeds only as attributed claims.

Status and versions, checked 20 October 2026

OptionPlatformsVersion / statusLicence
LiteRT-LM (Google AI Edge)Android, iOS, web, desktopAs of November 2026, 0.20.0 (23 Nov 2026; checked 2026-11-24); Kotlin, Python, C++ stable; Swift and JavaScript early previewApache-2.0
MediaPipe LLM InferenceAndroid, iOS, webits page says maintenance-only, migrate to LiteRT-LM; tasks-genai 0.10.35 on Google MavenApache-2.0
Gemini Nano via ML Kit GenAI Prompt API and AICoreAndroid onlygenai-prompt 1.0.0-beta5 (26 Oct 2026); Prompt API listed as BetaML Kit GenAI additional terms
Apple Foundation Models frameworkiOS, iPadOS, macOS 26 and laterneeds an Apple Intelligence deviceApple developer terms
llama.cppAndroid, iOSAs of November 2026, v1.0.0 (13 Nov 2026); sample apps llama.android and llama.swiftuiMIT
ExecuTorchAndroid, iOSAs of November 2026, 1.6.0 (12 Nov 2026); MLX backend experimentalBSD
MLC LLMAndroid, iOSno GitHub release, tag v0.20.0 (7 Jul 2026), commit 6 Oct 2026Apache-2.0
MLX Swift and mlx-swift-lmApple platformsAs of November 2026, 0.33.0 (27 Oct 2026) and 3.32.3 (30 Sep 2026)MIT

Details worth knowing. Google's ML Kit page lists Gemini Nano access by model generation: nano-v2 on devices such as Honor Magic 7 and Xiaomi 15, nano-v3 on Pixel 9 and 10 and Galaxy S26, nano-v4 on Pixel 11 and Galaxy Z Flip8 and Fold8; usage is foreground-only with a per-app quota, and AICore delivers the model so your app does not bundle it. Android's Gemini Nano page recommends Firebase AI Logic hybrid inference for unsupported devices. Apple's docs say the on-device model comes in versions that change with OS updates, you must check availability at runtime, and heavier reasoning goes to Private Cloud Compute or a server model. ExecuTorch exports a separate .pte file per backend, with Android paths for XNNPACK, Vulkan, Qualcomm and Samsung, and iOS paths for XNNPACK and Core ML; its 1.6.0 release notes list MediaTek as temporarily unsupported. LiteRT-LM's README names Gemma, Llama, Phi-4 and Qwen and links a Google post claiming up to 3x faster Gemma 4 inference with multi-token prediction; I did not verify that. MLX Swift LM includes a bridge to Apple's FoundationModels; I did not verify its minimum iOS.

Model weights and licences

  • Gemma 4 E2B: Apache-2.0 on its Hugging Face card, 2.3B effective parameters (5.1B with embeddings), 128K context, text, image and audio input.
  • Earlier Gemma (3, 3n): Google's custom Gemma Terms of Use (page modified 1 April 2026). Redistributors must pass on use restrictions and the Prohibited Use Policy, include a notice file, mark modified files, and Google may update the model or terminate for breach.
  • Llama 3.2 Community License (25 Sep 2024): display "Built with Llama", ship a notice file, models trained with its outputs must start their name with "Llama", and a company above 700 million monthly users needs Meta's licence. It incorporates an Acceptable Use Policy I did not read.

When to pick which

ConstraintPick
Cross-platform, Gemma family, Google's pathLiteRT-LM (new work), not MediaPipe
Android only, tiny integration, newest flagshipsGemini Nano via ML Kit, with a cloud fallback
iOS only, no model downloadApple Foundation Models, with an availability fallback
llama.cpp-compatible GGUF models on both platforms, you accept JNI and Swift gluellama.cpp
PyTorch-trained model, vendor NPU pathsExecuTorch
Apple-only, custom or fine-tuned modelsMLX Swift

What developers report

  • In r/androiddev, u/Aviation2025 (9 May 2026) tried Gemini Nano, LiteRT-LM 0.11.0 and llama.cpp on a Pixel 8. They found Gemini Nano gated by an opt-in, a Google Group and specific AICore versions, Gemma 4 E2B (2.59 GB .litertlm) at 4 to 5 tokens per second on CPU, and no working LiteRT GPU backend on Tensor G3; llama.cpp reached about 6. The docs have moved since (the Prompt API is now listed as Beta), so re-test.
  • In r/androiddev, u/angelin1978 (28 February 2026) listed llama.cpp lessons: mmap behaves differently across vendors for 3 GB or larger weights, Android kills background inference so use a foreground service, and throughput dropped about 30% after roughly 30 seconds on Tensor G3.
  • In r/androiddev, u/simrankoulsm (September 2026) built a fallback library because MLC LLM sessions on a Galaxy Tab S10+ stalled on long prompts or ran out of memory. One report, and the author promotes the library.

Recommendation by constraint

  • Mid-range phones: plan for models near 1B parameters and a cloud fallback; reports above show single-digit tokens per second on a Pixel 8 CPU.
  • Need one codebase for both stores: LiteRT-LM or llama.cpp; expect platform glue either way. For React Native or Expo apps see react-native-expo-flutter-or-capacitor-for-a-react-typescript-team for the shell choice; these runtimes are native modules.
  • Shipping Gemma or Llama weights: keep the licence text, notice file and attribution in the app and store listing, and prefer Apache-2.0 weights when you cannot.

A prompt to give your agent

Our <Kotlin | Swift | React Native> app needs <summarisation | extraction | chat> on device, targeting <device list> and iOS <version>. Compare LiteRT-LM, Gemini Nano via ML Kit, Apple Foundation Models and llama.cpp for that: versions and licences from the official pages today, supported devices, model download size, and what happens on an unsupported device. Recommend one path per platform with a cloud fallback, and list every licence notice we must ship.

Mistakes to check

  • Starting new work on MediaPipe LLM Inference after its maintenance-only notice.
  • Assuming Gemini Nano exists on every Android phone.
  • Testing speed on the newest flagship only.
  • Forgetting that Gemma 3 and Gemma 4 licences differ.
  • Running inference in a plain coroutine that the OS kills in the background.

Limits

I built no app and measured no speed. Versions come from GitHub, Google Maven and official docs read on 20 October 2026. Speeds are users' reports on single devices. Apple's docs were read through their JSON documentation feed; its device list page I did not open. I did not check MLC LLM's iOS state beyond its README and repository activity, nor llama.cpp's current Gemma 4 support.

Started from a post by @Aviation2025, packaged by the editor. Original post

Subjects

More in local models

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# On-device LLM in an app: LiteRT-LM, Gemini Nano or llama.cpp?
Summary: LiteRT-LM (0.20.0; November 2026) replaces MediaPipe LLM Inference as Google's cross-platform route, Gemini Nano via ML Kit is Android-only and Beta, Apple Foundation Models needs iOS 26 and Apple Intelligence hardware, and llama.cpp runs compatible GGUF models on both; weight licences differ between Gemma 4 (Apache-2.0), earlier Gemma and Llama 3.2.
Copy for agent
get the whatworks thread on-device-llm-in-a-mobile-app-litert-lm-gemini-nano-foundation-models and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread on-device-llm-in-a-mobile-app-litert-lm-gemini-nano-foundation-models
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks