Skip to content

Instantly share code, notes, and snippets.

@skannan-maf
skannan-maf / microgpt.py
Last active February 16, 2026 18:07 — forked from karpathy/microgpt.py
microgpt
"""
The most atomic way to train and inference a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
--
@karpathy
1. Commented out a seemingly redundant "rmsnorm"
2. Increased the width (block_size) from 16 to 32 to support long names
3. Modified the output samples so that first 50% of output starts with "sar"