talira

Andrej Karpathy's minimal repository for training and fine-tuning medium-sized GPTs, now deprecated for nanochat

open sourceMITfree

nanoGPT's makers archived or ended it in November 2025.

Its README says nanoGPT is very old and deprecated, left up for posterity, and points to nanochat.

nanoGPT is Andrej Karpathy's small, readable repository for training and fine-tuning medium-sized GPT models in PyTorch: a training loop of about 300 lines and a GPT model definition of about 300 lines that can load OpenAI's GPT-2 weights. Its train.py reproduces GPT-2 (124M) on OpenWebText, and its quick start trains a character-level GPT on Shakespeare. It's a rewrite of minGPT. In November 2025 Karpathy marked it deprecated and pointed people to its successor, nanochat.

Problems it solves

  • train a small GPT from scratch on my own text with code I can read in an afternoon
  • fine-tune GPT-2 on my dataset without a big framework
  • reproduce GPT-2 training on a single GPU node to learn how it works

Features

  • reproduces GPT-2 (124M) on OpenWebText
  • fine-tunes from OpenAI's GPT-2 checkpoints
  • character-level Shakespeare quick start
  • about 600 lines of training and model code

Alternatives

The same job

These do what nanoGPT does.

  1. Train LLM From Scratch Plain-PyTorch codebase to pretrain and post-train your own small language models
  2. nanochat The best ChatGPT that $100 can buy
  3. Axolotl A free and open source framework for fine-tuning and post-training large language models
  4. LlamaFactory An open source framework for fine-tuning 100+ language and vision-language models from a CLI or a web UI
  5. ms-swift Fine-tune, align, evaluate, quantize and deploy 600+ LLMs and 400+ multimodal models
  6. Oumi Fine-tune, evaluate and deploy open LLMs and agents

Compare nanoGPT with the top 3