Skip to main content
Version: Next

Native Libraries

React Native ExecuTorch ships the core runtime, hardware-accelerated backends (XNNPACK, Core ML, MLX, Vulkan, QNN), and native third-party libraries (OpenCV, phonemis) as separate downloadable artifacts.

By default, everything except QNN is downloaded and enabled, so no configuration is required to get started. However, because on-device AI backends and vision libraries add substantial binary weight, you can tailor exactly what gets pulled into your app. Declaring only the features or backends you use reduces install times, speeds up builds, and significantly shrinks the final app bundle. At install time, a postinstall script inspects your configuration and fetches only the native artifacts your app needs.

How it works​

  1. Reads config from the react-native-executorch block in your package.json (if any).
  2. Writes rne-build-config.json with boolean flags that the native build reads.
  3. Downloads binaries from the GitHub Release tagged with your package version, verifying checksums.
  4. Caches them under ~/.cache/react-native-executorch/<version>/.

Configuration​

Add a react-native-executorch block to your package.json:

{
"react-native-executorch": {
"features": ["classification", "styleTransfer"]
}
}

Options​

OptionPurposeAccepted values
featuresHigh-level tasks — each automatically expands to the backends and libraries it needs"classification", "imageEmbeddings", "inpainting", "instanceSegmentation", "keypointDetection", "llm", "multimodalLLM", "objectDetection", "ocr", "privacyFilter", "segmentAnything", "semanticSegmentation", "speechToText", "styleTransfer", "textEmbeddings", "textToImage", "textToSpeech", "tokenizer", "translation", "vad", "verticalOCR"
backendsHardware acceleration backends directly"xnnpack", "coreml", "mlx", "vulkan", "qnn"
libsExtra native C++ libraries"opencv", "phonemis"

The three lists are merged, so you can pair high-level features with specific backends or libs. Re-run your package manager install after editing.

Monorepos

The block is read from the directory the install was run in, then from every package.json above the installed package. A hoisted workspace resolves to the root either way, so put the block there; an app that keeps its own node_modules (pnpm, nohoist) is found from its own package.json. node_modules/react-native-executorch/rne-build-config.json records what was actually resolved, and the install log names the manifest it read.

pnpm, bun and npm 12

pnpm 10 and later, bun, and npm 12 and later do not run dependency install scripts unless you allow them, so the download never happens and the native build fails later on a missing file. Install with --allow-build=react-native-executorch (pnpm 10.4+), run bun pm trust react-native-executorch (bun) or npm approve-scripts react-native-executorch (npm 12) once. See Troubleshooting.

Backends​

Hardware backends provide optimized execution kernels for specific processors and platforms. See the ExecuTorch Backends documentation for details on lowering and delegate compilation:

  • XNNPACK — High-efficiency floating-point and quantized neural network inference operators optimized for ARM and x86 CPUs. Supported on both Android and iOS.
  • Core ML — Apple's framework for hardware-accelerated machine learning on Apple Silicon, targeting the Apple Neural Engine (ANE) and GPU. Supported on iOS only.
  • MLX — An array framework designed for efficient machine learning on Apple silicon via Metal compute shaders, used primarily for accelerated LLM generation. Supported on iOS only (physical device only, no simulator).
  • Vulkan — Cross-platform 3D graphics and compute API, leveraging mobile GPUs on Android only for accelerated neural network inference and tensor compute operations.
  • QNN — Qualcomm AI Engine Direct, running models on the Hexagon NPU of Snapdragon 8 Gen 1 and newer (SM8450, SM8475, SM8550, SM8650, SM8750, SM8845, SM8850). Android arm64 only, and opt-in: it is never enabled by default and no feature expands to it, so add "qnn" to backends explicitly. See QNN below.

Third-Party Libraries​

  • OpenCV — High-performance computer vision library providing image transformations, color space conversions, resizing, and pixel format operations (used by vision pipelines and multimodal LLMs). Provided on iOS via CocoaPods and on Android as static prebuilt libraries.
  • phonemis — High-performance C++ library for Grapheme-to-Phoneme (G2P) conversion, delivering universal IPA phonemization as the frontend for Text-to-Speech pipelines. Compiled from source on both Android and iOS when enabled.

Features​

Specifying a task under features is shorthand: it automatically expands to the union of backends and native libraries required by the pre-exported models in that domain.

FeatureExpanded BackendsExpanded Extra Libs
llmxnnpack, mlx, vulkan—
multimodalLLMxnnpack, mlx, vulkanopencv
privacyFilterxnnpack, mlx—
speechToTextxnnpack, coreml, mlx, vulkan—
textToSpeechxnnpack, coreml, mlx, vulkanphonemis
vadxnnpack—
translationxnnpack, mlx—
textEmbeddingsxnnpack, coreml, mlx, vulkan—
imageEmbeddingsxnnpack, coreml, mlx, vulkanopencv
classificationxnnpack, coremlopencv
depthEstimationxnnpack, coreml, vulkanopencv
objectDetectionxnnpack, coreml, vulkanopencv
keypointDetectionxnnpack, coreml, vulkanopencv
semanticSegmentationxnnpack, coreml, vulkanopencv
instanceSegmentationxnnpack, coreml, vulkanopencv
ocrxnnpack, coreml, vulkanopencv
verticalOCRxnnpackopencv
styleTransferxnnpack, coreml, vulkanopencv
textToImagexnnpack, coreml, vulkanopencv
inpaintingxnnpack, coreml, vulkanopencv
segmentAnythingxnnpack, coreml, vulkanopencv
tokenizer——

QNN​

Enabling qnn links the ExecuTorch QNN backend and adds Qualcomm's runtime (com.qualcomm.qti:qnn-runtime) from Maven. A QNN model is compiled for one Hexagon version, so each QNN variant is published once per version and the registry resolves it to the device's file. On any other device, or when the requirements below are not met, DEFAULT falls back to the next backend.

The Hexagon DSP loads Qualcomm's skel libraries from disk, so the app has to extract its native libraries. In android/app/build.gradle:

android {
packaging {
jniLibs {
useLegacyPackaging = true
// Not needed for the precompiled models the registry ships.
excludes += ['**/libQnnHtpPrepare.so', '**/libQnnGpu.so', '**/libQnnDsp*.so', '**/libQnnHtpV68*.so']
}
}
}

Binary size​

Approximate size each backend adds to a release arm64 build:

BackendAndroidiOS
xnnpack+1.7 MB+1.4 MB
coreml—+0.4 MB
mlx—+6.0 MB
vulkan+10.3 MB—
qnn+92 MB¹—

¹ Uncompressed, with the excludes shown in QNN; 202 MB without them.