Skip to content

About

⚡ A curated list of awesome Large Language Model (LLM), Machine Learning, and AI projects, libraries, and resources built with the Zig programming language.

Topics

Resources

Stars

17 stars

Watchers

2 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

Awesome Zig LLM Awesome

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!


Contents


Inference Engines

Native or highly optimized inference stacks written in or targeting Zig.

  • Stars LLaMa2.zig (cgbur) — Inference for LLaMA 2 in a single file of pure Zig. Minimal and easy to read.
  • Stars LLaMa2.zig (clebert) — Another pure-Zig LLaMA 2 inference implementation, focused on clarity and correctness.
  • Stars gosslens — A from-scratch ONNX inference engine in pure Zig, inside a vision engine that runs models on live cameras, video and screens.
  • Stars llm.zig — A clean, simple, and fast LLM implementation in Zig, starting with GPT-2. A notable port of Andrej Karpathy's llm.c.
  • Stars 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.
  • Stars 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.
  • Stars ziggy-llm — Zig-native GGUF inference engine optimized for Apple Silicon with Metal support and a fast CLI runner.
  • Stars ZigFormer — A transformer-based LLM implemented entirely in pure Zig. Explores how transformer architectures can be expressed using Zig's comptime and type system.
  • Stars zig_gpt2 — A GPT-2 neural network inference engine written in Zig. Capable of running NanoGPT models.
  • Stars 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.
  • Stars ZML — High-performance, production-ready AI inference stack built in Zig. Designed for speed, safety, and easy deployment of LLMs across hardware targets.

Training & Autograd

Frameworks and libraries for training neural networks and computing gradients in Zig.

  • Stars 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.
  • Stars 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.
  • Stars 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.
  • Stars 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.

Bindings & Wrappers

Zig bindings and wrappers for popular C/C++ machine learning frameworks and APIs.

  • Stars 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.
  • Stars llama.cpp.zig — Full llama.cpp bindings and build utilities for Zig, targeting Zig 0.14.x. Provides ergonomic Zig-style wrappers over llama.h, including camelCase naming, prefix removal, and struct-grouped functions. Supports building llama.cpp directly via zig build.
  • Stars MLX.zig — Zig bindings for Apple's MLX framework, with example LLM and Whisper runners for Apple Silicon.
  • Stars ollama-zig — Zig client library for the Ollama API. Run and interact with locally-served LLMs via Ollama from pure Zig.
  • Stars onnxruntime.zig — Experimental Zig wrapper for the ONNX Runtime, with working examples including Silero VAD (voice activity detection) and NSNet2 (noise suppression).
  • Stars zig-llm — A Zig wrapper around cloud LLM APIs (OpenAI and compatible). Provides simple, idiomatic Zig interfaces for making LLM API requests.

Tensors & Math

Libraries for tensor operations, matrix multiplication, linear algebra, and SIMD-accelerated math essential for neural networks.

  • Stars 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.
  • Stars ZEIN — A Zig-based tensor library named for einsum notation. Planned support for full AVX SIMD and CUDA acceleration.
  • Stars zensor — A lightweight Zig tensor library for building basic tensor computation graphs.
  • Stars 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.
  • Stars zten — A tensor library for Zig based on ggml. Provides a lightweight wrapper around ggml's C API with a Zig-friendly build system.

Linear Algebra

Vector math, matrix operations, and probability libraries — foundational building blocks for ML in Zig.

  • Stars algae — A Zig math library focused on game development with a clean, concise API for vectors and matrices.
  • Stars alg — Algebra utilities for Zig.
  • Stars VecFns — Automatic vector math functions for Zig using comptime generics to generate SIMD-friendly operations.
  • Stars zalgebra — A linear algebra library for games and real-time graphics, including vectors, matrices, and quaternions.
  • Stars zlm — Zig linear mathematics: a simple, dependency-free vector and matrix math library.
  • Stars zmath — A simple linear algebra library written in Zig, designed for clarity and ease of use.
  • Stars zprob — A Zig library for probability distributions. Useful for statistical modelling and sampling in ML pipelines.

Tokenizers

BPE, SentencePiece, and other tokenizer implementations written in Zig.

  • Stars 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.
  • Stars 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.
  • Stars 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.

Tools & Applications

CLI tools, terminal clients, agents, and deployment utilities for LLMs built with Zig.

  • Stars KrillClaw — A tiny Zig-based AI agent runtime for edge and embedded devices with multi-provider LLM support, tool execution, and MCP integration.
  • Stars llmlite — A lightweight, high-performance LLM SDK & Edge Router written in Zig.
  • Stars 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.
  • Stars nullclaw — Self-described as the fastest, smallest, and fully autonomous AI assistant infrastructure written in Zig.
  • Stars Séance — A Zig-built Linux terminal multiplexer that tracks AI coding agents and exposes a scripting API for automation.
  • Stars zaica — A Zig AI coding assistant CLI with multi-provider support, tool calling, and an interactive REPL.
  • Stars zig-llm (OpenAI client) — A dependency-free Zig client for OpenAI-compatible inference servers. Uses std.http and std.json for a minimal, arena-allocated HTTP client that fits in one .zig file.
  • Stars ztk — A Zig CLI proxy that compresses shell output to cut LLM token usage while preserving errors and key details.

Learning Resources

Tutorials, articles, blog posts, and guides on building AI/ML tools from scratch using Zig.

Articles & Blog Posts

Reference Projects (Educational)

  • Stars 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.

Community

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.
  • Stars zigcc/awesome-zig — The broader Zig ecosystem list, which includes a Machine Learning section.

Contributing

Your contributions are always welcome!

  1. 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 .zig file).
  2. Activity — Prefer projects that are actively maintained or historically significant. Clearly mark archived/unmaintained projects.
  3. Descriptions — Keep entries concise and objective. One sentence is ideal; two is the maximum. Don't editorialize.
  4. No duplicates — Search existing entries before submitting a Pull Request.
  5. Alphabetical order — Within each section, add entries in alphabetical order by project name.
  6. Format — Follow the existing ![Stars](https://img.shields.io/github/stars/owner/repo?color=orange) **[Name](url)** — Description. format precisely.

About

⚡ A curated list of awesome Large Language Model (LLM), Machine Learning, and AI projects, libraries, and resources built with the Zig programming language.

Topics

Resources

Stars

17 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors