mrkeyoor.com_
Fri 16 Oct 19:57 UTC
LLM Toolsevaluationupdated 16 Oct 2026

nanoGPT review

nanoGPT is a small Python codebase for training text-generating models and adapting pretrained GPT-2 checkpoints to new text. It exposes the model and training loop directly for people who want to understand or modify them. The maintainer now labels it deprecated and directs new users to nanochat.

+139stars / 7d
Verdict

Our nanoGPT run installed 35 packages in 9 seconds and passed its 2-second build step, but tests were skipped because no target existed. Use it to study or modify a compact GPT trainer if you're prepared to verify your changes yourself. For a new conversational-model project, follow the maintainer's deprecation notice and start with nanochat.

We ran it

Lab card: what happened when we ran nanoGPTScreenshot of nanoGPT (github.com/karpathy/nanoGPT)
Install✓ · 9s35 packages · 38 MB
Build✓ · 2s
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 9 seconds (35 packages), and the build succeeded in 2 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 conversational-model projects looking for the maintainer's recommended starting point: the November 2025 README notice directs you to nanochat.

What are the alternatives to nanoGPT?

nanochat, Transformers. Our nanoGPT run installed 35 packages in 9 seconds and passed its 2-second build step, but tests were skipped because no target existed.

Setup4/59-second install; data preparation and device overrides still required
Docs3/5Concrete examples, but older active-development wording remains
Community3/563,843 stars and recent proposals, but explicitly deprecated
Maturity2/5No test target or CI workflows; maintainer recommends nanochat

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

Engineers learning how tokenized text, model updates, and checkpoints connect inside a GPT trainer.
Researchers who want to edit a small GPT-2-style implementation directly.
Developers maintaining an existing nanoGPT experiment who can own compatibility and correctness checks.

Who it’s NOT for

New conversational-model projects looking for the maintainer's recommended starting point: the November 2025 README notice directs you to nanochat.
Developers expecting arbitrary pretrained model imports: model.py explicitly supports the GPT-2 family.
Teams requiring an upstream automated verification path: our run found no test target, no tests directory, and 0 CI workflows.
Experiments depending on zero-temperature sampling without code changes: open issue 738 reports a crash, and generate() has no zero-temperature branch.
Operators assuming exact FP16 recovery is already covered: open pull request 758 proposes restoring gradient-scaler state in checkpoints.

Setup reality

Our sandbox installed nanoGPT commit 3adf61e in 9 seconds, adding 35 packages and using 38 MB on disk. The build passed in 2 seconds. Tests were skipped because no script or target existed, and pip-audit reported 0 known vulnerabilities. The scan found 0 CI workflow files, no Dockerfile, and no tests directory.

The basic local exercise needs downloaded text and prepared train.bin and val.bin files. Pretrained GPT-2 use also retrieves weights. No hosted model API credential is required for the documented local path. Weights & Biases logging is optional and disabled by default, with account configuration needed if you enable it.

The trainer defaults to CUDA and compilation. The README's smaller CPU route explicitly uses --device=cpu and --compile=False; Apple Silicon has an mps suggestion. Our Python 3.12 Debian run used 3 CPUs and 8 GB of RAM and establishes no training-speed or model-quality result. The project is explicitly deprecated.

The maintainer directs new users to nanochat

nanoGPT's README opens with a November 2025 deprecation notice and points readers to nanochat. Take that notice seriously before following the older introduction, which still describes active development. This repository trains text generators and adapts GPT-2 checkpoints. I'd choose it today when the goal is understanding the training code closely enough to change it, and choose nanochat first when starting a new conversational-model project.

Our checkout contained 26 files and about 1,235 lines of source, occupying 0.6 MB. That small surface is the attraction: you can follow the model definition in model.py, then see how train.py feeds it batches and updates its weights. A larger framework can hide those connections behind abstractions. Here, changing the learning rate or checkpoint behavior means finding the code that does the work.

What happened when we ran it

Our run installed nanoGPT commit 3adf61e in 9 seconds and completed the build step in 2 seconds. We measured it on October 12, 2026, in an unprivileged Debian container with 3 CPUs and 8 GB of RAM, using the uv Python 3.12 Bookworm image. The container had no secrets. These are repository setup results, with no training throughput or model-quality measurement attached.

Installation added 35 packages and occupied 38 MB on disk. Pip-audit reported 0 known vulnerabilities in that environment. Tests were skipped because there was no test script or target. The repository scan found 0 CI workflow files, no Dockerfile, and no tests directory. A successful build step therefore gives you much less assurance than a passing behavioral suite would, especially if you intend to change the optimizer or resume logic.

Prepare the data before launching the trainer

The character-level Shakespeare example starts with python data/shakespeare_char/prepare.py. That script downloads text when needed, builds character mappings, and writes train.bin, val.bin, and meta.pkl. Training then reads the binary files. This is an approachable first path because the preparation code shows how text becomes integers, but you still need to keep the data and its encoding information with your experiment.

The 38 MB measured installation isn't a storage budget for a trained model. Training writes checkpoints into the configured output directory, and the examples fetch text or pretrained weights separately. The source disables Weights & Biases logging by default, so the basic local exercise doesn't need a hosted logging credential. Enable that integration only if you want it, and configure its account separately from dataset preparation.

CPU users must override the CUDA defaults

The trainer defaults to CUDA with compilation enabled. For its smaller CPU example, the README explicitly supplies --device=cpu --compile=False and reduces the model and batch settings. Apple Silicon users get a separate mps device suggestion. Hardware choice reaches into the command you run, so copying a GPU example onto a laptop is a poor starting point even though the Python environment installs successfully.

Our 3-CPU, 8-GB sandbox establishes that the supplied setup and build steps completed on that Debian environment. It doesn't establish that the default training configuration fits that machine, or validate the README's training-time claims. If you're learning, use the documented small configuration and inspect the checkpoint output before scaling up. Match the sampling script's device and output directory to the training configuration too.

Checkpoints and Python configs remain your responsibility

The training source saves model and optimizer state, model arguments, and experiment configuration. Resume mode reconstructs the model using the stored architecture, while the configurator executes Python files to override settings. That makes experiments easy to edit. It also makes configuration executable code you should review, and it leaves you responsible for checking whether a resumed experiment preserves the behavior you care about.

The 35-package environment came without a runnable test target in our lab. That matters for changes to this small training loop: open pull request 758 proposes saving and restoring gradient-scaler state for FP16 resume. It's a contributor's proposed fix, not an upstream guarantee or a failure reproduced in our sandbox. Teams that depend on reproducible recovery should inspect the checkpoint-resume proposal before adopting this trainer unchanged.

Sampling has a reported zero-temperature failure

Open issue 738 reports a crash when GPT.generate() receives a zero temperature. The current source divides the output scores by temperature before sampling, with no zero-temperature branch. That's a specific reason to avoid assuming that every familiar generation setting has the same meaning here as in a packaged inference library. The report concerns nanoGPT's generator, and remains separate from our setup measurements.

A 2-second successful build cannot settle that sampling behavior. Read the zero-temperature report if deterministic decoding matters to your experiment, and verify your chosen sampling path before collecting results. Pretrained imports are also explicitly limited to the GPT-2 family in model.py. Developers who need a wider model catalog should start with Transformers rather than expect nanoGPT to load an arbitrary current checkpoint.

Recent contributions don't reverse the deprecation notice

The last push was November 12, 2025. GitHub returned 63,843 stars and 352 open issues and PRs, including an October 2026 proposal to repair a dataset documentation link. GitHub's latest-release endpoint returned no release. Contributor reports and proposed fixes show continued interest, but they don't supersede the maintainer's instruction to look at nanochat. Use nanoGPT when you specifically want this inspectable trainer and can own the checks around your changes.

Alternatives

ProjectWhat it isPick it when
nanochatKarpathy's recommended successor covers tokenization, training, evaluation, and conversational inference.pick this instead when starting a new project that should progress through training to a conversational model.
Transformers gh↗A model library for training and inference across a wide selection of architectures.pick this instead when access to current pretrained architectures matters more than reading a compact trainer in full.

Sources

  1. nanoGPT README and deprecation notice
  2. Repository facts and activity
  3. Training loop and checkpoint handling
  4. Character-level Shakespeare preparation
  5. Python configuration execution
  6. Model imports and sampling implementation
  7. Issue 738: zero-temperature generation crash
  8. Pull request 758: gradient-scaler checkpoint state

More llm tools reviews

IQuest-Q1 · iCode · tokenspeed · Naive-N0.5-Flash · Strata · AnyJev · the whole board →