Skip to content

Instantly share code, notes, and snippets.

@Lukass14
Lukass14 / Makefile
Created February 13, 2026 10:43 — forked from USM-F/Makefile
microgpt by karpathy but in pure C
CC = gcc
CFLAGS = -O3 -Wall -Wextra
LDFLAGS = -lm
all: microgpt
microgpt: microgpt.c
$(CC) $(CFLAGS) microgpt.c -o microgpt $(LDFLAGS)
clean:
@Lukass14
Lukass14 / microgpt.py
Created February 11, 2026 22:00 — forked from karpathy/microgpt.py
microgpt
"""
The most atomic way to train and inference a GPT LLM in pure, dependency-free Python.
Differences from GPT-2 are minor: rmsnorm instead of layer norm, no biases, square ReLU instead of GeLU nonlinearity.
The contents of this file is everything algorithmically needed to train a GPT. Everything else is just efficiency.
Art project by @karpathy.
"""
import os # for os.path.exists
import math # for math.log, math.exp
import random # for random.seed, random.choices