Skip to main content
Version: 0.10.0

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.

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, coremlopencv
keypointDetectionxnnpack, coreml, mlxopencv
semanticSegmentationxnnpack, coremlopencv
instanceSegmentationxnnpack, coremlopencv
ocrxnnpack, coreml, vulkanopencv
verticalOCRxnnpackopencv
styleTransferxnnpack, coremlopencv
textToImagexnnpack, coremlopencv
segmentAnythingxnnpack, coremlopencv
tokenizer