Minimal code and low-level performance
He presents readable reference implementations in C/CUDA and minimal PyTorch repos. In these he trades only justified complexity for speed and validates against references.
Based on Andrej Karpathy's public content. Not affiliated with or endorsed by Andrej Karpathy.
Rules
Covered in
GitHub · nanoGPT: The simplest, fastest repository for training/finetuning medium-sized GPTs.
Karpathy presents nanoGPT as a minimal, readable, and hackable repository for training or finetuning medium-sized GPTs, while noting that it is now deprecated in favor of nanochat. He teaches practical workflows for starting with a small character-level model, scaling configurations to available hardware, reproducing GPT-2, finetuning pretrained checkpoints, sampling outputs, and troubleshooting performance or compatibility issues.
GitHub · micrograd: A tiny scalar-valued autograd engine and a neural net library on top of it with PyTorch-like API
This README presents micrograd, a tiny scalar-valued autograd engine (about 100 lines) implementing backpropagation over a dynamically built DAG, plus a ~50-line neural net library with a PyTorch-like API. Karpathy shows that operating on individual scalars is enough to build and train deep neural nets, and he points to microgpt as a single-file complete GPT algorithm where everything else is just efficiency. He frames it as potentially useful for education.
GitHub · llm.c: LLM training in simple, raw C/CUDA
Karpathy presents llm.c as an educational, readable, and fast implementation of GPT-2/GPT-3-style pretraining in pure C/CUDA, supported by a parallel PyTorch reference. He teaches learners to begin with reproducible small runs, validate the C/CUDA implementation against PyTorch, and balance performance improvements against code complexity.
CUDA Mode Keynote | Andrej Karpathy | Eureka Labs
Karpathy teaches how llm.c rebuilt GPT-2 training from explicit C and CUDA, using PyTorch as a correctness reference while manually implementing forward passes, backward passes, memory management, kernels, precision, and distributed execution. He emphasizes keeping the implementation readable and dependency-light, optimizing iteratively without accepting complexity whose gains are too small, and presents the project as evidence that future LLMs may generate highly customized low-level software.
GitHub · nanochat: The best ChatGPT that $100 can buy.
Karpathy presents nanochat as a minimal, hackable harness for running the full LLM pipeline—from tokenization and pretraining through finetuning, evaluation, and inference—on accessible hardware and budgets. He teaches a research workflow built around one complexity dial, rapid experiments at small scale, explicit metrics, and changes that generalize across model depths.
GitHub · llama2.c: Inference Llama 2 in one file of pure C
Karpathy presents llama2.c, a minimal train-in-PyTorch, inference-in-pure-C implementation of the Llama 2 architecture, and uses it to teach that small models on narrow domains can perform surprisingly well. He explains practical topics such as sampling settings, int8 quantization, custom tokenizers, hyperparameter tuning for training, and CPU performance flags. He also states a design philosophy that puts simplicity, readability and hackability ahead of maximum efficiency.
GitHub · minGPT: A minimal PyTorch re-implementation of the OpenAI GPT (Generative Pretrained Transformer) training
This README presents minGPT, Karpathy's small, clean, educational PyTorch re-implementation of GPT for both training and inference, and argues that GPT is not a complicated model. He explains how the library is organized, how to use it, and why he moved to nanoGPT, and he collects implementation notes from the GPT-1, GPT-2, GPT-3, and Image GPT papers.