nanochat
github.com
Andrej Karpathy's minimal, hackable harness for training your own ChatGPT-style LLM end to end on a single GPU node — a GPT-2-grade model for about $48.
- Pricing
- Open source
- Published
- Nov 3, 2026
Next steps
- TorchTitan
Both tools are listed under Large Language Models (LLMs), AI Developer Tools, llm-training, and pretraining.
- Poros
Both tools are listed under Large Language Models (LLMs), AI Developer Tools, and pytorch.
- Soup
Both tools are listed under Large Language Models (LLMs) and AI Developer Tools.
- CodeGraph
- Diagram Design
- Agent Skills (Addy Osmani)
What it does
nanochat is an MIT-licensed experimental harness by Andrej Karpathy for training LLMs, designed to run on a single GPU node with minimal, hackable code. It covers every major stage: tokenization, pretraining, finetuning, evaluation and inference, and you can chat with the result over a simple CLI. The README's headline example: a model with GPT-2 capability (about $43,000 to train in 2019) for roughly $48 — about two hours on an 8×H100 node — or closer to $15 on a spot instance. One complexity dial, --depth (number of transformer layers; GPT-2 capability is around depth 26), sets everything else — width, heads, learning-rate schedule, training horizon and weight decay — in a compute-optimal way. The project keeps a 'time to GPT-2' speedrun leaderboard measured by the DCLM CORE score, which community runs have pushed below two hours. Questions are handled via DeepWiki, GitHub Discussions and a Discord channel. About 60k GitHub stars.
Use cases
- Learn how a full LLM pipeline works by training one yourself
- Reproduce a GPT-2-grade model on a rented 8×H100 node for under $100
- Experiment with pretraining tweaks and compare on the speedrun leaderboard
Frequently asked questions
- How much does a training run cost?
- The README cites about $48 for a GPT-2-grade model (~2 hours on an 8×H100 node at ~$3/GPU-hour), or about $15 on a spot instance.
- What hardware does it need?
- It is designed for a single GPU node; the reference speedrun uses 8×H100.
- Which stages are included?
- Tokenization, pretraining, finetuning, evaluation and inference, plus a simple chat CLI.
- What license is it under?
- MIT.