Fork of https://github.com/xenova/microgpt.js
1
2# microgpt.zig
3
4This is a fork of [microgpt.js](https://github.com/xenova/microgpt.js) which ports the original Python implementation implemented by [karpathy](https://karpathy.github.io/2026/02/12/microgpt/). This fork ports the implementations to Zig. Claude Code and Windsurf were both used for the port.
5
6Build with `zig build-exe microgpt.zig -O ReleaseFast`. Run with `./microgpt`
7
8---
9
10The most atomic way to train and inference a GPT in pure, dependency-free JavaScript.
11This repository covers the complete algorithm.
12Everything else is just efficiency.
13
14Adapted from Karpathy's [microgpt.py](https://gist.github.com/karpathy/8627fe009c40f57531cb18360106ce95). This implementation matches the original exactly, but now can run in JavaScript environments, including browsers and Node.js.
15
16