tract
Library Listed
Tiny, no-nonsense, self contained, TensorFlow and ONNX inference
- Downloads
- 24,404
- Dependents
- 114
- Stars
- 3,113
- Forks
- 297
- Contributors
- 107
- Commits
- 11,096
- Latest release
- 0.23.10 ·
About

Sonos' neural-network inference engine.
tract loads ONNX and NNEF models, optimises them, and runs them anywhere — from embedded ARM CPUs to NVIDIA / Apple GPUs, in the browser via WebAssembly, or on a Linux / macOS / Windows workstation. It is used in production at Sonos for wake-word and streaming speech-recognition workloads, and also runs LLM, text-to-image, and classical CV models with a particular focus on the translate-once / ship-tiny-runtime story enabled by its NNEF-based intermediate format (tract-OPL).
Quick start
From examples/onnx-mobilenet-v2:
use tract::prelude::*;
tract::impl_ndarray_interop!();
let model = tract::onnx()?
.load("mobilenetv2-7.onnx")?
.into_model()?;
// prepare() optimises and compiles the model for the chosen runtime
let runtime = tract::runtime_for_name("default")?;
let runnable = runtime.prepare(model)?;
let result = runnable.run([input.tract()?])?;
The tract crate (api/rs/src/lib.rs) is the authoritative public API. The
internal crates (tract-core, tract-nnef, tract-onnx, ...) are not
stable surface and shouldn't be depended on directly.
For Python, see the tract package on PyPI.
Read the full README
Examples
examples/ has runnable demos covering the workloads tract
targets today:
| Example | What |
|---|---|
onnx-mobilenet-v2 | Minimal CV starter |
tflite-mobilenet-v3 | TFLite import path |
causal_llm | Transformer text generation |
nemo-parakeet-asr / nemo-nemotron-streaming-asr | Speech recognition, including streaming via pulsification |
stable-diffusion / stable-diffusion-3 / stable-diffusion-xl | Text-to-image |
face_detection_yolov8onnx_example / face_similarity_arcface_onnx | Modern object detection / face recognition |
wasm-model-bench | Running tract in the browser |
Resources
Technical documentation lives under doc/ (start at doc/intro.md);
the doc/cli-recipe.md page collects practical CLI recipes.
The Sonos engineering blog
has a long-form post on tract internals.
Python
tract is also available as the tract package on PyPI,
built on top of the same Rust core:
pip install tract
The API mirrors the Rust pipeline: load a model, set input facts, optimise, then run.
Documentation: sonos.github.io/tract. Source lives in api/py/.
Runtimes
| Runtime | Name | Crate | Notes |
|---|---|---|---|
| CPU (x86, ARMv6/7/8, ARM SVE) | "default" | tract-linalg | Default. Hand-rolled SIMD micro-kernels. |
| Apple Metal | "metal" | tract-metal | Apple GPUs. |
| NVIDIA CUDA | "cuda" | tract-cuda | NVIDIA GPUs. |
| WebAssembly | "default" | via standard wasm32 targets | Browser / WASI deployment. |
All runtimes share the TypedModel IR and the same loaders, so a model
optimised on one platform can be moved to another.
Benchmarks
Every night, main is benchmarked on a fleet of devices — Cortex-A7 to
Cortex-A55 boards, RISC-V boards, x86 and Apple desktops, NVIDIA and Apple
GPUs, and WebAssembly — over wake-word, speech recognition, speech
enhancement, vision and LLM models. The bench page
tracks every model on every device. A few of the trends:
| Model | Target | Speed | Trend |
|---|---|---|---|
| GTCRN speech enhancement | Cortex-A55 | 12.1× since Aug 2026 | |
| MobileNet v2, multi-thread | Cortex-A53 | 3.2× since Aug 2026 | |
| Parakeet TDT 0.6B preprocessor | Intel i9-11900KB | 14.7× since Jun 2026 | |
| Llama 3.2 3B text generation | Apple M1 Max, Metal | 1.8× since Apr 2025 |
Speed is relative to the first week of each series, dashed line at 1×.
doc/bench/sparklines.py regenerates the charts.
Streaming and pulsification
tract has first-class support for pulsified inference: a network that operates on full sequences during training is translated into one that processes a fixed-size pulse along its streaming axis at each step. This lets the same model serve both batch evaluation and low-latency real-time inference (wake-word, streaming ASR, ...).
The translate-time logic lives in tract-pulse; runtime ships only the
small tract-pulse-opl crate. See
doc/overview.md § Streaming and pulsification
for the engineering view, and
examples/nemo-nemotron-streaming-asr
for a working demo.
Formats and tract-OPL
| Format | Load | Save |
|---|---|---|
| ONNX | ✓ | — |
| NNEF (+ tract-OPL extensions) | ✓ | ✓ |
| TensorFlow Lite (legacy) | ✓ | ✓ |
| TensorFlow 1 frozen graph (legacy) | ✓ | — |
PyTorch models can be exported directly to NNEF using torch-to-nnef (source), an open-source PyTorch-to-NNEF converter maintained alongside tract — useful when you want to skip the detour through ONNX.
tract-OPL is an NNEF-compatible intermediate representation that extends NNEF with the operators needed to express a full tract-core model. The recommended deployment workflow is:
- Once, at build time: convert from ONNX / TF / TFLite to NNEF using
the
tractCLI:tract model.onnx dump --nnef model.nnef.tgz - At runtime: ship only
tract-core+tract-nnef, plustract-onnx-oplif the model uses ONNX-only operators, andtract-pulse-oplif it is pulsified.
This keeps the runtime footprint small (no protobuf, no training-framework
loaders). See doc/intro.md for the full design rationale.
tract-OPL stability
NNEF parts are tied to the NNEF specification and very stable. tract-OPL extensions are a bit more in flux, but we observe the rule:
A model serialised with tract
0.x.yshould work with tract0.x.zwherez >= y.
Models embed a tract_nnef_ser_version property identifying the generating
tract version; tract itself does not enforce a version check, so it is up
to the application to do so if needed. See CHANGELOG.md
for the running list of notable serialisation-format changes.
TensorFlow 1 (legacy)
tract still loads TF1 frozen graphs and supports the operator set needed for the classical CV and wake-word models that originally drove its design (Inception v3, Snips wake words, ...). TensorFlow 2 is not directly supported — convert to ONNX first.
License
Files in tensorflow/protos are copied from the
TensorFlow project and files in
onnx/protos from the ONNX project; neither
is covered by the licence statement below.
Apache 2.0 / MIT
All original work is licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any Contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Compatibility
- Runs on
- CUDA, WebGPU, Metal
What shows it
- CUDA: tract feature cuda, tract-cuda dependency cudarc, tract-libcli feature cuda (dependency cudarc)
- WebGPU: tract feature wgpu (dependency wgpu)
- Metal: tract feature metal, tract-ffi feature metal, tract-libcli feature metal, tract-metal dependency metal
- Native code
- Build tool
- Build uses a native toolchain: cc
- Python bindings
- No Python binding crate found
- License
- Apache-2.0 OR MIT
Compare with similar projects
Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.
| Project | Downloads | Dependents | Stars | Latest release | Runs on (GPU) | Native code | License |
|---|---|---|---|---|---|---|---|
|
Tiny, no-nonsense, self contained, TensorFlow and ONNX inference |
24,404 downloads over 30 days | 114 | 3,113 | 0.23.10 | CUDA, WebGPU, Metal | Build uses a native toolchain: cc | Apache-2.0 OR MIT |
|
ort Featured
A safe Rust wrapper for ONNX Runtime 1.31 - Optimize and accelerate machine learning inference & training |
3,902,768 downloads over 30 days | 694 | 2,611 | 2.0.0-rc.15 | CUDA, WebGPU, ROCm | Binds native code: onnxruntime, ort-sys. Build uses a native toolchain: pkg-config (feature pkg-config) | Apache-2.0 OR MIT |
|
oxionnx Listed
Pure Rust ONNX inference engine — zero C/C++ dependencies |
550 downloads over 30 days | 24 | 20 | 0.1.7 | CUDA, WebGPU | No native code found | Apache-2.0 |
|
Efficent platform for inference and serving local LLMs including an OpenAI compatible API server. |
138 binary downloads per release | Not applicable | 739 | Not measured | Not measured | MIT | |
|
NobodyWho is an inference engine that lets you run LLMs locally and efficiently on any device. |
34 binary downloads per release | Not applicable | 1,672 | Not measured | Not measured | EUPL-1.2 | |
|
Inference server for LLMs, speech and embeddings: OpenAI-compatible routes with streaming, plus speech synthesis (TTS) and transcription (ASR). Serves Llama, Mistral, Qwen, Mamba2, MLA+MoE and hybrid models from SafeTensors, AWQ, GPTQ and GGUF. |
8 binary downloads per release | Not applicable | 7 | 0.7.1 | CUDA, WebGPU | Binds native code: ring (feature distributed) | Apache-2.0 |
|
Run ONNX and TensorFlow inference in the browser. |
0 binary downloads per release | Not applicable | 76 | Not measured | Not measured | Not measured |
Why ListedNo archive, New or Featured rule places it, so it is Listed.
What it lacks for Featured
- Docs are missing: the primary crate publishes no README.
What else the check found
- The last activity is on 7 Nov 2026, 2 days ago. The rules expect an update within 900 days. Dormancy rule
Check notes
- the latest release was packaged from a dirty working tree
Exact rules: Listed, Featured library. The check on applied thresholds version 9.
Every rule outcome, as the check records it
expected-interval: version 0.23.10 base 450, doubled for 63 active users: E = 900 daysdormancy: last activity 2026-11-07, 2 days ago, E = 900: activefeatured: not featured: docs missinglisted: listed: no archive, new or featured rule applies
Crates21 crates
Measurements and sources
Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.
Sources6 sources
- Description: the crates.io description
- crates.io database dump, fetched
- RustSec advisory database, fetched
- GitHub repository, fetched
- crates.io package, fetched
- GitHub contributors, fetched
Adoption63 active dependents, 59 new dependents in 365 days1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | 63 | crates.io database dump | Yes | |
| New dependents (365 days) | 59 | crates.io database dump | Yes | |
| Peak active dependents | 62 | crates.io database dump | Yes | |
| Active dependents as a share of the peak | 1 | crates.io database dump | Yes | |
| Binary downloads per release | Not measured | Yes |
MaintenanceLatest human commit: 2 days ago3 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2026-11-07 | GitHub repository | Yes | |
| Latest release | 2026-11-05 | crates.io database dump | Yes | |
| First release | 2018-11-02 | crates.io database dump | Yes | |
| Latest version | 0.23.10 | crates.io database dump | Yes | |
| Days the oldest outside issue waits for a reply | 100 | GitHub repository | Yes | |
| Maintainer replies over 365 days | 48 | GitHub repository | Yes | |
| Repository archived | false | GitHub repository | Yes | |
| Repository gone | false | GitHub repository | Yes | |
| Release commit or manifest in the repo | true | crates.io package | Yes | |
| Published docs | false | crates.io database dump | Yes | |
| Latest release fails cargo check | Not measured | Yes | ||
| Build check date | Not measured | Yes | ||
| Build check toolchain | Not measured | Yes |
SecurityUnpatched vulnerabilities: none
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Unpatched vulnerabilities past the grace window | none | RustSec advisory database | Yes | |
| RustSec unmaintained advisory | none | RustSec advisory database | Yes | |
| Deprecation notice | none | crates.io database dump | Yes | |
| Deprecated requirement | none | crates.io database dump | Yes |
Distribution157 releases, 24,404 downloads over 30 days5 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | 157 | crates.io database dump | Yes | |
| Downloads over 30 days | 24404 | crates.io database dump | Yes | |
| Binary downloads over the last 3 releases | Not measured | Yes | ||
| Homebrew installs on request over 365 days | Not measured | Yes | ||
| Repology repository families | Not measured | Yes | ||
| Docker pull growth over 90 days | Not measured | Yes | ||
| Docker pulls at the growth baseline | Not measured | Yes | ||
| Every version a prerelease | false | crates.io database dump | Yes | |
| Every version 0.0.x | false | crates.io database dump | Yes | |
| Every version yanked | false | crates.io database dump | Yes | |
| Crate deleted from crates.io | false | crates.io database dump | Yes |
Repository3,113 stars, 297 forks, 107 contributors, 11,096 commits. Stars alone never qualify a project.
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 3113 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 297 | GitHub repository | Yes — one part of the repository route | |
| Contributors with a GitHub account | 107 | GitHub contributors | Yes — one part of the repository route | |
| Commits on the default branch | 11096 | GitHub repository | No | |
| Repository's main crate left out of the entry | none | crates.io database dump | Yes |
Facts that never count
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| License | Apache-2.0 OR MIT | crates.io database dump | No | |
| Runs on, from listed crates and their direct dependencies | CUDA, WebGPU, Metal | crates.io database dump | No | |
| What shows each backend | CUDA: tract feature cuda, tract-cuda dependency cudarc, tract-libcli feature cuda (dependency cudarc); WebGPU: tract feature wgpu (dependency wgpu); Metal: tract feature metal, tract-ffi feature metal, tract-libcli feature metal, tract-metal dependency metal | crates.io database dump | No | |
| Native code, from listed crates and their dependencies | Build uses a native toolchain: cc | crates.io database dump | No | |
| Python bindings, from direct dependencies of listed crates | No Python binding crate found | crates.io database dump | No | |
| Crates that depend on a listed crate directly | 114 | crates.io database dump | No |
Corrections and review history
No correction applies to this entry.
Judgments
A judgment enters only through an approved issue and a merged pull request.
No judgment applies to this entry.