必须启用 New Architecture,且需 React Native 0.83+ 或 Expo SDK 55+ 的 Development Builds,Expo Go 不支持;react-native-worklets 需 >=0.10.0 <0.14.0,并把 react-native-worklets/plugin 放在 Babel plugins 最后一项;预导出模型需联网下载,且默认会上报匿名下载事件,可用 setTelemetryEnabled(false) 关闭。
react-native-executorch
software-mansion活跃维护把 ExecuTorch 推理运行时封装进 React Native,让手机端直接跑 LLM、视觉、语音等模型,数据不出设备。
High-performance, privacy-first on-device AI inference library for React Native, powered by PyTorch's ExecuTorch runtime
npm install react-native-executorch react-native-worklets react-native-blob-utilREADME 未给出具体显存或内存要求;支持 iOS 17.0+ 与 Android 8.0+(minSdkVersion >= 26),加速后端覆盖 CPU(XNNPACK)、Apple Silicon(Core ML、MLX)和 Android GPU(Vulkan)。
在 React Native 里本地跑 AI 模型的推理库,基于 ExecuTorch,无需联网、数据不出设备
把 ExecuTorch 推理运行时封装进 React Native,让手机端直接跑 LLM、视觉、语音等模型,数据不出设备。
核心能力
- 用 XNNPACK、Core ML、MLX、Vulkan 等后端做原生硬件加速
- 提供 use<Task> 任务 Hook,覆盖 LLM、视觉、语音、嵌入并自动缓存
- 支持加载自带 .pte 模型,用底层张量算子自建 TypeScript 流水线
- 内置预导出模型目录,可从 Hugging Face 集合直接取用
- 推理全程离线,模型下载后零网络依赖、零云端成本
容易踩的坑
- v0.11.1-libspre-release2026-11-04 · 2026-11-04 09:39 UTC
查看更新说明
Built from software-mansion-labs/executorch @
@ms/separate-backends-1.4.1(0a087190).xnnpack-*,coreml-ios,opencv-android-*andqnn-android-arm64-v8aare the v0.11.0-libs files byte for byte.- Upstream ExecuTorch fixes synced to their merged or latest reviewed revisions (software-mansion-labs/executorch#30, #31).
- Vulkan: Style Transfer output fixed on Mali.
- Core: portable
remainderand quantizeddequantize_per_channelfixes. - MLX: lazy-graph eval threshold defaults to 512 MB.
headersregenerated.
- v0.11.0最新正式版2026-10-27 · 2026-10-27 14:59 UTC
React Native ExecuTorch v0.11.0 🚀
What's New?
🧠 LLMs
- LLM generation now runs on modular TypeScript runners (text, multimodal, Gemma) with a fully featured sampler based on the field-tested
llama.cppone, with support for constrained decoding and fine-grained control over generation. (#1508). - Re-exported LLMs with context windows up to 16k tokens (#1508).
enable_thinkingchat template option and new MiniCPM5-2B (#1571). 👉 LLM Chat & Generation
👁️ Computer vision
- Depth estimation: Depth Anything V2 / V3 and ZipDepth (#1552). 👉 Docs
- Image inpainting: MI-GAN (#1573). 👉 Docs
- MediaPipe Face Mesh keypoints (#1469).
- Core ML segmentation models may return an index map (#1463).
🔎 Retrieval
createVectorStore: in-memory vector store with top-k cosine/dot queries and metadata filters (#1520).- ColBERT late-interaction embeddings with LFM2.5-ColBERT-350M and a
maxSimhelper (#1521). 👉 Docs
🗣️ Speech
- Kokoro: Chinese (#1557) and word timestamps (#1495).
⚡ Faster, smaller models
- Vulkan is the Android default for style transfer, YOLO26 (detection / seg / pose), RF-DETR, FastSAM, BlazeFace and SDXS (#1479).
- XNNPACK int8 for Whisper, YOLO26, RF-DETR, FastSAM, MiniLM, mpnet, CLIP, Supertonic and SDXS (#1522, #1530, #1537, #1539, #1542); Core ML text embedders served as int8 (#1465).
📊 Benchmarks
Per-device latency and memory for every registry variant. 👉 Benchmarks
⚠️ Breaking changes
- The
@experimentalLLM runner API changed (#1508). The chat and generation APIs are unchanged. - The 15 unquantized (bf16/fp16) XNNPACK LLM variants were removed (#1519).
- 66 unquantized XNNPACK variants with a faster quantized twin are deprecated and will be removed in v1.0.0 (#1519).
🐛 Fixes
All fixes shipped in v0.10.1 – v0.10.7 are included.
Full Changelog: https://github.com/software-mansion/react-native-executorch/compare/v0.10.0...v0.11.0
- LLM generation now runs on modular TypeScript runners (text, multimodal, Gemma) with a fully featured sampler based on the field-tested
- v0.11.0-libspre-release2026-10-27 · 2026-10-27 14:14 UTC
查看更新说明
Identical to v0.10.7-libs, republished under the v0.11.0 version.
- v0.10.7-libspre-release2026-10-22 · 2026-10-22 18:20 UTC
查看更新说明
Built from software-mansion-labs/executorch @
@ms/separate-backends-1.4.1(f7bd4261).coreml-iosandopencv-android-*are the v0.10.6-libs files byte for byte.- software-mansion-labs/executorch#24: streamed tokenizer decode keeps word breaks (EuroLLM).
- XNNPACK weights-cache, depthwise conv transpose, upsample and pad-fusion fixes from the fork PRs.
- Vulkan
conv2d_dwfix; QNN delegate argument bounds check; MLX backend updates. headersregenerated from the build tree (v0.10.6-libs headers predated some Vulkan APIs).
- v0.10.72026-10-21 · 2026-10-21 12:26 UTC
查看更新说明
Patch release bumping phonemis to v0.3.1, so text-to-speech reads long numbers (e.g. phone numbers) digit by digit instead of dropping them.
What's Changed
- fix(speech): bump phonemis to v0.3.1 by @msluszniak in https://github.com/software-mansion/react-native-executorch/pull/1553
Full Changelog: https://github.com/software-mansion/react-native-executorch/compare/v0.10.6...v0.10.7
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
React Native ExecuTorch is an on-device AI inference library for React Native, powered by ExecuTorch — Meta's on-device inference runtime. It lets you run machine learning models directly on the user's phone with zero network calls, full offline capability, and guaranteed privacy. No data ever leaves the device.
The library ships with a curated set of pre-exported models covering computer vision, language models, text-to-speech, transcription, and more — all available in our Hugging Face collection and ready to use out of the box. You can also bring your own .pte models and plug them into existing pipelines or build entirely custom ones from scratch.
To export your own PyTorch models to .pte, use ExecuTorch Export Recipes, our export harness with model recipes and agent skills.
To explore all on-device capabilities in an interactive showcase app, check out the React Native ExecuTorch Gallery.
Table of Contents
- Key Features
- Quickstart
- Documentation
- Powered by React Native ExecuTorch
- Created by Software Mansion
Key Features
- Native Hardware Acceleration: Optimized execution delegates across backends: XNNPACK (CPU), Core ML & MLX (Apple Silicon), and Vulkan (Android GPU).
- 100% Offline & Private: Zero cloud inference costs and zero network dependency after model download. No user data ever leaves the device.
- Two-Layer Architecture:
- Ready-to-use Task Hooks (
use<Task>): Out-of-the-box support for LLMs, computer vision, speech, and embeddings with automatic caching and lifecycle management. - Lower-level Runtime & Custom Orchestration: Build custom pipelines entirely in TypeScript using low-level tensor operations, fast native operators, schema validation, and worklet threading.
- Ready-to-use Task Hooks (
- Pre-Exported Model Catalog: Access verified models directly via the
modelsregistry and the Software Mansion Hugging Face Collections.
Quickstart
[!TIP] Using an AI coding agent? The consumer skill helps your agent choose ready-made models and task hooks, integrate a custom
.pte, or build a custom TypeScript pipeline.Install the consumer skill from the Software Mansion skills repository:
npx skills add software-mansion-labs/skills -s react-native-executorchSee AI Tools for model-selection guidance and an example prompt.
1. Installation
Install react-native-executorch alongside its required peer dependencies:
npm install react-native-executorch react-native-worklets react-native-blob-util
# or
yarn add react-native-executorch react-native-worklets react-native-blob-util
# or
pnpm add react-native-executorch react-native-worklets react-native-blob-util
[!IMPORTANT] React Native ExecuTorch requires:
- New Architecture enabled
- React Native 0.83+ or Expo SDK 55+ with Development Builds (Expo Go is not supported due to custom C++ native libraries)
react-native-worklets0.10 or newer (>=0.10.0 <0.14.0)- iOS 17.0+ / Android 8.0+ (
minSdkVersion>= 26)react-native-worklets/pluginas the last entry in your BabelpluginsDownloads of our pre-exported models send an anonymous download event; call
setTelemetryEnabled(false)to opt out.See the Getting Started Guide and Compatibility table for more details.
2. Run the Model
import { Button, View } from 'react-native';
import { models, useLLMChatSession } from 'react-native-executorch';
export function App() {
const session = useLLMChatSession(models.llm.LFM2_5_1_2B.DEFAULT);
const handleGenerate = async () => {
if (!session.isReady || !session.sendMessage) return;
const turn = await session.sendMessage(
'Explain on-device AI in one sentence.',
(token) => console.log(token)
);
console.log('Result messages:', turn.messages);
};
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Button
title={session.isReady ? 'Generate' : `Loading (${session.downloadProgress.toFixed(0)}%)`}
onPress={handleGenerate}
disabled={!session.isReady}
/>
</View>
);
}
Documentation
Building with an AI coding agent? See AI Tools
for model-selection guidance and an example prompt.
Choose a pre-exported model with a task hook, or bring your own .pte and build a custom TypeScript pipeline.
Full documentation, guides, architecture deep dives, and API references are available at: docs.swmansion.com/react-native-executorch
- Getting Started Guide
- Downloading & Caching Models
- Task Extensions & Pipelines
- Core Primitives & Custom Pipelines
- Exporting Custom
.pteModels
Powered by React Native ExecuTorch
React Native ExecuTorch powers Private Mind, a privacy-first mobile AI application available on App Store and Google Play.
It also powers these libraries:
- React Native RAG: private, on-device retrieval-augmented generation for your own documents.
- React Native OCR: on-device document OCR with page layout, tables, dewarping and vertical text.
Created by Software Mansion
Since 2012, Software Mansion has been building mobile and web apps, contributing to open-source software, and dealing with all kinds of React Native challenges. We are Core React Native Contributors. We can help you build your next AI product – Hire us.