Microgpt in pure C hits 10M tps on Apple m5
Summary
The microGPT-C project provides a minimal, dependency-free implementation of a character-level transformer in pure C, achieving over 10 million tokens per second inference speed on Apple M5 hardware.
View Cached Full Text
Cached at: 08/19/26, 04:10 PM
vixhal-baraiya/microgpt-c
Source: https://github.com/vixhal-baraiya/microgpt-c
microGPT-C
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.
Build and run
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.
step 5000 / 20000 | loss 2.6036 (avg 2.2940)
step 10000 / 20000 | loss 1.9639 (avg 2.2564)
step 15000 / 20000 | loss 2.7007 (avg 2.2151)
step 20000 / 20000 | loss 2.3463 (avg 2.2201)
inference
sample 1: kayley
sample 2: maria
sample 3: arana
sample 4: shayan
sample 5: jayden
sample 6: saria
sample 7: kaylen
sample 8: amari
sample 9: alina
sample 10: mailyn
c fp32+NEON 10168430 tok/sec
Notes
The model has 4192 parameters and generalises rather than memorises. Trained on 20000 of the 32033 names, it scores 2.2054 nats per character on those and 2.2039 on the 12033 it never saw, beating an interpolated trigram that has nearly five times as many parameters.
Training and inference use separate forward passes. gpt_forward stores
activations for backprop; gpt_forward_infer is a specialised
single-token path whose logits match it to within fp32 rounding.
docs/PERFORMANCE.md covers how that path works and
what limits it.
| machine | backend | tok/sec |
|---|---|---|
| Apple M5 Pro | NEON | 10,168,430 |
| AMD Ryzen 5 5600H | AVX2 | 6,927,775 |
Similar Articles
GateGPT: 56k tokens per second Transformer (KV cache) on FPGA at 80 MHz
A custom FPGA implementation of a Transformer with KV cache achieves 56,000 tokens per second at 80 MHz, running microGPT on a tiny LCD.
China's Xiaomi MiMo Is Now 15X Faster Than ChatGPT and Claude (4 minute read)
Xiaomi achieved over 1,000 tokens per second inference on its trillion-parameter MiMo-V2.5-Pro-UltraSpeed model using commodity 8-GPU nodes via FP4 quantization and DFlash speculative decoding, outpacing GPT-5.5 and Claude Opus by over 10x.
Show HN: TurboGPT: train 22KiB transformer in 13s
TurboGPT is an open-source CUDA C++ tool that enables rapid training of a tiny byte-level GPT model, achieving 2.5295 BPB on 1.5G tokens in 13 seconds.
@nicebabycat: https://x.com/nicebabycat/status/2091726637155103126
This article provides a detailed test of the local deployment and performance of the Ling-3.0-tiny model on an Apple M5 chip Mac, demonstrating the feasibility of running a 7.9B parameter model at 47 tokens per second without a discrete GPU.
Swift-1.5-Qwen3.8-27b-oQ8e-mtp on Apple M5 Max — 34.8 tok/s — llm-bench.io
The article benchmarks the Swift-1.5-Qwen3.8-27b-oQ8e-mtp AI model on Apple M5 Max, achieving 34.8 tokens per second, with reproduction steps for the run.