# zigllm > Learn how LLMs work by building one in Zig — from tensors to text generation. zigllm is an educational, book-shaped Zig codebase that implements 18 transformer architecture families across 6 progressive layers (foundation, linear algebra, neural primitives, transformers, models, inference). Inference-only, MIT-licensed, 285+ tests serve as executable documentation. ## What this is zigllm is a pedagogical project. It is not a production inference runtime. The goal is to make the inner workings of modern transformers legible by reading and writing the code, layer by layer, with manual memory management and explicit SIMD. ## Audience - ML / systems-curious learners who want to see a forward pass all the way down to memory layout. - Zig fans who want a substantial codebase that uses comptime, SIMD, and manual memory. - Anyone who learns by reading code rather than slides. ## Requirements - Zig 0.14+ - A modern CPU (AVX/AVX2 recommended but not required) ## Key links - [Home](https://zigllm.cognisoc.com/) - [About](https://zigllm.cognisoc.com/about/) - [Blog](https://zigllm.cognisoc.com/blog/) - [Compare](https://zigllm.cognisoc.com/compare/) - [RSS](https://zigllm.cognisoc.com/rss.xml) - [Docs](https://docs.cognisoc.com/zigllm/) - [GitHub](https://github.com/cognisoc/zigllm) ## Blog posts - [What you actually learn by writing the matmul yourself](https://zigllm.cognisoc.com/blog/matmul-by-hand/) — why the linear algebra layer is where understanding becomes legible. - [Tensors as the lingua franca](https://zigllm.cognisoc.com/blog/tensors-lingua-franca/) — shape, stride, dtype as the language every layer speaks. - [How a sampling loop becomes 'generation'](https://zigllm.cognisoc.com/blog/sampling-loop-becomes-generation/) — Layer 6, autoregression, samplers, KV caching. ## Comparisons - [vs. nanoGPT](https://zigllm.cognisoc.com/compare/nanogpt/) — complementary readings. - [vs. llm.c](https://zigllm.cognisoc.com/compare/llm-c/) — complementary readings.