Skip to main content
Version: Next

Native Libraries

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

By default, everything 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", "instanceSegmentation", "keypointDetection", "llm", "multimodalLLM", "objectDetection", "ocr", "privacyFilter", "segmentAnything", "semanticSegmentation", "speechToText", "styleTransfer", "textEmbeddings", "textToImage", "textToSpeech", "tokenizer", "vad", "verticalOCR"
backendsHardware acceleration backends directly"xnnpack", "coreml", "mlx", "vulkan"
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

pnpm 10 and later do not run dependency build scripts unless you allow them, so the download never happens and the native build fails later on a missing file. Run pnpm approve-builds react-native-executorch 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.

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—
textEmbeddingsxnnpack, coreml, mlx, vulkan—
imageEmbeddingsxnnpack, coreml, mlx, vulkanopencv
classificationxnnpack, coremlopencv
objectDetectionxnnpack, coreml, vulkanopencv
keypointDetectionxnnpack, coreml, mlx, vulkanopencv
semanticSegmentationxnnpack, coremlopencv
instanceSegmentationxnnpack, coreml, vulkanopencv
ocrxnnpack, coreml, vulkanopencv
verticalOCRxnnpackopencv
styleTransferxnnpack, coreml, vulkanopencv
textToImagexnnpack, coreml, vulkanopencv
segmentAnythingxnnpack, coreml, vulkanopencv
tokenizer——

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—