A curated list of awesome Large Language Model (LLM), Machine Learning, and AI projects, libraries, and resources built with the Zig programming language.
Zig's performance, explicit memory management, and seamless C/C++ interoperability make it an exceptionally powerful tool for AI inference, tensor operations, and building fast, resource-efficient LLM tooling. This list tracks the growing ecosystem of Zig-based AI projects — from production-grade inference stacks to educational implementations built from scratch.
Contributions are welcome!
- Inference Engines
- Training & Autograd
- Bindings & Wrappers
- Tensors & Math
- Linear Algebra
- Tokenizers
- Tools & Applications
- Learning Resources
- Community
Native or highly optimized inference stacks written in or targeting Zig.
LLaMa2.zig (cgbur) — Inference for LLaMA 2 in a single file of pure Zig. Minimal and easy to read.
LLaMa2.zig (clebert) — Another pure-Zig LLaMA 2 inference implementation, focused on clarity and correctness.
gosslens — A from-scratch ONNX inference engine in pure Zig, inside a vision engine that runs models on live cameras, video and screens.
llm.zig — A clean, simple, and fast LLM implementation in Zig, starting with GPT-2. A notable port of Andrej Karpathy's
llm.c.mlx-serve — Native LLM inference server for Apple Silicon. OpenAI + Anthropic API compatible. No Python. Includes MLX Core macOS app with chat, agent mode, and tool calling.
zig-ml — LLM inference written from scratch in pure Zig, without any high-level ML libraries. Built to understand AI inference internals and optimize workloads for modest hardware. Heavily inspired by
llama2.c.ziggy-llm — Zig-native GGUF inference engine optimized for Apple Silicon with Metal support and a fast CLI runner.
ZigFormer — A transformer-based LLM implemented entirely in pure Zig. Explores how transformer architectures can be expressed using Zig's comptime and type system.
zig_gpt2 — A GPT-2 neural network inference engine written in Zig. Capable of running NanoGPT models.
ZINC — Zig INferenCe Engine for local LLM inference on AMD GPUs and Apple Silicon via Vulkan/Metal, with an OpenAI-compatible API and built-in chat UI.
ZML — High-performance, production-ready AI inference stack built in Zig. Designed for speed, safety, and easy deployment of LLMs across hardware targets.
Frameworks and libraries for training neural networks and computing gradients in Zig.
dnns-from-scratch-in-zig — A minimal, educational implementation of deep neural networks built bottom-up in Zig. Great for understanding what happens under the hood of ML frameworks.
Zant — An open-source, cross-platform SDK written in Zig for deploying neural networks on microcontrollers (ARM Cortex-M, RISC-V, x86). Imports, optimizes, and deploys models to constrained hardware. Supports quantization, pruning, and SIMD/GPU offloading.
zig-neural-networks — An annotated, from-scratch neural network library in Zig implementing a multi-layer perceptron (MLP) with backpropagation and SGD. Focused on readability and learning. Includes gradient checks and the MNIST dataset example.
Zigrad — A deep learning framework built on a tensor-valued autograd engine. Offers high-level PyTorch-like abstractions alongside low-level control. Benchmarks show 2.5× faster training than PyTorch on Apple Silicon and 1.5× faster on x86 CPU. Supports CUDA (experimental), MKL/OpenBLAS, and Tensorboard integration.
⚠️ Currently undergoing a rewrite; public release planned for mid-2026.
Zig bindings and wrappers for popular C/C++ machine learning frameworks and APIs.
gpt4all.zig — Zig build and terminal-based chat client for GPT4All models (~800k GPT-3.5-Turbo generations based on LLaMA). Features automatic model downloading and serves as a starting point for Zig apps with built-in LLM capabilities.
llama.cpp.zig — Full
llama.cppbindings and build utilities for Zig, targeting Zig 0.14.x. Provides ergonomic Zig-style wrappers overllama.h, including camelCase naming, prefix removal, and struct-grouped functions. Supports buildingllama.cppdirectly viazig build.MLX.zig — Zig bindings for Apple's MLX framework, with example LLM and Whisper runners for Apple Silicon.
ollama-zig — Zig client library for the Ollama API. Run and interact with locally-served LLMs via Ollama from pure Zig.
onnxruntime.zig — Experimental Zig wrapper for the ONNX Runtime, with working examples including Silero VAD (voice activity detection) and NSNet2 (noise suppression).
zig-llm — A Zig wrapper around cloud LLM APIs (OpenAI and compatible). Provides simple, idiomatic Zig interfaces for making LLM API requests.
Libraries for tensor operations, matrix multiplication, linear algebra, and SIMD-accelerated math essential for neural networks.
zgml — A tensor library for machine learning written in Zig, directly inspired by ggml. Aims to provide similar primitives with a more Zig-native API.
ZEIN — A Zig-based tensor library named for einsum notation. Planned support for full AVX SIMD and CUDA acceleration.
zensor — A lightweight Zig tensor library for building basic tensor computation graphs.
zigTensor — A fast, flexible machine learning library written entirely in Zig, inspired by the Flashlight library. Provides core tensor and tensor-ops functionality with ArrayFire as the backend. Autograd is in progress.
zten — A tensor library for Zig based on ggml. Provides a lightweight wrapper around ggml's C API with a Zig-friendly build system.
Vector math, matrix operations, and probability libraries — foundational building blocks for ML in Zig.
algae — A Zig math library focused on game development with a clean, concise API for vectors and matrices.
alg — Algebra utilities for Zig.
VecFns — Automatic vector math functions for Zig using comptime generics to generate SIMD-friendly operations.
zalgebra — A linear algebra library for games and real-time graphics, including vectors, matrices, and quaternions.
zlm — Zig linear mathematics: a simple, dependency-free vector and matrix math library.
zmath — A simple linear algebra library written in Zig, designed for clarity and ease of use.
zprob — A Zig library for probability distributions. Useful for statistical modelling and sampling in ML pipelines.
BPE, SentencePiece, and other tokenizer implementations written in Zig.
tokenizer (jaco-bro) — A BPE tokenizer implemented entirely in pure Zig. Supports multiple models (e.g., Phi-4, Qwen2.5-Coder) via CLI flags. Also pip-installable as a Python package (
tokenizerz) for cross-language use.tokeni.zig — A minimal Byte Pair Encoding tokenizer in Zig with a focus on learning tokenizer internals (particularly GPT-2 BPE). Aims to eventually support
from_pretrained-style loading from the Hugging Face Hub.llm-tokenizer-zig — A BPE tokenizer in pure Zig 0.15 (zero dependencies outside
std) that tokenizes text and calculates estimated costs across multiple LLM provider pricing tiers.
CLI tools, terminal clients, agents, and deployment utilities for LLMs built with Zig.
KrillClaw — A tiny Zig-based AI agent runtime for edge and embedded devices with multi-provider LLM support, tool execution, and MCP integration.
llmlite — A lightweight, high-performance LLM SDK & Edge Router written in Zig.
nl-veil — Open-source AI coding desktop app with parallel agents and persistent project memory. Local models, Ollama or cloud AI. Windows, macOS and Linux.
nullclaw — Self-described as the fastest, smallest, and fully autonomous AI assistant infrastructure written in Zig.
Séance — A Zig-built Linux terminal multiplexer that tracks AI coding agents and exposes a scripting API for automation.
zaica — A Zig AI coding assistant CLI with multi-provider support, tool calling, and an interactive REPL.
zig-llm (OpenAI client) — A dependency-free Zig client for OpenAI-compatible inference servers. Uses
std.httpandstd.jsonfor a minimal, arena-allocated HTTP client that fits in one.zigfile.ztk — A Zig CLI proxy that compresses shell output to cut LLM token usage while preserving errors and key details.
Tutorials, articles, blog posts, and guides on building AI/ML tools from scratch using Zig.
- A Single-File Zig Client for llama.cpp's OpenAI API Server — Demonstrates building a minimal, dependency-free Zig HTTP client for
llama.cpp's OpenAI-compatible server using onlystd.httpandstd.json. - Deep Neural Networks from Scratch in Zig (Hacker News) — HN discussion on implementing DNNs from scratch in Zig. The thread contains valuable insights on how Zig's comptime enables clean shape-checking that Python libraries have struggled with for years.
- High-Performance AI/LLM Implementation Ideas (Ziggit) — Community brainstorming thread on leveraging Zig's comptime and SIMD features for efficient LLM inference, including the DeepZig-V3 proposal.
- Zigrad: Deep Learning Faster Than PyTorch — Ziggit showcase post introducing Zigrad with benchmark comparisons showing 2.5× PyTorch speedup on Apple Silicon.
llm.c by Andrej Karpathy (C, not Zig — but the inspiration for many Zig ports) — The canonical reference implementation that spawned
llm.zig,zig-ml, and others. Essential reading for anyone porting AI workloads to low-level languages.
Places to discuss Zig AI/ML projects and connect with other developers.
- Ziggit — The official Zig community forum. The Showcase section regularly features new Zig ML/AI projects.
- Zig Discord — Official Zig Discord server with channels for project discussion.
- r/Zig — The Zig subreddit.
- Zig News — Official news from the Zig core team.
zigcc/awesome-zig — The broader Zig ecosystem list, which includes a Machine Learning section.
Your contributions are always welcome!
- Relevance — Ensure the project is directly related to LLMs, ML, or AI and uses Zig as a primary language (not just a wrapper with one
.zigfile). - Activity — Prefer projects that are actively maintained or historically significant. Clearly mark archived/unmaintained projects.
- Descriptions — Keep entries concise and objective. One sentence is ideal; two is the maximum. Don't editorialize.
- No duplicates — Search existing entries before submitting a Pull Request.
- Alphabetical order — Within each section, add entries in alphabetical order by project name.
- Format — Follow the existing
 **[Name](url)** — Description.format precisely.