#44th of 5 in Training and fine-tuning

nanochat

Minimal PyTorch codebase to train and chat with a small GPT-2-class LLM

Stars
58.6k
License
MIT
Last commit
Jul 2026
Language
Python
Stars, last 29 weeks+9,155
24 Mar 2026: 49,466 stars31 Mar 2026: 50,072 stars7 Apr 2026: 50,680 stars14 Apr 2026: 51,234 stars21 Apr 2026: 51,683 stars28 Apr 2026: 52,075 stars5 May 2026: 52,418 stars12 May 2026: 52,826 stars19 May 2026: 53,245 stars26 May 2026: 53,762 stars2 Jun 2026: 54,073 stars9 Jun 2026: 54,380 stars16 Jun 2026: 54,717 stars23 Jun 2026: 54,971 stars30 Jun 2026: 55,277 stars7 Jul 2026: 55,679 stars14 Jul 2026: 55,945 stars21 Jul 2026: 56,219 stars28 Jul 2026: 56,472 stars4 Aug 2026: 56,720 stars11 Aug 2026: 56,906 stars18 Aug 2026: 57,102 stars25 Aug 2026: 57,334 stars1 Sept 2026: 57,567 stars8 Sept 2026: 57,741 stars15 Sept 2026: 57,938 stars22 Sept 2026: 58,129 stars29 Sept 2026: 58,279 stars6 Oct 2026: 58,422 stars13 Oct 2026: 58,621 stars

49,466 on 24 Mar 202658,621 on 13 Oct 2026

From GitHub's daily star counts.

Checked on GitHub.

Overview

nanochat covers tokenizer training, pretraining, SFT, RL, evaluation and a CLI chat interface in one small Python codebase. A single `--depth` setting derives width, heads, learning rate and training horizon, so one knob produces a compute-optimal model series. The reference speedrun trains a GPT-2-grade model in about 1.65 hours on an 8xH100 node per the leaderboard.

Who it is for: Researchers and engineers learning or experimenting with end-to-end LLM training

Strengths

  • Covers tokenizer, pretraining, SFT, RL, eval and inference in one repo
  • Single `--depth` dial sets all other hyperparameters automatically
  • Public time-to-GPT-2 leaderboard with commits and CORE scores
  • Same scripts run on one GPU via gradient accumulation, or on CPU/MPS

Weaknesses

  • Reference speedrun needs an 8xH100 node, roughly $48 of rented compute
  • Under 80GB VRAM requires manually lowering `--device-batch-size`
  • CPU/MPS path only trains a tiny model with weak results
  • Chat is CLI-only in the README; resulting model is small and hallucinates

What it needs

  • GPU required
  • Needs PyTorch, uv, wandb
  • Models: nanochat GPT (depth-scaled), bfloat16, float32, float16

Head to head

Also in Training and fine-tuning

See all 5
Also in Training and fine-tuning
RankProjectScore
1llamafactoryFine-tuning toolkit for 100+ LLMs with a CLI and Gradio web UI Live demo ↗ (opens in a new tab)75.5k starsApache-2.074 out of 100
2deepspeedPyTorch library for distributed training of large models with ZeRO43.2k starsApache-2.072 out of 100
3minimindTrain a 64M-parameter LLM from scratch in plain PyTorch Live demo ↗ (opens in a new tab)63.7k starsApache-2.064 out of 100
#5colossalaiDistributed training library for large models with many parallelism strategies Live demo ↗ (opens in a new tab)41.4k starsApache-2.043 out of 100