What do you want to do?
3 use cases
-
Train a GPT-2 class chat model end to end and talk to it
Set up the environment, run the speedrun script, then chat with your model in the CLI.
View prompt
On this 8-GPU node, set up karpathy/nanochat with `uv sync --extra gpu`, run `bash runs/speedrun.sh` in a screen session, and when it finishes start `python -m scripts.chat_cli`.
-
Train a compute-optimal miniseries by changing one depth dial
Run base training at different --depth values and compare validation bits per byte and CORE score.
View prompt
Run nanochat base_train sweeps at depth 12, 16 and 20 on this node, then tabulate val_bpb, core_metric and train/mfu for each run.
-
Run a tiny Nanochat training on CPU or Apple Silicon
Use the CPU or MPS setup and the runcpu example to learn the pipeline without GPUs.
- REPO
karpathy/nanochat - Claude Code
- Codex
- Cursor
- Research
- Intermediate
View prompt
Set up nanochat for CPU with `uv sync --extra cpu`, run runs/runcpu.sh, and explain each stage it runs as it goes.
- REPO
Quick start with Nanochat
- Check you have what it needs: uv; An 8XH100 or 8XA100 node for the speedrun (a single GPU works, 8 times slower); CPU or Apple Silicon only for the tiny runcpu example.
- Open karpathy/nanochat on GitHub and read the README and license.
- Run
uv sync --extra gpufor CUDA - Run
source .venv/bin/activate - Run
bash runs/speedrun.sh, ideally in a screen session - Run
python -m scripts.chat_clito talk to the model
These steps come from our top use case, Train a GPT-2 class chat model end to end and talk to it, which also has a copy-paste agent prompt.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for karpathy/nanochat
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeAbout this repo
- Who it is forML engineers, students and researchers who want to train a small LLM end to end and understand every stage.
- Why it is hot60k stars, talked about in 2 AI sources we track
- LanguagePython
- Sourcegithub.com/karpathy/nanochat ยท Back to Hot repos
Requirements
- uv
- An 8XH100 or 8XA100 node for the speedrun (a single GPU works, 8 times slower)
- CPU or Apple Silicon only for the tiny runcpu example
Add this badge to your README
Maintain Nanochat? Show readers where to find these use cases.
Markdown
[](https://dedupedai.com/use-cases/karpathy-nanochat/?utm_source=github&utm_medium=badge&utm_campaign=karpathy-nanochat)
HTML
<a href="https://dedupedai.com/use-cases/karpathy-nanochat/?utm_source=github&utm_medium=badge&utm_campaign=karpathy-nanochat"><img src="https://dedupedai.com/badge/karpathy/nanochat.svg" alt="Use cases on Deduped" height="20"></a>
A static image, no tracking script. About the badge
Questions about Nanochat
What is Nanochat?
nanochat is the simplest experimental harness for training LLMs on a single GPU node. Its minimal, hackable code covers tokenization, pretraining, finetuning, evaluation and inference, so you can train a GPT-2 capability model in about 2 hours on an 8XH100 node and talk to it over a CLI. One dial, --depth, sets the model size and every other hyperparameter is derived from it. It is an open-source project on GitHub: https://github.com/karpathy/nanochat.
How do I use Nanochat?
Run uv sync --extra gpu for CUDA; then run source .venv/bin/activate; run bash runs/speedrun.sh, ideally in a screen session. The use cases on this page give the full steps and a copy-paste agent prompt for each job.
Who is Nanochat for?
ML engineers, students and researchers who want to train a small LLM end to end and understand every stage.
What can I do with Nanochat?
3 use cases so far, for example: Train a GPT-2 class chat model end to end and talk to it; Train a compute-optimal miniseries by changing one depth dial; Run a tiny Nanochat training on CPU or Apple Silicon. Each has steps and a copy-paste agent prompt.
What do I need to run Nanochat?
uv; An 8XH100 or 8XA100 node for the speedrun (a single GPU works, 8 times slower); CPU or Apple Silicon only for the tiny runcpu example.
What are alternatives to Nanochat?
Other hot AI repos in Research: Deep Tutor, Local Deep Research, Project Nomad, We Knora, OpenMAIC.
Is Nanochat safe to run?
Deduped does not own, audit or vouch for it. Read the README and license, run it on your own systems first and review every command before you run it.