Show HN: Andrej Karpathy's microgpt.py to C99 microgpt.c – 4,600x faster

Published: (February 16, 2026 at 07:06 PM EST)
1 min read

Source: Hacker News

MicroGPT-C

A zero-dependency, pure C99 implementation of a GPT-style character-level language model.

The algorithm faithfully matches Andrej Karpathy’s microgpt.py — same architecture, same training loop, same sampling — but compiles to native code with optional compiler‑driven SIMD auto‑vectorisation for dramatically faster training and inference.

Train a GPT in 20 ms. Generate names in microseconds. No Python. No PyTorch. No GPU.

What Is This?

MicroGPT‑C is a minimal, readable implementation of a GPT (Generative Pre‑trained Transformer) — the same family of models behind ChatGPT, but stripped down to its essential algorithm. It trains a tiny character‑level language model that learns to generate realistic human names from scratch.

The goal is education and experimentation: understand how attention, softmax, Adam optimiser, and back‑propagation work at the lowest level, without any framework abstractions.

Audience & Value

AudienceValue
Students & educatorsStudy attention, softmax, Adam, and back‑prop in readable C — no framework magic
Embedded / edge engineersEntire model fits in **), Enjector Software Ltd.
0 views
Back to Blog

Related posts

Read more »

OpenScan

Giant Swallowtail OpenScan Classic + DSLR + focus stacking + OpenScanCloud original model by FrankMcMains available on Sketchfabhttps://skfb.ly/ot6UT !textured...