NanoChat: Andrej Karpathy’s $100 ChatGPT Project

nanochat

Large language models have become one of the most important technologies in modern software development. However, most people only interact with AI through products like ChatGPT, Claude, or Gemini without understanding what happens behind the scenes. This is exactly the problem that NanoChat aims to solve.

Created by renowned AI researcher Andrej Karpathy, NanoChat is an open-source project that allows developers, students, and AI enthusiasts to build and train their own ChatGPT-like language model from scratch. Instead of requiring billions of dollars in infrastructure, NanoChat demonstrates how a capable conversational AI can be trained and deployed for roughly $100 in compute costs.

In this guide, we’ll explore what NanoChat is, how the project works, and how you can start experimenting with it yourself.

What Is NanoChat?

NanoChat is an open-source framework designed to provide a complete end-to-end implementation of a ChatGPT-style AI assistant. Unlike many AI repositories that focus on only one part of the machine learning pipeline, NanoChat covers the entire process, including:

  • Tokenization
  • Pretraining
  • Fine-tuning
  • Model evaluation
  • Inference
  • Chat interface deployment

The project is intentionally minimal and easy to understand. Instead of thousands of files and layers of abstraction, NanoChat focuses on keeping the codebase compact and hackable so developers can learn how modern LLM systems actually work.

Karpathy describes NanoChat as: “The best ChatGPT that $100 can buy.”

The goal isn’t to compete directly with GPT-5 or Claude. Instead, NanoChat serves as an educational platform that helps developers understand every major stage involved in creating a conversational AI system.

Who Created NanoChat?

NanoChat was created by Andrej Karpathy, one of the most influential figures in modern artificial intelligence. Karpathy is known for:

  • Formerly leading AI efforts at Tesla
  • Being a founding member of OpenAI
  • Creating popular educational AI content
  • Developing well-known projects such as nanoGPT, llm.c, and llama2.c

Over the years, Karpathy has built a reputation for simplifying complex AI concepts into practical learning resources. NanoChat continues that tradition by providing a complete, understandable implementation of a modern language model stack.

Why NanoChat Matters

Most developers working with AI today interact with APIs from OpenAI, Anthropic, or Google. While these APIs are powerful, they hide most of the underlying mechanics. NanoChat provides something different. It gives developers visibility into:

  • How tokenizers are built
  • How training datasets are processed
  • How transformer models are trained
  • How alignment and fine-tuning work
  • How inference and chat interfaces operate

For many AI engineers, NanoChat represents one of the most practical ways to move beyond prompt engineering and begin understanding the full machine learning pipeline.

NanoChat vs NanoGPT

Many developers are already familiar with Karpathy’s earlier project, NanoGPT. While both projects focus on language models, they serve different purposes.

NanoGPT

NanoGPT primarily focuses on:

  • Transformer architecture
  • Language model training
  • Educational implementation of GPT models

NanoChat

NanoChat expands the scope significantly by adding:

  • Full training workflows
  • Mid-training stages
  • Supervised fine-tuning
  • Evaluation systems
  • Inference pipelines
  • Chat interfaces

In other words, NanoGPT teaches you how to train a model, while NanoChat teaches you how to build an entire ChatGPT-like system.

The NanoChat GitHub Repository

The official NanoChat project is hosted on GitHub through Andrej Karpathy’s account.

The repository contains:

  • Training scripts
  • Tokenization tools
  • Model architectures
  • Evaluation utilities
  • Chat serving components
  • Documentation and community discussions

One of the most impressive aspects of the repository is its simplicity. Despite implementing a complete AI stack, the codebase remains relatively compact and approachable compared to many enterprise-scale machine learning frameworks.

How NanoChat Works

NanoChat follows a workflow similar to the development process used for commercial LLMs.

1. Tokenization

The first stage converts raw text into tokens that the model can understand.

2. Pretraining

The model learns language patterns from large text datasets.

This is where the model develops its understanding of grammar, facts, reasoning patterns, and language structure.

3. Mid-Training

Additional curated datasets help refine the model’s capabilities.

4. Supervised Fine-Tuning

The model learns conversational behavior by studying example interactions between users and assistants.

5. Evaluation

NanoChat includes evaluation systems that measure model performance and compare results against established benchmarks.

6. Deployment

Finally, the trained model can be served through a web-based chat interface that feels similar to ChatGPT.

How Much Does It Cost to Train NanoChat?

One of the project’s biggest attractions is cost. Karpathy demonstrates that a GPT-2-level model, which originally cost tens of thousands of dollars to train in 2019, can now be trained for approximately $50 to $100 using modern GPU infrastructure.

Of course, actual costs depend on:

  • GPU availability
  • Cloud provider pricing
  • Model size
  • Training duration

Larger models will cost more, but NanoChat shows just how much AI training has become democratized over the past few years.

How to Start Experimenting With NanoChat

If you’re interested in learning how modern LLMs work, NanoChat is one of the best projects available today.

Step 1: Clone the Repository

Visit the GitHub repository and clone it locally.

Step 2: Read the Documentation

Before running any training jobs, spend time understanding the project structure and training pipeline.

Step 3: Prepare Hardware

The recommended setup uses multiple GPUs, but NanoChat can also run on smaller configurations with longer training times.

Step 4: Run Training Scripts

The repository includes scripts that automate much of the training workflow.

Step 5: Experiment

This is where NanoChat becomes especially valuable.

You can:

  • Modify model architectures
  • Adjust training parameters
  • Use different datasets
  • Add custom behaviors
  • Explore alignment techniques

Because the codebase is intentionally minimal, it’s easier to understand the impact of each change.

Final Thoughts

NanoChat is much more than a GitHub repository. It is an educational blueprint for understanding how modern AI assistants are created. By covering tokenization, pretraining, fine-tuning, evaluation, inference, and deployment in a single project, Andrej Karpathy has created one of the most accessible introductions to full-stack LLM development available today.

Whether you’re an AI engineer, software developer, student, or simply curious about how ChatGPT works behind the scenes, NanoChat offers a rare opportunity to learn by building. And perhaps most impressively, it shows that creating your own conversational AI is no longer reserved for companies with billion-dollar budgets.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top