Article complete

Andrej Karpathy Releases nanochat, a Minimal ChatGPT Clone

The repo consists of about 8,000 lines of code and covers the entire pipeline. 

A man in a checkered shirt stands confidently with arms crossed against a bright yellow background.

Key takeaways

  • Andrej Karpathy releases nanochat, an open-source ChatGPT-style model with full training pipeline.
  • Train a basic model in 4 hours for $100 on an 8×H100 GPU node.
  • Achieve GPT-2 CORE benchmark in 12 hours; enhance capabilities with $1,000 and 42 hours of training.
  • Users can interact via command-line or web UI, with performance reports generated.
  • Repository features 8,000 lines of code, including tokeniser training and optional reinforcement learning.

Takeaways drafted with AI from the article text.

OpenAI co-founder and Eureka Labs founder, Andrej Karpathy, has released nanochat, an open-source project that provides a full-stack training and inference pipeline for a simple ChatGPT-style model. The repository follows his earlier project, nanoGPT, which focused only on pretraining.

In a post on X, Karpathy said, “You boot up a cloud GPU box, run a single script and in as little as 4 hours later you can talk to your own LLM in a ChatGPT-like web UI.”

The repo consists of about 8,000 lines of code and covers the entire pipeline. It includes tokeniser training in Rust and pretraining a Transformer LLM on FineWeb. The pipeline also handles mid-training on user-assistant conversations and multiple-choice questions, supervised fine-tuning (SFT), and optional reinforcement learning (RL) with GRPO. Finally, it supports efficient inference with KV caching.

Users can interact with the model through a command-line interface or a web UI, and the system generates a markdown report summarising performance.

Karpathy explained that the models can be trained at different scales depending on time and cost. A small ChatGPT clone can be trained for around $100 in roughly 4 hours on an 8×H100 GPU node, allowing basic interaction. 

Training for about 12 hours enables the model to surpass the GPT-2 CORE benchmark. Scaling up to approximately $1,000, or around 42 hours of training, produces a model that is more coherent and capable of solving simple math and coding problems, as well as answering multiple-choice questions.

“My goal is to get the full ‘strong baseline’ stack into one cohesive, minimal, readable, hackable, maximally forkable repo. nanochat will be the capstone project of LLM101n (which is still being developed),” Karpathy said. LLM101n is an undergraduate-level class at Eureka Labs that will guide students through the process of building their own AI model. Karpathy also added that the project could grow into a research harness or benchmark, similar to nanoGPT.

Published

Spotted an error? Tell our editors. Read our editorial standards and corrections.

More in this story

Andrej Karpathy · 5 stories
  1. Andrej Karpathy Says the Pathway to AGI is Through a Language Model Operating System
  2. Andrej Karpathy Trains GPT-2 in Pure C Without PyTorch
  3. You are here: Andrej Karpathy Releases nanochat, a Minimal ChatGPT Clone
  4. Andrej Karpathy Says nanochat is ‘Entirely Hand-Written’, Not Vibe Coded
  5. In 630 Lines of Code, Andrej Karpathy Builds AI Research System Running on a Single GPU
About the author

Tech Journalist

Siddharth is a media graduate who loves to explore tech through journalism and putting forward ideas worth pondering about in the era of artificial intelligence.

All stories
Belamy · Daily

The day’s AI news, before your first meeting.