tinygrad combines an eager tensor library with autograd, a fusing compiler, JIT execution, and modules for neural network training. It supports many hardware accelerators.
Overview
tinygrad is an end-to-end deep learning stack meant to sit between larger frameworks and minimal teaching libraries. It provides tensors with autograd, an intermediate representation and compiler that fuse and lower kernels, JIT plus graph execution, and nn, optim, and dataset pieces for real training loops.
The design draws on familiar eager tensor ergonomics, functional IR-based automatic differentiation, and multi-pass scheduling with beam search over kernels. Lazy evaluation can fuse operations such as matrix multiplies into single kernels, and debug modes expose generated code for inspection.
Hardware support includes OpenCL, CPU, Metal, CUDA, AMD, NV, Qualcomm, and WebGPU backends, with the expectation that new accelerators need only a small set of low-level ops. Install is currently recommended from source; documentation and a quick start are published with the project.
Compared with PyTorch, tinygrad offers similar training-loop ingredients while keeping the compiler and IR visible and editable. Example scripts train models such as MNIST classifiers; contributors are expected to benchmark claimed speedups and add tests for new behavior.
Key features
- Tensors with autograd
- IR compiler with kernel fusion
- TinyJit graph capture and replay
- nn, optim, and dataset modules
- Lazy execution and operator fusion
- Multiple accelerator backends
- Beam search kernel scheduling
- Torch-like training loop ergonomics
Use cases
- Experimental deep learning training
- Studying compiler and IR behavior
- MNIST and small model examples
- Multi-backend accelerator prototyping
- Hackable low-level ML stack research