TrendWhat rose on GitHub, every day at 07:30 KST · 한국어

GitHub · as of November 8, 2026 · View on GitHub →

karpathy/nanochat

LLM training and inference harness

trending one of the last 30 days

Train and chat with a GPT-2-level language model on a $100 budget

Imagine chatting with a model you just trained in your terminal. This repository is a minimal experimental tool that handles the entire LLM training process, from tokenization to inference, on a single GPU node. It takes about two hours on eight H100 GPUs to create a GPT-2-level model, at a cost of approximately $48 (or about $15 with spot instances).

Model structure determined by a single layer count

You only need to specify the number of transformer layers via the --depth value. Based on this value, all hyperparameters such as model width, number of heads, learning rate, and training duration are automatically calculated and set to optimal states. Users only need to focus on adjusting the model size, while the remaining detailed settings are handled internally by the code. Currently, models that achieve GPT-2-level performance are generated in the range of depth 24 to 26. This design allows for experimentation based on readable and easy-to-modify code, without the need to deal with complex configuration objects or model factories.

GPT-2 arrival time leaderboard

Development focus is on optimizing the pre-training stage, which consumes the most computing resources. To this end, a leaderboard is maintained that measures the actual time taken to achieve GPT-2-grade performance. The evaluation metric is the DCLM CORE score, and the baseline GPT-2 CORE score is 0.256525. Unlike the approximately $43,000 cost for GPT-2 training in 2019, the same performance can now be achieved in about 1.5 hours on an 8XH100 node, at a cost of approximately $48 (or about $15 with spot instances). The runs/speedrun.sh script includes the full pipeline for training a model that meets this benchmark and chatting with it.

Installation and execution

Dependency management uses uv, and installation in CUDA environments is done with the uv sync --extra gpu command. For CPU or Apple Silicon (MPS) environments, use uv sync --extra cpu. If GPU memory is less than 80GB, you must reduce the --device-batch-size value to avoid out-of-memory errors. Execution is possible on a single GPU, but the time required increases eightfold.

Tools for researchers and experimenters

For research purposes, the runs/scaling_laws.sh and runs/miniseries.sh scripts are useful. An example of training a 12-layer model (GPT-1 size) for quick experiments is also provided, which completes in about 5 minutes. You can monitor validation loss (val_bpb), CORE score, VRAM usage, and model FLOPS utilization (MFU) via wandb. Precision (dtype) is automatically determined based on hardware, but it can also be manually specified using the NANOCHAT_DTYPE environment variable. bfloat16 is the default for CUDA SM 80 and above, while float32 is the default for lower versions.

Things to check before starting experiments

This repository aims to improve micro-models that work end-to-end on a budget of less than $1,000. It targets a minimal codebase that is easy to fork and modify, rather than a framework offering extensive configuration options. Therefore, it is suitable for those who want to understand the basic principles of LLM training or conduct research on increasing pre-training speed, rather than for adding specific features or building complex pipelines. If you do not have a GPU environment, execution is possible on CPU or Apple Silicon, but the model size is significantly reduced, making it difficult to obtain meaningful results. Additionally, there is a policy requiring disclosure when using AI for code contributions, so keep this in mind if you are considering contributing.

Written by AI from this repository's README on November 2, 2026. For the facts, the original on GitHub is the reference.

By the numbers

GitHub trending history
1 day between Jun 19, when Trend began recording, and Nov 8, 2026 · first on Nov 2 · best daily rank #14 (Nov 2)

Read from GitHub, as of November 8, 2026.

Language
Python
Stars
60,372
Contributors
57
Forks
8,465
Commits
441
Last commit
July 3, 2026
Open issues
28
Open pull requests
111

View on GitHub →

README badge

trend.ondo.sh · GitHub daily trending #14 · November 2, 2026

The badge above shows the highest this repository has ranked on GitHub's daily trending since June 19, 2026, and the day it did. Paste the Markdown below into your README. The badge opens this page, and it updates by itself when the repository climbs higher.

[![trend.ondo.sh](https://trend.ondo.sh/github/r/karpathy--nanochat/badge.en.svg)](https://trend.ondo.sh/github/r/karpathy--nanochat/en.html)