Back to news

AI Tools

nanochat: Karpathy's minimal LLM training stack.

nanochat: Karpathy's minimal LLM training stack: Andrej Karpathy's nanochat trains a GPT-2 class model for about $48.

AI Kick Start editorial image for nanochat: Andrej Karpathy's minimal LLM training stack (55k stars).
Decision

Shortlist

Score tools by workflow fit, data handling, owner readiness, and cost at scale before buying seats.

Risk to watch

Shelfware

A capable tool still fails if nobody owns the workflow or checks whether it is used weekly.

Proof to collect

Pilot score

Run one real task through each shortlisted tool and record quality, time saved, and support burden.

TL;DR

nanochat is Karpathy's minimal, from-scratch training and inference stack for a small ChatGPT-style model, with roughly 55,000 GitHub stars. The README puts a GPT-2-class model at about $48 of compute; the full chat clone is closer to $100. It covers the whole loop: data, tokenisation, the training run, and inference and serving. It's built to teach. Clean Python, heavy comments, and a codebase that stays small on purpose.

Key takeaways

  • nanochat strips LLM training down to a readable, end-to-end codebase, with about 55,000 GitHub stars behind it.
  • Budget the small GPT-2-class model at roughly $48 of compute and the fuller chat clone at around $100.
  • The documented run targets an 8xH100 node in about two to four hours; the "single RTX 4090 overnight" framing is unconfirmed.
  • The real win for most teams isn't training a model. It's understanding one well enough to buy and use AI tools with confidence.
  • Briefing: Briefing There's something almost rebellious about nanochat.
  • Analysis: Analysis For a few years now, the standard story about building AI has gone like this: it's the domain of a handful of labs with budgets most companies will never see.
Table of contents

Briefing

There's something almost rebellious about nanochat (opens in a new tab). While training a large language model is rumoured to run into the millions, Andrej Karpathy's minimal training stack shows that understanding how these models actually work is within reach of anyone with a modest budget and a bit of curiosity. With around 55,000 GitHub stars (opens in a new tab), it has become the reference resource for learning what goes on inside an LLM.

Analysis

For a few years now, the standard story about building AI has gone like this: it's the domain of a handful of labs with budgets most companies will never see. nanochat pokes a hole in that. It's a single, readable codebase that takes you from raw text all the way to a working chatbot you can talk to, and the compute bill for the small version is roughly what you'd spend on a team lunch.

The author matters here. Andrej Karpathy ran AI at Tesla and was a founding member of OpenAI, and over the past few years he's spent a lot of his time teaching rather than building products. nanochat is the latest in that line of work, and the star count suggests a lot of people were waiting for exactly this.

So what's the "so what" for a business reader? You don't need to train your own model to benefit. The value is clarity. If your team can read through a project like this, the AI tools you're buying stop being a black box. You start to understand what a token is, why context windows have limits, and where the real costs sit. That makes you a sharper buyer.

The $48 Claim

The headline number is the hook. The README says you can train a GPT-2-class model for about $48 of compute (opens in a new tab), and the repo backs it up with everything you need: data preparation, tokenisation, the training loop, and inference code, all in clean Python with comments explaining the choices behind each step.

One thing worth keeping straight: the $48 figure is the GPT-2 tier. The fuller chat clone that Karpathy is best known for promoting lands closer to $100. Same project, two different rungs on the ladder, and the price you'll quote depends on which one you build.

The original article framed the run as a single GPU, an RTX 4090, finishing in roughly 24 hours. That doesn't match the documented setup. nanochat is designed to run on an 8xH100 node and finish in about two to four hours. It can be coaxed onto a single GPU using gradient accumulation, but it'll be a lot slower, and the repo never mentions a 4090. Treat the "one consumer card overnight" version as unconfirmed.

Whichever way you run it, the resulting model won't go toe to toe with GPT-4. What it will do is generate coherent text, handle basic questions (opens in a new tab), and teach you how transformers work from the ground up. That last part is the point.

What's In the Box

nanochat is a full LLM training stack (opens in a new tab), not just a demo:

Data Pipeline: Scripts for downloading and preprocessing training data from multiple sources. Includes deduplication, filtering, and quality scoring.

Tokenisation: A byte-pair encoding implementation with vocabulary building, training, and encoding/decoding. It targets GPT-2-grade capability; the exact "GPT-2 tokeniser format compatibility" isn't something the repo spells out, so read that as the intent rather than a guarantee.

Model Architecture: A clean PyTorch implementation of the GPT architecture with configurable depth, width, and attention patterns. Every layer is commented with references back to the original "Attention Is All You Need" paper.

Training Loop: Distributed training support, gradient checkpointing, mixed precision, and learning rate scheduling, plus Weights & Biases integration (opens in a new tab) for experiment tracking.

Inference Engine: Text generation with temperature sampling, top-k, top-p, and repetition penalty. Includes a simple chat interface.

Why 55,000 Stars?

A lot of it comes down to who built it. Karpathy's "Neural Networks: Zero to Hero" (opens in a new tab) series and earlier projects like nanoGPT (opens in a new tab) and llm.c (opens in a new tab) made him the person people turn to for the fundamentals. nanochat extends that work into a complete, end-to-end system.

The code reads like it was written to be read. Functions carry docstrings, the tricky sections have inline comments, and the README walks through the concepts before it drops you into the implementation. It's set up for learning, not just for running.

The Educational Vision

Karpathy has been open about the goal: make AI less of a mystery by putting the fundamentals where people can reach them. nanochat sits alongside his video lectures, blog posts, and his back-and-forth with the community. The issue tracker reads more like a classroom than a bug queue, with beginners asking questions and more experienced people answering.

Contributions are welcome, but they're curated with a firm hand. Clarity wins over features. Pull requests that pile on complexity without teaching anything tend to get a polite no, which is how the codebase stays approachable.

Getting Started

The README includes a quickstart. Note that the commands below are an illustrative example rather than a copy-paste of the current repo. The actual project has shifted to a uv-based setup with a speedrun script, so check the README for the live instructions before you run anything:

git clone https://github.com/karpathy/nanochat.git
cd nanochat
pip install -r requirements.txt
python data/prepare.py
python train.py --config configs/gpt2_small.yaml

If you've ever wondered how LLMs actually work under the hood, nanochat is a straight answer. For business teams, that understanding pays off in better tool decisions, sharper questions for vendors, and a more honest read on what AI can and can't do for you yet.

nanochat: answer-first summary

nanochat matters because it can change how Founders and operators plan, build, or govern an tool evaluation workflow. Andrej Karpathy's nanochat trains a GPT-2 class model for about $48.

The direct answer is this: do not treat the topic as a standalone trend. Treat it as a decision about inputs, outputs, review ownership, data exposure, and whether the workflow produces a result that is faster, safer, or more useful than the current process.

nanochat: implementation checklist

  • Define the user, job to be done, and success metric for the tool evaluation workflow.
  • Collect real examples, policies, source files, customer questions, or search queries before writing prompts or choosing tools.
  • Separate low-risk drafts from decisions that need approval, privacy checks, or senior review.
  • Document what the AI is allowed to access, what it must not access, and who signs off before production use.
  • Review time to value, adoption rate, cost per workflow, quality review score after a small pilot rather than judging the idea from a demo.

This keeps the work practical. It also gives search engines and AI answer engines a clean factual structure: what the topic is, who it helps, what to do next, and which risks matter before implementation.

Decision criteria for nanochat

Decision areaWhat to checkProduction signal
IntentDoes nanochat solve a real workflow problem?The use case has a named owner and measurable outcome.
DataCan the required data be used safely?Sensitive data is classified and access is controlled.
QualityCan a reviewer judge the output consistently?Examples, rubrics, or acceptance criteria exist.
ScaleCan the workflow be repeated without hero effort?The process is documented and can be handed to another team member.

Practical example for nanochat

A small business could use this article to choose one practical test. For example, a manager might take one customer-facing process, one internal document workflow, or one recurring content task and redesign only that step with AI support. The goal is not to automate the whole business at once; it is to learn where AI Tools creates reliable leverage.

The useful deliverable is a short operating note: the trigger, the source material, the prompt or tool, the review checklist, the escalation rule, and the metric. That note becomes the handover asset for staff training, SEO/GEO content, service delivery, or future agent work.

Risks and controls for nanochat

The common failure pattern is moving too quickly from a promising idea into an unmanaged workflow. For nanochat, the risk is not only bad output. It can also be unclear data permission, staff confusion, duplicate content, unreviewed customer advice, or a tool that quietly changes cost or capability.

  • Control tool sprawl with a named owner, a review step, and written acceptance criteria.
  • Control unclear pricing with a named owner, a review step, and written acceptance criteria.
  • Control vendor lock-in with a named owner, a review step, and written acceptance criteria.
  • Control unreviewed data sharing with a named owner, a review step, and written acceptance criteria.

Measurement plan for nanochat

A useful AI or SEO initiative should leave evidence. Track time to value, adoption rate, cost per workflow, quality review score and compare the pilot against the current process. If the measure does not improve, keep the learning but avoid scaling the workflow.

For GEO readiness, the page should also answer the core question directly, define the entities involved, include implementation steps, explain tradeoffs, and link readers to the next relevant AI Kick Start service, guide, tool, or article.

Definitions and entities for nanochat

For search, GEO, and staff handover, define the core entities in plain language. In this article the important entities are the workflow owner, the AI tool or model, the source material, the review process, the risk boundary, and the measurable business outcome. Clear definitions make the page easier for people to scan and easier for AI answer engines to quote accurately.

  • Workflow owner: the person accountable for deciding whether nanochat belongs in the business process.
  • Source material: the documents, examples, policies, URLs, prompts, videos, or customer questions that ground the output.
  • Review boundary: the point where a human checks accuracy, privacy, brand voice, or customer impact before the result is used.
  • Success metric: the measure that proves whether the tool evaluation workflow is worth repeating.

nanochat versus doing nothing

Doing nothing is also a decision. The cost may be slow manual work, weaker search visibility, inconsistent advice, duplicated effort, or staff using unmanaged AI tools without a shared process. The practical question is whether a controlled pilot can reduce that cost without creating a larger governance problem.

OptionWhen it makes senseWhat to watch
Do nothingThe workflow is rare, low value, or already reliable.Competitors may improve speed, content depth, or service consistency first.
Run a small pilotThe task repeats often and has clear review criteria.Keep scope tight and measure the result against the current process.
Build a production workflowThe pilot is repeatable and risk controls are documented.Assign ownership, monitoring, training, and a rollback path.

AI Kick Start handover package for nanochat

A production handover should be concrete enough that another person can run it. For nanochat, that means a short brief, a workflow map, approved prompts or tool settings, source material, a review checklist, internal links to supporting resources, and a simple measurement sheet. This is the difference between reading about AI and turning it into operational capability.

That packaging also strengthens E-E-A-T. It shows experience through implementation notes, expertise through decision criteria, authoritativeness through source-aware structure, and trust through risks, controls, and review steps. The article becomes useful even if the reader never buys a tool because it helps them make a better operational decision.

Source trail

Primary references to keep this briefing grounded

AI and automation information changes quickly. Use these official or primary references to verify the claims, pricing, product behaviour, and compliance details before committing budget or production data.

Frequently asked questions

What is the practical takeaway from nanochat?

Andrej Karpathy's nanochat trains a GPT-2 class model for about $48. For AI Kick Start readers, the key is to translate the idea into one tool evaluation workflow with clear inputs, review points, and measurable outcomes. The article should be treated as implementation guidance, not a substitute for workflow design.

Who should use nanochat guidance in AI Tools?

This guidance is most useful for Founders and operators who need to decide whether the topic changes tool selection, automation design, search visibility, data handling, training, or operational governance.

How should an Australian business implement nanochat?

Start small: compare the tool against one real task, check data handling, price the operating cost, and record the approval conditions. If the pilot improves time to value and adoption rate, document the pattern, link it to the relevant service or resource page, and then decide whether it belongs in a production workflow.

What to do next

  1. For nanochat, write down the single tool evaluation workflow this article should improve.
  2. Collect real examples, edge cases, and source material before testing nanochat with any AI output.
  3. Before implementing nanochat, add a human review checkpoint for quality, privacy, brand, or customer-impact risk.
  4. Measure time to value, adoption rate, cost per workflow for nanochat before deciding whether to scale.
  5. Connect nanochat to a related service, resource, or training path so readers have a clear next action.

Want help applying this? Explore the AI tools directory.

AI Kick Start is an Illawarra-based AI studio in Figtree, helping businesses across Wollongong, Shellharbour and Kiama and right across Australia put AI to work.

Explore with AI

Use the article as a decision prompt

Summarise this AI Kick Start article for an Australian business owner. Focus on the useful decision, the risks, and the first practical next step: nanochat: Karpathy's minimal LLM training stack

Turn this into a practical roadmap.

Use the guide as a starting point, then map the first workflow worth building.

Book an AI strategy call