Burn is a next generation tensor library and Deep Learning Framework that doesn't compromise on flexibility, efficiency and portability.
Burn is a next generation tensor library and Deep Learning Framework that doesn't compromise on flexibility, efficiency and portability.
| Category | Project | Description |
|---|---|---|
| Compute | CubeCL | GPU compute language and compiler behind Burn's accelerated backends. Write kernels once in Rust, run on CUDA, ROCm, Metal, Vulkan and WebGPU. Usable standalone. |
| Model interop | burn-onnx | Import ONNX models into Burn as native Rust code |
burn-store |
Save, load and import model weights, including PyTorch and Safetensors | |
| Domains | burn-vision |
Computer vision operators and building blocks |
burn-rl |
Reinforcement learning building blocks | |
burn-dataset |
Dataset loading, transforms and ready-made sources | |
| Models | models | Curated pre-trained models and examples built with Burn |
| Tooling | burn-bench | Benchmark and compare backends, tracking performance over time |
Burn's CubeCL backends (CUDA, ROCm, Metal, Vulkan, WebGPU,
CPU) compose with autodiff, fusion and remote-execution decorators, while external and simpler
backends (LibTorch and pure-Rust CPU/no_std) compose with autodiff only. See
Supported Backends below for the full matrix.
Every project here is open-source and actively developed. Want to help build the Rust AI ecosystem? The good first issues are a great place to start, and the Contributing guide will get you set up.
Community crates 🌱These crates are not maintained by Tracel, but they are part of the same Rust AI story. Anything that helps you load data, build environments, or ship models belongs here. Built something that fits? Open a PR to add it!
| Category | Crate | Description |
|---|---|---|
| Data & loading | polars | Fast DataFrames for tabular data |
| arrow-rs | Apache Arrow columnar memory format | |
| image | Image decoding, encoding and processing | |
| hf-hub | Download models and datasets from the Hugging Face Hub | |
| Tokenization & NLP | tokenizers | Fast, production-ready tokenizers |
| rust-bert | Ready-to-use NLP pipelines and transformer models | |
| Numerical & linear algebra | ndarray | N-dimensional arrays |
| nalgebra | Linear algebra | |
| Classical ML | linfa | Classical ML toolkit, in the spirit of scikit-learn |
| smartcore | Classical ML algorithms, no BLAS/LAPACK required | |
| Inference & runtimes | candle | Minimalist ML framework with a focus on LLM inference |
| mistral.rs | Fast, multimodal LLM inference engine | |
| ort | ONNX Runtime bindings for hardware-accelerated inference | |
| tract | Pure-Rust inference for ONNX and NNEF models | |
| wonnx | 100% Rust, WebGPU-accelerated ONNX runtime for native and the web | |
| LLM apps & RAG | rig | Build modular LLM applications and agents |
| langchain-rust | LangChain-style chain orchestration | |
| Embeddings & vector search | fastembed | Generate text embeddings and rerank locally |
| qdrant | Vector search engine, written in Rust | |
| lancedb | Embedded, developer-friendly vector database | |
| Computer vision | kornia-rs | Low-level 3D computer vision library |
| Simulation & environments | rapier | Physics engine for robotics and RL environments |
| Visualization | rerun | Multimodal data and CV/robotics visualization |
| plotters | Plotting and charting |
Most backends support all operating systems, so we don't mention them in the tables below.
GPU Backends:
| CUDA | ROCm | Metal | Vulkan | WebGPU | LibTorch | |
|---|---|---|---|---|---|---|
| Nvidia | ☑️ | - | - | ☑️ | ☑️ | ☑️ |
| AMD | - | ☑️ | - | ☑️ | ☑️ | ☑️ |
| Apple | - | - | ☑️ | - | ☑️ | ☑️ |
| Intel | - | - | - | ☑️ | ☑️ | - |
| Qualcom | - | - | - | ☑️ | ☑️ | - |
| Wasm | - | - | - | - | ☑️ | - |
CPU Backends:
| Cpu (CubeCL) | Flex | LibTorch | |
|---|---|---|---|
| X86 | ☑️ | ☑️ | ☑️ |
| Arm | ☑️ | ☑️ | ☑️ |
| Wasm | - | ☑️ | - |
| no-std | - | ☑️ | - |
Note: The LibTorch backend is deprecated as of
0.22.0and will be removed in a future release. For GPU acceleration, use a CubeCL backend (CUDA, ROCm, Metal, Vulkan, WebGPU). For CPU execution, use the CubeCL CPU backend orburn-flex.
Compared to other frameworks, Burn has a very different approach to supporting many backends. By design, most code is generic over the Backend trait, which allows us to build Burn with swappable backends. This makes composing backend possible, augmenting them with additional functionalities such as autodifferentiation and automatic kernel fusion.
Autodiff: Backend decorator that brings backpropagation to any backend 🔄Contrary to the aforementioned backends, Autodiff is actually a backend decorator. This means that it cannot exist by itself; it must encapsulate another backend.
The simple act of wrapping a base backend with Autodiff transparently equips it with autodifferentiation support, making it possible to call backward on your model.
use burn::backend::{Autodiff, Wgpu};
use burn::tensor::{Distribution, Tensor};
fn main() {
type Backend = Autodiff<Wgpu>;
let device = Default::default();
let x: Tensor<Backend, 2> = Tensor::random([32, 32], Distribution::Default, &device);
let y: Tensor<Backend, 2> = Tensor::random([32, 32], Distribution::Default, &device).require_grad();
let tmp = x.clone() + y.clone();
let tmp = tmp.matmul(x);
let tmp = tmp.exp();
let grads = tmp.backward();
let y_grad = y.grad(&grads).unwrap();
println!("{y_grad}");
}Of note, it is impossible to make the mistake of calling backward on a model that runs on a backend that does not support autodiff (for inference), as this method is only offered by an Autodiff backend.
See the Autodiff Backend README for more details.
Fusion: Backend decorator that brings kernel fusion to all first-party backendsThis backend decorator enhances a backend with kernel fusion, provided that the inner backend
supports it. Note that you can compose this backend with other backend decorators such as Autodiff.
All first-party accelerated backends (like WGPU and CUDA) use Fusion by default (burn/fusion
feature flag), so you typically don't need to apply it manually.
#[cfg(not(feature = "fusion"))]
pub type Cuda<F = f32, I = i32> = CubeBackend<CudaRuntime, F, I, u8>;
#[cfg(feature = "fusion")]
pub type Cuda<F = f32, I = i32> = burn_fusion::Fusion<CubeBackend<CudaRuntime, F, I, u8>>;Of note, we plan to implement automatic gradient checkpointing based on compute bound and memory bound operations, which will work gracefully with the fusion backend to make your code run even faster during training, see this issue.
See the Fusion Backend README for more details.
Remote (Beta): Backend decorator for remote backend execution, useful for distributed computationsThat backend has two parts, one client and one server. The client sends tensor operations over the network to a remote compute backend. You can use any first-party backend as server in a single line of code:
fn main_server() {
// Start a server on port 3000.
burn::server::start::<buDevice::enumerate(DeviceType::Metal/Vulkan/WebGpu) and BURN_DEVICE don't pin the graphics API
PositionWiseFeedForward skips learnable activation parameters during training and checkpointing
BatchNorm accepts invalid feature count, epsilon, and momentum
tensor: finish backend generic removal (docs, device priority, third-party backends)
Apparent system memory leak on simple training task using WGPU backend
vision: GPU connected_components never runs, plane-size gate rejects every device
tensor: add NaN-ignoring reductions (nan_max, nan_min, ...)
train: add GPU utilization and memory metrics for non-NVIDIA GPUs
cpu: repeat_dim on an outer dim of size 1 leaves zeros
cuda: Linear with column-major weights gives wrong results