Home / Tools / nanoGPT

nanoGPT

Minimal code for training and fine-tuning GPT-style models.

Visit nanoGPT
nanoGPT preview
github.com Open Source

Upvotes

0

Pricing

Open Source

Category

Research

In the database since

Oct 2026

Overview

About nanoGPT

nanoGPT is a minimal open-source codebase for training GPT-style language models. Andrej Karpathy wrote it as the simplest fast way to train medium-sized GPTs. The code is short and plain, with a train.py that can reproduce GPT-2 on OpenWebText. In November 2025 the author marked it as old and kept for posterity, pointing learners to nanochat. It is still useful for studying how GPT training works. The code is open under the MIT license. Check the official GitHub repo for the code and the author's note.

Key Features

1. Minimal codebase

The code is short and plain, so you can read the whole training loop and understand it.

2. GPT-2 training example

Its train.py can reproduce GPT-2 (124M) on OpenWebText, which is a classic learning target today.

3. Fine-tuning support

You can also fine-tune models on your own text, which takes far less time than training.

4. Hackable design

Every part is easy to change, so researchers can test new ideas without fighting the code.

5. Author's successor note

Karpathy now points to nanochat as the better modern choice, while nanoGPT stays for study.

Frequently Asked Questions (FAQ)

What is nanoGPT used for?

It teaches you how to train and fine-tune GPT-style models. Students and researchers use it to learn the training loop hands-on.

Is nanoGPT still maintained?

No. In November 2025 the author called it old and kept it for posterity. He points learners to nanochat as the modern choice.

What hardware does training need?

The GPT-2 example ran on a single 8xA100 40GB node in about four days. Smaller tests and fine-tuning need much less power.

What is nanochat?

It is Karpathy's newer project for building chat models. He suggests it as the better pick if you want modern, maintained code.

Is it good for beginners?

Yes, for learning. The code is short and readable. Beginners should expect a learning curve with GPUs and training setups.

Conclusion

nanoGPT remains a clean window into how GPT training works, even though its author has moved on. The tiny codebase is perfect for study and small experiments. If you want modern maintained code, follow his note and try nanochat. It suits students and researchers learning the basics. Check the official GitHub repo for the code and the author's status note.

Newsletter

Tools like this change fast

New Research tools launch every week — the newsletter keeps you ahead of what's worth trying.

Keep exploring

Similar AI tools

Ranked by the job they do, their capabilities, and how closely they fit this workflow.