LogoAIRosetta

Andrej Karpathy Unveils nanochat, Launching the Micro-ChatGPT Era

GitHub

SummaryAndrej Karpathy released nanochat, an end-to-end open-source micro-LLM engineering stack covering tokenization, pretraining, mid-training, SFT, RL, inference and a Web UI. The white-box pipeline can produce a ChatGPT-style model for about $100 in roughly 4 hours.

In the field of artificial intelligence, Andrej Karpathy is without doubt a legendary figure. A former OpenAI cofounder, ex‑Director of AI at Tesla, and lecturer of Stanford’s CS231n course, Karpathy has long worked to simplify and popularize complex AI technologies. Last year, his nanoGPT project reproduced the GPT pretraining process in concise code and quickly became an essential tool for AI learners and researchers, earning tens of thousands of stars and wide acclaim. The project reproduced GPT‑2 pretraining in roughly 300 lines of code, helping countless developers understand the core mechanisms of large language models (LLMs).

Now, on October 13, 2025, Karpathy has returned with nanochat ⁠—⁠ an upgrade to nanoGPT. Upon release the project rapidly accumulated about 14,000 stars on GitHub and sparked discussions across X (formerly Twitter), Hacker News, and Medium. nanochat goes beyond pretraining to provide a complete end‑to‑end ChatGPT‑style pipeline covering tokenization, pretraining, mid‑training, supervised fine‑tuning (SFT), reinforcement learning (RL), inference, and a Web UI. Karpathy himself called it "one of the craziest repos I’ve written," highlighting its simplicity, minimal dependencies, and hackability. The project racked up tens of thousands of views in days and received enthusiastic community feedback, with many developers saying it could reshape AI education and small‑LLM research.

According to the GitHub repository description, nanochat aims to provide a "strong baseline" stack for the capstone project of Eureka Labs’ LLM101n course. It enables users with limited budgets to create their own ChatGPT clone in roughly $100 and 4 hours, a milestone for AI democratization. Authoritative outlets such as Marktechpost reported that nanochat marks a breakthrough in micro‑LLM training, substantially lowering the barrier to entry.

Project Overview: Core Features and Innovations of nanochat

nanochat is a full‑stack LLM implementation with about 8,000 lines of code, released under the MIT license, and highly modular for easy forking and modification. Unlike nanoGPT, which focused on pretraining, nanochat covers the entire pipeline from data preparation to web services. Key features include:

  • Tokenizer: A new Rust implementation of a BPE (Byte Pair Encoding) tokenizer for efficient tokenization. Reliability is validated with tests such as python ‑m pytest tests/test_rustbpe.py ‑v ‑s.
  • Pretraining: Transformer model training based on Hugging Face’s FineWeb‑EDU dataset. Evaluation uses CORE scores across benchmarks including ARC‑Challenge, ARC‑Easy, GSM8K, HumanEval, and MMLU.
  • Mid‑training and fine‑tuning: Dialogue training using the SmolTalk dataset, supporting multiple‑choice and tool use. The SFT stage optimizes chat ability, while an optional RL stage can use "GRPO" to strengthen math performance on GSM8K.
  • Inference engine: Efficient KV caching, prefill/decoding, and support for a Python interpreter sandbox tool. A CLI and ChatGPT‑style Web UI enable real‑time interaction.
  • Evaluation and reporting: Automatic generation of markdown report cards that summarize metrics and gamify progress. For example, SFT results for a ~$100 model include: ARC‑Easy≈0.388, MMLU≈0.315, GSM8K≈0.046, HumanEval≈0.085.

The model architecture is GPT‑like Transformer and supports configurable depth (e.g., ‑‑depth=26 or 30). Training FLOPs for the ~$100 tier are about 4e19, roughly corresponding to very basic conversational ability; scaling to ~$1,000 (≈41.6 hours) can reach GPT‑2 level or above. Data is sourced from Hugging Face, emphasizing open collaboration.

Compared with nanoGPT, nanochat expands to full‑stack capability, inspired in part by modded‑nanoGPT which introduced metrics and leaderboards. A Medium article called it a "surgical toolkit for large language model training," underscoring its educational value.

Installation: A Detailed Guide from Zero

Installing nanochat is relatively simple and mainly depends on PyTorch and the uv package manager. Running on cloud GPUs (such as Lambda 8xH100 nodes) is recommended, with costs around $24/hour.

  • Prepare the environment: Launch a new GPU instance (e.g., on Lambda GPU Cloud). Clone the repository:
[code] git clone https://github.com/karpathy/nanochat.git [/code]cd nanochat
  • Install dependencies: create a virtual environment with uv:
uv venvsource .venv/bin/activateuv sync

This installs PyTorch, numpy, and other core libraries with no extra pip steps required.

  • Data preparation: Download FineWeb and SmolTalk dataset shards:
[code] python -m nanochat.dataset -n 150  # for the $100 tier [code]

For larger models (e.g., $300 tier with d26), download more shards: ‑n 450.

  • Test the tokenizer: Ensure the Rust BPE works:
[code]python -m pytest tests/test_rustbpe.py -v -s [code]

If using a single GPU or low‑VRAM device, adjust device_batch_size to avoid OOM (Out of Memory). For non‑CUDA devices (such as XPU/MPS), manual adjustments are required. Hacker News discussions include user‑shared optimizations for A100 GPUs.

Usage: End‑to‑End Experience from Training to Interaction

nanochat centers around a speedrun script that enables one‑command end‑to‑end runs.

  • Quick start (Speedrun): Run in a screen session to record logs:
screen -L -Logfile speedrun.log -S speedrun bash speedrun.sh

Detach with Ctrl‑A D and monitor progress with tail speedrun.log. The $100 tier completes training, mid‑training, SFT, RL, evaluation, and inference within about 4 hours.

  • View results: After training, check the report:
cat report.md

Example tables show metrics for each stage.

  • Launch the Web UI: After activating the virtual environment:
[code] python -m scripts.chat_web [code]

Visit the URL (for example http://your‑ip:8000/) for ChatGPT‑like interaction. Example prompts: "Tell me who you are" (may produce hallucinations), "Why is the sky blue?" Tool usage is supported, such as executing Python code.

  • Training larger models: Modify speedrun.sh. Example for a d26 model:
[code] python -m nanochat.dataset -n 450 & [code]torchrun --standalone --nproc_per_node=8 -m scripts.base_train -- --depth=26 --device_batch_size=16torchrun --standalone --nproc_per_node=8 -m scripts.mid_train -- --device_batch_size=16

Omit torchrun for single‑GPU setups and use gradient accumulation instead.

YouTube videos demonstrate the full process and emphasize its entertainment and educational value. X users shared experiences training on Hyperbolic GPUs for as little as $48.

Community Response and Potential Impact

After its release, nanochat quickly reached Hacker News’ front page, with developers calling it the "best $100 ChatGPT." Karpathy’s X post received nearly 20,000 likes and hundreds of replies discussing optimization potential. Redditors speculated parts of it were written by AI, and the code contains rich comments. LinkedIn and Facebook posts highlighted the project’s open‑source value and its role in promoting AI democratization.

In terms of impact, nanochat can serve as a research tool similar to nanoGPT’s recursive self‑improvement benchmark and become a practical partner for AI practitioners. It fosters innovation in small LLMs and is suitable for edge devices and education. Product Hunt listed it as a trending product.

Conclusion: A Small Dawn for AI’s Future

The release of nanochat marks another peak in Karpathy’s contributions to AI education. It extends nanoGPT’s spirit of simplicity to a full‑stack implementation and makes the "$100 ChatGPT" vision tangible. Though not fully optimized, its hackability points to community‑driven improvements. nanochat may become an LLM benchmark and drive recursive self‑improvement. AI enthusiasts are encouraged to try it ⁠—⁠ the next breakthrough might start from your fork.

Project source: nanochat: https://github.com/karpathy/nanochat?tab=readme‑ov‑file

CopyrightStatement

Comment

Please login before commenting

NoComments

RelatedNews

LoadingMore

Andrej Karpathy Unveils nanochat, Launching the Micro-ChatGPT Era - Airosetta News