AIOn-Device AIReact NativeExpoLLM

On-Device AI in React Native: Run LLMs Offline in Expo Apps (2026)

Add private, offline AI to Expo and React Native apps. Compare React Native ExecuTorch, Apple Foundation Models via expo-ai-kit, and cloud LLMs, with setup code, requirements, model sizes, and a hybrid on-device and cloud fallback pattern.

DeveloperMill4 min read

AI features are now expected in mobile apps. Most of them don't need a data center. Summarizing a note, suggesting a reply, tagging a photo, or extracting a date from text can run on the phone itself: offline, private, and with zero per-request cost. In 2026, React Native has practical options for doing exactly that in an Expo app.

Why run AI on the device?

  • Privacy: user data never leaves the phone, which is a strong selling point for health, finance, and journaling apps.
  • Offline: features work on a plane or in a basement.
  • Cost: no API bill per request, so you can offer AI on a free tier.
  • Latency: no network round trip for short tasks.

The trade-off is capability. On-device models are small (around 1–3B parameters), so they're great at focused tasks and weak at long reasoning.

Your three options

  1. React Native ExecuTorch runs open models (Llama, Qwen, LFM, and others) on iOS and Android using Meta's PyTorch Edge stack. You choose the model.
  2. Platform models use the model the OS already ships: Apple Foundation Models on iOS 26+ (no download) and ML Kit on Android. expo-ai-kit wraps both.
  3. Cloud LLMs (Claude, GPT, Gemini) are called from your server for heavy tasks. See our AI chat app guide.

Option 1: React Native ExecuTorch

Requirements: New Architecture, Expo SDK 55+ with a development build (Expo Go isn't supported), iOS 17+, and Android 13+.

npx expo install react-native-executorch react-native-worklets react-native-blob-util

Run a chat session with one hook:

import { useState } from "react"
import { Button, Text, View } from "react-native"
import { models, useLLMChatSession } from "react-native-executorch"

export default function LocalAssistant() {
  const session = useLLMChatSession(models.llm.LFM2_5_1_2B.DEFAULT)
  const [output, setOutput] = useState("")

  async function ask() {
    setOutput("")
    await session.sendMessage("Summarize: the meeting moved to Friday at 3pm.", (token) =>
      setOutput((prev) => prev + token),
    )
  }

  return (
    <View style={{ padding: 24, gap: 12 }}>
      <Button title="Summarize" onPress={ask} />
      <Text>{output}</Text>
    </View>
  )
}

The model downloads on first use and runs entirely on-device, with tokens streaming into your UI as they're generated. ExecuTorch also covers speech-to-text, image classification, object detection, OCR, and embeddings, so one library can power a whole set of AI features.

Option 2: Apple Foundation Models and ML Kit via expo-ai-kit

On iOS 26+, Apple ships a roughly 3B-parameter model with the OS, so there's nothing to download. expo-ai-kit exposes it, plus ML Kit on Android:

npx expo install expo-ai-kit
import { isAvailable, sendMessage, streamMessage } from "expo-ai-kit"

if (await isAvailable()) {
  const { text } = await sendMessage([
    { role: "system", content: "You write short, friendly push notification copy." },
    { role: "user", content: "Remind the user their streak ends tonight." },
  ])
}

// Streaming
const { promise, stop } = streamMessage(messages, (e) => setReply(e.accumulatedText))
await promise

Things to know:

  • Availability varies. The device must support Apple Intelligence, the user must have it turned on, and some regions (parts of the EU, and mainland China) have limited availability. Always call isAvailable() and design a fallback.
  • Models are stateless. Send the full conversation each call.
  • Android needs minSdkVersion 26.

The hybrid pattern most apps should use

Use on-device AI by default and fall back to the cloud when it's unavailable or the task is too big:

import { isAvailable, sendMessage } from "expo-ai-kit"

export async function summarize(text: string) {
  if (text.length < 4000 && (await isAvailable())) {
    const { text: summary } = await sendMessage([
      { role: "user", content: `Summarize in 2 sentences:\n\n${text}` },
    ])
    return summary
  }
  // Cloud fallback through your own API route (never ship API keys in the app)
  const res = await fetch("/api/summarize", { method: "POST", body: JSON.stringify({ text }) })
  return (await res.json()).summary
}

Good on-device use cases

  • Smart replies and rewrite suggestions ("make this friendlier")
  • Summaries of notes, articles, or chat threads
  • Classification and tagging (expense categories, mood, spam)
  • Extraction (dates, amounts, and addresses from text or OCR)
  • Semantic search with on-device embeddings
  • Voice notes with on-device speech-to-text

Practical tips

  • Download models after onboarding, not at install. Show progress and allow Wi-Fi-only downloads.
  • Keep prompts short and specific. Small models follow tight instructions much better than open-ended ones.
  • Ask for structured output (JSON with a fixed shape) and validate it with Zod.
  • Test on mid-range Android devices. Memory, not speed, is usually the limit.
  • Be clear in your UI that AI output can be wrong, and let users edit it.

Build the UI around it

AI features live or die on the UI: streaming text, loading states, sheets for suggestions. Our free Native Bottom Sheet works well for "AI suggestions" panels, and Expo templates give you a typed starting point. For the cloud half of the hybrid pattern, follow our guide to building an AI chat app with Expo and the Vercel AI SDK.

Frequently asked questions

Can you run an LLM on-device in React Native?

Yes. React Native ExecuTorch from Software Mansion runs small open models (around 1–3B parameters) directly on the phone, and libraries like expo-ai-kit expose Apple's built-in Foundation Models on iOS 26+ and ML Kit on Android. Both work offline and keep user data on the device.

Does on-device AI work in Expo Go?

No. On-device AI libraries ship custom native code, so you need a development build. React Native ExecuTorch also requires the New Architecture, Expo SDK 55+ (or React Native 0.83+), iOS 17+, and Android 13+.

Is on-device AI better than cloud AI like ChatGPT or Claude?

It's different. On-device models are free per request, private, and work offline, but they're much smaller and less capable. Use them for short tasks like summarizing, classifying, rewriting, and extracting. Use a cloud model for long reasoning, large context, or high-quality writing — many apps combine both.

How big are on-device AI models?

Typical mobile LLMs are 1–3 billion parameters and range from several hundred megabytes to a few gigabytes when quantized. Download them after install (not inside the app binary) and show progress, since they count against users' storage and data.

Build it faster with a template

Production-ready Expo React Native templates with the patterns from this post already wired up.

Browse templates