AIAny
AI Train2025
Icon for item

nanochat

Trains a full ChatGPT-style LLM from scratch on a single 8xH100 node for about $48 in ~2 hours, covering tokenization, pretraining, finetuning, RL, inference, and a web UI in one minimal, hackable codebase you can fork.

Introduction

Most "train your own LLM" repos stop at a training loop and leave you to glue together tokenizers, eval harnesses, and serving yourself. nanochat collapses the entire pipeline — tokenization, pretraining, finetuning, RL, inference, and a ChatGPT-like web UI — into one readable codebase, then makes the whole thing controllable with a single --depth knob that derives every other hyperparameter for you. The point is not raw quality; it's that a complete LLM lifecycle now fits in a code budget a single person can read in an afternoon.

What Sets It Apart
  • One dial, not fifty: --depth sets transformer layer count and auto-computes the rest, so scaling up or down is a single number rather than a config-tuning project.
  • Honest cost math: a GPT-2-grade model trains for ~$48 on 8xH100 (~2 hours), or ~$15 on spot — concrete enough to budget a real experiment instead of guessing.
  • Transparency over magic: a global COMPUTE_DTYPE replaces autocast, so precision behavior is explicit rather than hidden — valuable when you're learning why training behaves the way it does.
  • A "Time-to-GPT-2" leaderboard reframes the goal as wall-clock speedrunning, turning training efficiency into something measurable and competitive.
Who It's For

Great fit if you want to understand an LLM end-to-end by reading and modifying every stage, or need a clean baseline to fork for research and teaching. Look elsewhere if you want a production-grade model or state-of-the-art quality — the ceiling here is roughly GPT-2 capability, and the design optimizes for legibility and speed, not benchmark wins. Treat it as the spiritual successor to nanoGPT extended across the full chat pipeline, not as a drop-in chatbot.

Information

  • Websitegithub.com
  • AuthorsAndrej Karpathy
  • Published date2025/10/13

More Items

GitHub
AI Train2019

Train and experiment with multi-billion to trillion-parameter transformer models on large GPU clusters using GPU-optimized building blocks and reference training scripts; offers advanced parallelism and mixed-precision support for research teams and ML engineers.

Hugging Face
Chatbot2026

Provides a drop-in Jinja chat template for Qwen 3.5/3.6/3.8 that reduces reasoning-token waste, enforces a concise terseness system prompt, and preserves in-chat reasoning and tool-call rendering across turns. Terseness is on by default but switchable per request; no model weights are changed.

GitHub
AI Train2026

Provides a one-command CLI to fine-tune and post-train LLMs, with layer streaming that lets an 8B model be fine-tuned on a 4 GB laptop GPU. Auto-configures quantization, LoRA adapters, batching and evaluation gates, and supports export and serving workflows.