Microgpt in pure C hits 10M tps on Apple m5
A developer has created a dependency-free, character-level GPT model written entirely in C that runs efficiently on modern hardware. The project demonstrates high-performance inference capabilities, achieving over 10 million tokens per second on an Apple M5 chip.
Why it matters
This project showcases the potential for extreme optimization in AI, proving that language models can be run with minimal overhead and high efficiency.
The most atomic way to train and inference a GPT in pure, dependency-free C.
A character-level transformer with forward pass, backprop, Adam and sampling, in one C file with nothing beyond libc. It trains on ~32k names in a couple of seconds and generates new ones.
make run Or run it directly, on any corpus with one item per line:
./microgpt data/names.txt Builds on macOS, Linux and Windows (MSYS2), on ARM64 with NEON and x86-64 with AVX2. The Makefile picks the flags for the host.
Get smarter about the news
Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.
Create free accountAlready have an account? Sign in