gitwtfhub

tracel-ai/burn

15,215RustAudience · researcherComplexity · 5/5ActiveLicenseSetup · hard

TL;DR

Burn is a deep learning framework in Rust with a pluggable Backend trait so the same model code runs on CUDA, ROCm, Metal, Vulkan, WebGPU, or CPU.

Mindmap

mindmap
  root((Burn))
    Inputs
      Tensors
      Model code
      Training data
    Outputs
      Trained models
      Inference results
      Fused kernels
    Use Cases
      Train neural nets
      Edge inference
      Cross-platform ML
    Tech Stack
      Rust
      CUDA
      WebGPU
      LibTorch
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why anyone would actually build this

REASON 1

Train a neural network in Rust that targets both CUDA and CPU backends

REASON 2

Deploy a Burn model to WebAssembly for in-browser inference

REASON 3

Build an embedded ML pipeline that runs on no-std hardware

REASON 4

Port a small PyTorch model to Burn and benchmark fused-kernel performance

Stack

RustCUDAWebGPUMetalWebAssembly

Spinning it up

Difficulty · hard Time to first run · 1h+

GPU backends need vendor toolchains (CUDA, ROCm, or Metal) installed before any accelerated example will compile and run.

Dual MIT and Apache 2.0 license, you can use, modify, and redistribute it freely with attribution.

Wtf does this do

Burn is a deep learning framework and tensor library written in Rust. A tensor is the basic data type used in machine learning, a multi-dimensional array of numbers. A deep learning framework gives you the tools to build, train, and run neural networks on top of those tensors. PyTorch and TensorFlow are the two best-known frameworks, Burn is in the same category but is built around Rust rather than Python. A central design choice is that Burn is generic over what it calls the Backend trait. The same model code can run on many different pieces of hardware without rewriting it. The README lists supported GPU backends including CUDA for Nvidia, ROCm for AMD, Metal for Apple, Vulkan, WebGPU, and LibTorch as a bridge to the PyTorch C++ runtime. CPU backends include a CubeCL-based path for x86 and ARM, a backend called Flex that also targets WebAssembly and no-std, and the LibTorch CPU path. Backends can be wrapped with decorators that add capabilities. Autodiff adds automatic backpropagation, the math step that lets a model learn from its mistakes, a short Rust example in the README shows how wrapping the Wgpu backend with Autodiff makes the backward call available. Fusion is another decorator that merges many small GPU operations into a single fused kernel for speed, and it is enabled by default on accelerated backends. A Router decorator can split work across multiple backends so some operations run on the CPU and others on the GPU. A Remote decorator has a client-server split that sends tensor operations to a remote compute machine over a network connection. Burn is designed to cover both training and inference. The README mentions an ergonomic dashboard for monitoring training progress and says models can be deployed everywhere from embedded devices to large GPU clusters. It also says the transition from training to deployment requires no code changes, unlike some Python frameworks. The project is maintained by tracel-ai under the MIT and Apache 2.0 licenses, with a Discord server, documentation at burn.dev/docs/burn, and a Crates.io release for the burn crate.

Yoink these prompts

Prompt 1
Write a Burn example that trains a small MLP on the Wgpu backend wrapped with Autodiff
Prompt 2
Show me how to swap the Burn backend from Wgpu to CUDA without changing the model code
Prompt 3
Give me a Cargo.toml that sets up Burn for WebAssembly inference and a hello-world tensor op
Prompt 4
Explain the Router decorator in Burn and write an example that splits ops across CPU and GPU
Prompt 5
Compare Burn and Candle for a Rust-native inference server and tell me which to pick for ONNX models
View the repo → Decode another repo

← tracel-ai on gitmyhub — every repo by this author, as a profile.

Don't trust strangers blindly. Verify against the repo.