← Course home

Lesson 06 of 07

What the whole pipeline costs now

nanochat is a full chat pipeline. Learn what the $48 and $43,000 figures mean, and what you can run without 8×H100.

Agent brief (llms.md)

llm.c shows what a trainer does under the framework. It does not show a full modern chat pipeline, or what that pipeline costs now. That is nanochat, "the best ChatGPT that $100 can buy." It covers tokenization, pretraining, finetuning, evaluation, and inference, and it is designed to run on a single GPU node.

The README's headline example is that you can train a GPT-2-capability model for $48, which is about 2 hours on an 8×H100 node. It puts the 2019 training cost of GPT-2 at about $43,000. Those two numbers are the ones Hao quoted. They need a little care, because they are real, sourced figures, not a receipt from OpenAI and not the current speedrun record.

What the $43,000 and the $48 mean

The $43,000 figure is Karpathy's estimate, written in the nanochat README, in dev/LEADERBOARD.md, and in Discussion 481 (31 January 2026). The arithmetic is 32 TPU v3 chips, times 168 hours (a week), times $8 per TPU v3 per hour, which equals $43,008. He cites a 2019 Reddit thread and a HuggingFace model card as sources for the hardware and time, and describes the training time as "a bit over a week." This course treats $43,000 as that estimate, not as an official OpenAI invoice.

The $48 figure is the README's cost for about 2 hours on an 8×H100 node, at about $3 per GPU per hour, so $24 per node-hour, and 2 × $24 = $48. A spot instance, the README says, can be closer to $15. The leaderboard's current record, as of 14 March 2026, is 1.65 hours, from autoresearch round 2. So $48 is a fair illustrative cost for a run of about two hours. A faster record would cost less at the same hourly rate.

The thing being compared is not "the same 2019 training job, replayed." The target is the DCLM CORE score of the original GPT-2 checkpoint, reported as 0.256525. CORE is a centered average over 22 evaluation tasks, introduced in the DataComp-LM paper. Time to GPT-2 means the wall-clock time, on 8×H100, to beat that score. The original 2019 run is listed on the leaderboard as 168 hours.

The pipeline, and what you can run

flowchart LR
  Tok["Train a tokenizer"] --> Pre["Pretrain the base model"]
      
flowchart LR
  Tok["Train a tokenizer"] --> Pre["Pretrain the base model"]
  Pre --> Eval["Evaluate CORE and bits per byte"]
      
flowchart LR
  Tok["Train a tokenizer"] --> Pre["Pretrain"]
  Pre --> Eval["Evaluate"]
  Pre --> SFT["Supervised finetune"]
  SFT --> Chat["Chat CLI or further training"]
      

One dial, --depth, sets the number of layers. The README says GPT-2 capability is around depth 26, and that width, heads, learning rate, and training horizon are derived from that depth. The speedrun script is runs/speedrun.sh. That script is meant for an 8×H100 node. The README says the same code can run on one GPU if you omit torchrun, but you should expect it to take about eight times longer. GPUs with less than 80GB of memory need a smaller --device-batch-size.

You do not need to rent 8×H100 to learn this stop. On a laptop or a single machine, install with uv, which is what the repo itself uses:

git clone https://github.com/karpathy/nanochat.git
cd nanochat
uv sync --extra cpu    # CPU or Apple Silicon MPS
# uv sync --extra gpu  # use this instead on NVIDIA CUDA
source .venv/bin/activate

The README says most of the code is ordinary PyTorch, so it should run on CPU or MPS, but those paths may have sharp edges because they are not the author's main test bed. There is a small CPU or MPS example script at runs/runcpu.sh. Use that to look around. Leave the $48 speedrun for a day when you have the right GPUs and a clear reason to spend the money.

Key concepts

  • nanochat is a small, end-to-end chat LLM pipeline: tokenizer, pretrain, finetune, evaluate, and infer.
  • The README's illustrative cost is $48 for about 2 hours on 8×H100, at about $3 per GPU per hour.
  • The $43,000 GPT-2 figure is Karpathy's estimate: 32 TPU v3 × 168 hours × $8, written up in Discussion 481 and the leaderboard docs.
  • The comparison target is GPT-2's DCLM CORE score of 0.256525, not a replay of the 2019 job.
  • As of 14 March 2026, the speedrun record is 1.65 hours on 8×H100.
  • uv is the official installer. Use --extra cpu for CPU or MPS, and --extra gpu for CUDA.

Takeaways

  • Quote the $48 and $43,000 figures with their sources, and mention the 1.65 hour record when you talk about current cost.
  • Read the pipeline and the --depth dial even if you never rent an 8×H100 node.
  • If you install the repo on a laptop, start with uv sync --extra cpu and the CPU or MPS example, not the speedrun.