mrkeyoor.com_
Tue 01 Sept 17:44 UTC
LLM Toolsevaluationupdated 26 Aug 2026

nanoGPT review

nanoGPT is a small Python codebase for training, fine-tuning, and sampling GPT-2-style language models. Its own README now calls the project old and deprecated, and directs new users to nanochat while keeping nanoGPT available for study and experiments.

+210stars / 7d
Verdict

Our nanoGPT install took 32 seconds and its 21-second build passed, but the repository supplied no test target to run. Use it as readable historical GPT-2 training code or to reproduce a named experiment. Start a new training project with nanochat or a maintained toolkit, exactly as nanoGPT's own deprecation notice recommends.

We ran it

Lab card: what happened when we ran nanoGPTScreenshot of nanoGPT (github.com/karpathy/nanoGPT)
Install✓ · 32s35 packages · 37 MB
Build✓ · 21s
Testsn/ano test script
Known vulns0(pip-audit)
Repo26 files~1,235 lines of source · 0.6 MB · 0 CI workflows

Answers from our run

Does nanoGPT build from source?

Dependencies installed in 32 seconds (35 packages), and the build succeeded in 21 seconds. We cloned commit 3adf61e into a clean Debian container with 3 CPUs and no project-specific setup.

Does nanoGPT have tests you can run?

Not through a standard command: the project exposes no test script or target that our harness could run.

Does nanoGPT have known vulnerabilities in its dependencies?

pip-audit found none in the dependency tree at the time of our run.

Who should not use nanoGPT?

New projects choosing a maintained Karpathy training stack: the README says nanoGPT is deprecated and points readers to nanochat.

What are the alternatives to nanoGPT?

nanochat, LitGPT, Transformers. Our nanoGPT install took 32 seconds and its 21-second build passed, but the repository supplied no test target to run.

Setup4/535 packages installed cleanly; training still needs hardware and data
Docs4/5Readable recipes and gotchas, topped by a clear deprecation notice
Community3/562,509 stars and active PRs, but maintainer work has moved on
Maturity2/5Deprecated, no releases, CI workflows, or test target

Discussed on

  1. hnNanoGPT1,532 points
  2. hnNanoGPT: The simplest, fastest repository for training medium-sized GPTs114 points
  3. hnkarpathy/build-nanogpt: Video + code lecture on building nanoGPT from scratch9 points
  4. hnShow HN: Karpathy's Nanogpt but for Audio7 points
  5. hn[Andrej Karpathy] Let's reproduce GPT-2, in PyTorch from scratch (nanoGPT)7 points

Who it’s for

Students who want to read a compact GPT training loop and model definition without a large framework around them.
Researchers making small, controlled changes to a GPT-2-style baseline.
Developers reproducing an older tutorial or experiment that already names nanoGPT.
GPU users comfortable preparing datasets, tuning memory settings, and diagnosing PyTorch behavior themselves.

Who it’s NOT for

New projects choosing a maintained Karpathy training stack: the README says nanoGPT is deprecated and points readers to nanochat.
Teams that require a repository-owned regression suite: our checkout exposed no test script or target, no tests directory, and no CI workflow files.
Windows users expecting the default path to work unchanged: the README says torch.compile may be unavailable and suggests disabling compilation.
Buyers expecting a ready chat model, serving API, tokenizer pipeline, evaluation suite, or deployment layer: nanoGPT is a small training and sampling codebase.
CPU-only users aiming to reproduce the README's GPT-2 training run: that documented recipe calls for 8 A100 40 GB GPUs, while its CPU example deliberately shrinks the model and context.

Setup reality

Our sandbox installed 35 Python packages in 32 seconds and used 37 MB on disk. Building commit 3adf61e succeeded in 21 seconds. No test script or target existed, so we skipped tests; pip-audit reported 0 known vulnerabilities.

The small Shakespeare path downloads a dataset and can run on CPU, CUDA, or Apple MPS with different flags. Loading GPT-2 checkpoints needs Transformers, while OpenWebText preparation needs Datasets. Weights and training data add costs that our 37 MB dependency result does not include.

The default code uses torch.compile; the README says to pass --compile=False where unsupported. Serious training needs GPU memory planning, checkpoint storage, and possibly distributed PyTorch. There is no packaged service or production deployment path.

nanoGPT is now a readable artifact, not Karpathy's current stack

The first useful sentence in nanoGPT's README is its November 2025 update: the repository is old, deprecated, and retained for posterity, while new users probably want nanochat. That changes how the code should be judged. nanoGPT remains a compact implementation of GPT training and sampling, but it is no longer the author's recommended foundation for a new project. Treat it as a study aid or a pinned experimental baseline.

The appeal is still obvious in 26 files and roughly 1,235 lines of source. The README describes train.py as an approximately 300-line training loop and model.py as an approximately 300-line GPT definition. Those two files cover training from scratch, fine-tuning, checkpoint loading, distributed execution, and sampling without hiding the model inside a large abstraction layer. A developer can read the path from tokens to loss and then alter it directly.

The smallest example teaches the loop by shrinking the model

The quick start prepares a 1 MB Shakespeare text file, trains a character model, and samples from the saved checkpoint. Its supplied GPU configuration uses 6 Transformer layers, 6 heads, 384 feature channels, and a context of 256 characters. The CPU command cuts those settings to 4 layers, 4 heads, 128 embedding dimensions, a 64-character context, and a batch size of 12. The point is access to the machinery, not competitive language output.

Moving beyond that tutorial means bringing the missing pieces yourself. OpenWebText preparation uses Hugging Face Datasets, GPT-2 checkpoint loading uses Transformers, and tokenization uses tiktoken. Weights, generated dataset binaries, experiment logs, and checkpoints sit outside our measured 37 MB environment. The repository does not provide a chat interface, request server, safety layer, model registry, or deployment chart. It gives you readable training code and assumes you can build the rest of the experiment around it.

What happened when we ran it

Our sandbox installed 35 Python packages in 32 seconds, occupying 37 MB on disk. Building commit 3adf61e then succeeded in 21 seconds. The checkout itself was 0.6 MB, with 26 files and about 1,235 source lines. Pip-audit reported 0 known vulnerabilities in the installed dependency set. These results cover repository setup, not a model-training run or downloaded weights.

There was no test script or target, so we skipped the test step. Our scan also found no tests directory, no Dockerfile, and 0 CI workflow files. That absence matters more than a passing import check would: changes to sampling, data preparation, checkpoint compatibility, or distributed behavior do not have a repository-owned suite that a new user can run from this checkout. Anyone modifying the code should add a small local regression set for the exact path being changed.

The successful 21-second build says the pinned commit was syntactically and structurally usable in our Python 3.12 Debian image. It does not confirm CUDA execution, Apple MPS, multi-node training, dataset preparation, GPT-2 weight downloads, numerical reproduction, or generated-text quality. None of those workloads ran in the supplied lab block, so they should be evaluated separately on the intended hardware.

The documented GPT-2 recipe requires serious hardware

For its larger reproduction, the README specifies a 124M-parameter GPT-2 model on one node with 8 A100 GPUs, each carrying 40 GB of memory. It describes a roughly 4-day OpenWebText run through PyTorch Distributed Data Parallel. Those are the project's figures, not results from our sandbox. They show why nanoGPT's tiny checkout should not be confused with a cheap full training job.

Single-GPU and multi-node paths are exposed as direct command-line settings. The multi-node example expects the operator to provide ranks, addresses, ports, and an interconnect that can keep up. The README warns that a setup without InfiniBand may crawl and suggests changing an NCCL setting. This is useful honesty, but there is no scheduler, cluster provisioning layer, recovery service, or experiment database. The person running it owns all of those operational decisions.

PyTorch compilation and memory limits remain hands-on

The default path uses PyTorch compilation. The troubleshooting section says that torch.compile may not be available on every platform, naming Windows, and recommends --compile=False when it fails. CPU users must also choose --device=cpu; Apple Silicon users can select --device=mps. Fine-tuning runs can exhaust memory, in which case the README suggests reducing model size or context length.

That directness is part of nanoGPT's educational value. Configuration is applied through Python files and command-line overrides rather than a framework with compatibility checks. It also means error handling depends heavily on PyTorch and the local machine. With no automated tests in our 2026 checkout, a dependency upgrade can change compilation, checkpoint loading, or sampling behavior without an obvious project-level alarm. Pin the environment when reproducing old results.

Community interest continues after maintainer development stopped

GitHub showed 62,509 stars and 352 combined issues and pull requests. The repository's last push was November 12, 2025, and GitHub returned no latest release. Open pull requests were still receiving updates in August 2026, including proposals around greedy decoding at temperature 0 and inference-time evaluation mode. That is community activity around the code, not evidence that the deprecated main branch has resumed active development.

nanoGPT remains worth reading because its limited surface makes GPT training inspectable. The 32-second install lowers the cost of opening the code and trying the small example. For maintained training work, follow the README to nanochat or choose a toolkit with current tests and recipes. For teaching, debugging an older experiment, or learning what a GPT loop actually does, the deprecated repository still has a clear job.

Alternatives

ProjectWhat it isPick it when
nanochatKarpathy's newer end-to-end project for training and chatting with a small language model.pick this instead when starting fresh, because nanoGPT's README now directs new users there.
LitGPTA larger training and fine-tuning toolkit covering many current language models.pick this instead when model choice, maintained recipes, and scaling support matter more than minimal code.
Transformers gh↗A broad model library with training, inference, and a large catalog of architectures.pick this instead when pretrained-model coverage and standard tooling matter more than reading the whole implementation.
torchtunePyTorch-native recipes and components for fine-tuning language models.pick this instead when the job is maintained fine-tuning rather than studying a compact GPT-2 implementation.

What people are saying

  1. [hackernews] NanoGPT Speedrun Frontier
  2. [github-trending] karpathy/nanoGPT

Sources

  1. nanoGPT README and deprecation notice
  2. nanoGPT repository facts
  3. nanochat repository
  4. Greedy decoding pull request

More llm tools reviews

rig · open-knowledge · graphiti · cve-mcp-server · minimind · SillyTavern · the whole board →