Show HN: ZigFormer – An LLM implemented in pure Zig

22 points by habedi0 ↗ HN
Hi everyone,

I've made an early version of ZigFormer, a small LLM implemented in Zig with no dependencies on external ML frameworks like PyTorch or JAX. ZigFormer is modelled after a textbook LLM (like GPT-2 from OpenAI) and can be used as a Zig library as well as a standalone application to train a model and chat with it.

This was mainly an educational project. I'm sharing it here in case others find it interesting or useful.

Link to the project: https://github.com/CogitatorTech/zigformer

1 comment

[ 3.7 ms ] story [ 11.7 ms ] thread
Doesn't seem very bad, for any of the Zig code I looked at, it would maybe have been nicer to try starting from something like GGML and building on top so it was more extensible. Personally, aside from implementing all of BLAS in Zig, I would have just used OpenBLAS.