license last-commit repo-language-count repo-top-language Discord


Supporting AI innovation from ideation to results.

⚠️ Zigrad is undergoing a rewrite Public release tentatively planned for mid 2026 please stay tuned.

🚧 Zigrad is under active development.
By using Zigrad, you are participating in its development and contributing to its early testing and validation. Expect APIs to change and features to evolve rapidly. Bug reports, benchmarks, and contributions are welcome.

🧪 CUDA support is experimental.
CUDA integration is in beta and may be incomplete, unstable, or suboptimal. Use it for testing and feedback. Full GPU support is actively being developed.

AI frameworks optimized for rapid research iteration do not seamlessly transition into the infrastructure required for large-scale training. This fragmented pipeline creates redundant engineering effort and slows iteration cycles. Zigrad provides a path to performance that preserves the natural development workflow researchers prefer; bridging research and engineering. Using Zigrad you can:

https://github.com/user-attachments/assets/3842aa72-9b16-4c25-8789-eac7159e3768

Fast

2.5x+ speedup over a compiled PyTorch model on Apple Silicon, 1.5x on x86. Expect similar performance gains across more architectures and platforms as MKL/CUDA support improves and Zigrad's ML graph compiler is operational.

Description of the image

*Tensorflow excluded for scaling purposes (too slow).

Flexible Zigrad supports research workflows with high level abstractions for rapid prototyping, and integrations like Tensorboard and Mujoco. Zigrad supports the transition of research code to training infrastructure.

Zigrad supports research through,

Zigrad supports engineering through,

Features

Trace the Computation Graph

An example of tracing the computation graph generated by a fully connected neural network for MNIST.

We did not have to use Zigrad's modules to write this network at all, as Zigrad is backed by a capable autograd engine. Even when using the autograd backend to dynamically construct the same neural network Zigrad can still trace the graph and render it.

Note: Since the graph is generated from the autograd information, we set the labels for the nodes by naming the tensors for the sake of the diagram.

Getting Started

Only dependency is a BLAS library.

Linux

On linux (or intel mac) you have some options,

Apple Silicon

Examples

The examples/ directory has some standalone templates you can take and modify, the zon files are pinned to commit hashes.

Hello world example shows how to run a backward pass using the GraphManager. Note that in this very simple example, we do not need the GraphManager and the script could be simplified but this is designed to get you familiar with the workflow.

git clone https://github.com/Marco-Christiani/zigrad/
cd zigrad/examples/hello-world
zig build run

Run the mnist demo

cd zigrad/examples/mnist
make help
make

Roadmap

A lot is planned and hoping for support from the Zig community so we can accomplish some of the more ambitious goals.

Known Issues and Limitations

Contributing