▲ 564 today4.5k starsZigHN ×1
ZML runs any AI model on any accelerator, no rewrites
What is zml?
ZML is an open-source inference stack that compiles models directly to the instruction set of GPUs, CPUs and TPUs. You can pull a model from Hugging Face, compile it with Bazel, and run it on NVIDIA, AMD, Intel, or Google hardware without changing code.
Who it is for
Developers who need to ship the same model to diverse hardware can avoid maintaining separate codebases.
How zml works
ZML is an inference stack that separates model code from the underlying accelerator. It compiles models directly to the instruction set of NVIDIA CUDA, AMD ROCm, Intel OneAPI, Google TPU, or AWS Trainium using MLIR. The codebase is written in Zig and built with Bazel, which orchestrates the compilation and linking steps. At runtime it loads tensors from a virtual file system, maps them onto meshes, and executes the compiled kernels on the selected hardware.
What you can do with it
- Run the MNIST example to classify a random handwritten digit.
- Generate text with Llama 3.2, Qwen 3.5, or LFM 2.5 via the unified LLM CLI.
- Compile a model for a specific accelerator by setting the appropriate platform flag.
- Benchmark model loading and execution performance with the provided example.
Good to know
- You must have Bazel installed to build and run ZML.
- Only the listed accelerators are supported through explicit platform flags.
- LLM examples currently cover only Llama 3.1/3.2, Qwen 3.5, and LFM 2.5.
Written from the project's own README.
Try it in 60 seconds
You need: macOS or Linux with Bazel (via bazelisk); optional Hugging Face token for gated models
brew install bazeliskbazel run //examples/mnist
Apache-2.0 licenseUpdated todayZig67 open issues
New projects are not vetted. Skim the code, and run it in a fresh folder or a container before giving it your files or keys.
The story so far
Early Signal first spotted zml/zml on December 3, 2026, when it had 4.5k GitHub stars. It now has 4.5k. On its busiest day it gained 564 stars. It is published under the Apache-2.0 license and has 226 forks. It has been discussed in 1 Hacker News thread, the top one with 36 points. Early Signal files it under Inference.
Questions about zml
- Is zml free and open source?
- Yes. zml/zml is open source under the Apache-2.0 license, and the code is on GitHub at https://github.com/zml/zml.
- How do I install zml?
- Use one of these, depending on your setup: brew install bazelisk · bazel run //examples/mnist
- What do I need to run zml?
- macOS or Linux with Bazel (via bazelisk); optional Hugging Face token for gated models