ExecuTorch: PyTorch's On-Device AI Runtime
ExecuTorch is PyTorch's runtime for deploying trained models directly onto phones, wearables, and microcontrollers. It exports straight from torch.export() into a compact C++ runtime, skipping ONNX or TFLite conversion. Reach for it if you already train in PyTorch and want one export path across many hardware backends; skip it if your models live in TensorFlow or you need a longer track record outside Meta's own apps.
What is ExecuTorch?
ExecuTorch is PyTorch's runtime and toolchain for running trained models on-device, across phones, embedded boards, and microcontrollers, without porting them to another framework first. It captures a model graph with torch.export(), compiles it ahead of time into a .pte file, and runs that file through a lightweight C++ runtime with backends for chips from Apple, Qualcomm, Samsung, MediaTek, and ARM.
Core Capabilities for Deployment
- โNative export from torch.export() straight to a .pte file, with no intermediate ONNX or TFLite conversion step, so the model graph's structure survives the trip, per the README.
- โA 50KB base runtime footprint, small enough for microcontrollers as well as flagship phones.
- โ12+ hardware backends listed in the README, including XNNPACK, Apple CoreML, Qualcomm QNN, Samsung Exynos, MediaTek, Vulkan, and ARM Ethos-U for microcontrollers.
- โSwitch hardware targets by swapping one partitioner line, such as XnnpackPartitioner, CoreMLPartitioner, or QnnPartitioner, instead of re-exporting per chip.
- โQuantization support through torchao covering 8-bit and 4-bit precision, plus a dynamic mode, per the README.
- โDeveloper tooling: an ETDump profiler and an ETRecord inspector for looking inside a running .pte model.
- โSelective build strips unused operators to cut binary size, and custom operators let you add domain-specific kernels.
- โDynamic shapes are supported for models with variable input sizes within bounded ranges.
Real-World Applications and Supported Models
- โขShipping an LLM chat feature inside a mobile app: the README lists Llama 3.2, 3.1, and 3, Qwen 3, Phi-4-mini, and LiquidAI LFM2 as examples with working export scripts.
- โขRunning vision or speech models on-device, with MobileNetV2, DeepLabV3, YOLO26, and Whisper listed as example models in the repo.
- โขMultimodal apps that combine text with images or audio, using the Llava and Voxtral examples plus the MultiModal runner API.
- โขDeploying one trained PyTorch model across Android, iOS, and embedded Linux from a single export, switching only the partitioner.
- โขBuilding for microcontrollers or DSPs, where ARM Ethos-U, NXP, and Cadence DSP backends cover the embedded/MCU row in the platform table.
Getting Started with ExecuTorch
Install the Python package with `pip install executorch`. That's the entire command for the core package. Platform-specific setup for Android, iOS, or embedded targets isn't spelled out step by step in the README itself; it points to a separate Quick Start doc for that. Exporting a model needs `torch`, `executorch.exir`, and a backend-specific partitioner import, such as XnnpackPartitioner for CPU or CoreMLPartitioner for iOS, both shown in the README's own export snippet.
Deploying PyTorch Models On-Device
The flow the README shows has three steps. First, capture the model graph with torch.export.export() on an eval()'d model and example inputs. Second, call to_edge_transform_and_lower() with a chosen partitioner, then .to_executorch(), which quantizes, optimizes, and partitions the graph into a .pte file you write to disk. Third, load that .pte file on-device: the C++ Module API, Swift's Module class on iOS, or Kotlin's Module.load() on Android all call forward() the same way. For an LLM specifically, the README points to the export_llm script or Optimum-ExecuTorch's optimum-cli export executorch command, then running the result through a matching LLM runner API, such as create_llama_runner in C++ or TextRunner in Swift.
Strengths
- โExports straight from PyTorch with torch.export(), with no separate ONNX or TFLite conversion step to keep in sync with the training code.
- โA 50KB base runtime that scales down to microcontrollers, not just phones.
- โOne export can target 12+ different hardware backends by swapping a single partitioner argument.
- โAlready running in production at Meta's own apps and devices โ Instagram, WhatsApp, Quest 3, and Ray-Ban Meta Smart Glasses, per the README.
- โShips export scripts for current, real models โ Llama 3.2, 3.1, and 3, Qwen 3, Phi-4-mini, Whisper, YOLO26 โ rather than only toy demos.
Current Scope and Considerations
- โณThe README gives no version number or release cadence, so there's no documented way to gauge how mature any given snapshot is beyond the stated backend list.
- โณThe platform table already marks MPS deprecated on both iOS and macOS, and flags CUDA (Linux/Windows) and Metal (macOS) as experimental, so several backends in the matrix aren't production-ready yet.
- โณThe README's Quick Start doesn't walk through Android, iOS, or embedded setup end to end; it defers to a separate docs site for anything past the core pip install.
- โณThe repo's license field isn't a specific SPDX identifier in the facts available here; the README just says 'BSD licensed,' so check the exact terms in the LICENSE file before shipping a product.
- โณThe whole pipeline depends on torch.export() succeeding on your model graph first, and the README doesn't document what happens when a graph doesn't export cleanly.
Comparing On-Device ML Frameworks
Common Questions about ExecuTorch
ExecuTorch is released under a BSD license, per the README, which permits commercial use. Check the exact terms in the repository's LICENSE file before shipping a commercial product.
ExecuTorch covers the model categories the README names: LLMs, vision, speech, and multimodal, all using standard PyTorch APIs. Example export scripts exist for Llama, Qwen 3, Phi-4-mini, Llava, Voxtral, MobileNetV2, and Whisper.
ExecuTorch's README lists 12+ hardware backends, including XNNPACK, Apple CoreML, Qualcomm QNN, Samsung Exynos, MediaTek, Vulkan, ARM Ethos-U, NXP, and Cadence DSP, covering Android, iOS, Linux, Windows, macOS, and embedded/MCU targets.
ExecuTorch uses ahead-of-time compilation: it captures the model graph with torch.export(), then quantizes, optimizes, and partitions it into a .pte file before the model ever runs on-device, per the README.
ExecuTorch ships runtime APIs for C++, Swift on iOS, and Kotlin on Android, per the README, so an existing mobile app can load a .pte file and call forward() in whichever language it's already written in.
ExecuTorch describes itself in its own README as PyTorch's unified solution for on-device deployment. It's maintained under the pytorch GitHub organization and reuses the same PyTorch APIs used for training.
The problem it solves
Getting a trained PyTorch model onto a phone or a microcontroller usually means converting it to another format like ONNX or TFLite, hand-porting inference code to C++, and picking a hardware vendor's SDK you're then stuck with. ExecuTorch's README frames its own reason for existing around exactly that friction: keep the same PyTorch APIs from training through deployment, skip the conversion step, and avoid getting locked into one chip vendor's toolchain.
Who should try it โ and who should skip
Try ExecuTorch if you already train models in PyTorch and need to ship them on phones, wearables, or microcontrollers without maintaining a second conversion pipeline โ the one-export, multiple-backend flow and the C++/Swift/Kotlin runtime APIs are built for that handoff. Skip it if your models come from TensorFlow or another framework, since you'd be adding back the conversion step ExecuTorch exists to avoid for PyTorch users. Skip it too if you need a runtime with a long production track record outside Meta's own apps, since the README doesn't document independent adopters.
Related repositories
Is executorch worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of executorch.
