Free courseBeginner to advanced

How to Build Claude from Scratch

Understand how modern AI assistants work and build your own Claude-like AI system from the ground up.

  • 12modules
  • 98lessons
  • 27 h 21 minreading
  • ~68 hwith exercises

The 12 modules

  1. 1 Understanding Claude and Modern AIThe map before the journey: what an AI assistant really is, how a message becomes an answer, and the vocabulary (tokens, context, embeddings) the rest of the course builds on. 6 lessons⏱ 1 h 40 minBeginner
    1. 1.1What is Claude?19 min · Beginner
    2. 1.2What is an LLM?16 min · Beginner
    3. 1.3How ChatGPT, Claude, Gemini and other AI assistants work16 min · Beginner
    4. 1.4AI, machine learning, deep learning, transformers and LLMs13 min · Beginner
    5. 1.5What happens when you send a message to an AI?16 min · Beginner
    6. 1.6Tokens, context windows and embeddings20 min · Beginner
    Open module 1 →
  2. 2 Mathematics and FoundationsJust enough maths to read any transformer paper: every idea is shown as a picture first, then as an equation, then as a few lines of NumPy. 6 lessons⏱ 1 h 41 minBeginner → Intermediate
    1. 2.1Essential linear algebra15 min · Beginner
    2. 2.2Vectors, matrices and matrix multiplication16 min · Beginner
    3. 2.3Probability and statistics15 min · Beginner
    4. 2.4Softmax, gradients and loss functions18 min · Intermediate
    5. 2.5Neural networks and backpropagation20 min · Intermediate
    6. 2.6Practical Python demonstrations17 min · Intermediate
    Open module 2 →
  3. 3 Build a Neural Network from ScratchNo frameworks: we write every neuron, every derivative and every update by hand, then watch the network learn. 7 lessons⏱ 2 h 8 minBeginner → Intermediate
    1. 3.1Set up Python and NumPy17 min · Beginner
    2. 3.2Build neurons and layers15 min · Intermediate
    3. 3.3Implement forward propagation14 min · Intermediate
    4. 3.4Implement backpropagation19 min · Intermediate
    5. 3.5Implement gradient descent15 min · Intermediate
    6. 3.6Train a small neural network without PyTorch or TensorFlow19 min · Intermediate
    7. 3.7Visualize training and loss29 min · Intermediate
    Open module 3 →
  4. 4 Understanding TransformersThe architecture behind every modern LLM, taken apart piece by piece, with attention you can poke at and a working transformer block in NumPy. 9 lessons⏱ 2 h 20 minIntermediate → Advanced
    1. 4.1Why traditional RNNs have limitations16 min · Intermediate
    2. 4.2The transformer architecture14 min · Intermediate
    3. 4.3Tokenization and embeddings18 min · Intermediate
    4. 4.4Positional encoding13 min · Intermediate
    5. 4.5Self-attention and multi-head attention17 min · Advanced
    6. 4.6Query, Key and Value explained visually14 min · Intermediate
    7. 4.7Feed-forward networks13 min · Intermediate
    8. 4.8Layer normalization and residual connections13 min · Advanced
    9. 4.9Implement a simplified transformer in NumPy22 min · Advanced
    Open module 4 →
  5. 5 Build a GPT-like Language ModelWe put the pieces together into a real (tiny) language model, train it on a small text, generate with it, and look honestly at why it makes things up. 9 lessons⏱ 2 h 46 minIntermediate → Advanced
    1. 5.1Tokenizer implementation19 min · Intermediate
    2. 5.2Vocabulary creation14 min · Intermediate
    3. 5.3Dataset preparation14 min · Intermediate
    4. 5.4Next-token prediction14 min · Intermediate
    5. 5.5Building a decoder-only transformer27 min · Advanced
    6. 5.6Training a tiny language model32 min · Advanced
    7. 5.7Text generation and temperature16 min · Intermediate
    8. 5.8Top-k and top-p sampling13 min · Intermediate
    9. 5.9Understanding hallucinations and limitations17 min · Intermediate
    Open module 5 →
  6. 6 How Claude Is DifferentA pretrained model is not an assistant. This module covers the publicly documented techniques that turn one into a helpful, honest and harmless assistant, and is clear about what Anthropic has not published. 9 lessons⏱ 2 h 19 minIntermediate → Advanced
    1. 6.1Claude's architecture at a conceptual level16 min · Intermediate
    2. 6.2Constitutional AI18 min · Intermediate
    3. 6.3Supervised fine-tuning14 min · Intermediate
    4. 6.4Reinforcement learning from human feedback17 min · Advanced
    5. 6.5Preference optimization13 min · Advanced
    6. 6.6Safety training and alignment13 min · Intermediate
    7. 6.7System prompts and instruction following14 min · Intermediate
    8. 6.8Long-context processing12 min · Advanced
    9. 6.9Tool use and agentic behavior22 min · Intermediate
    Open module 6 →
  7. 7 Build Your Own AI AssistantThe part users see. We design and build a chat interface with plain web technology, and handle the hard details: streaming, history that fits the context window, safe Markdown and failures. 10 lessons⏱ 2 h 10 minBeginner → Intermediate
    1. 7.1Design a Claude-like chat interface14 min · Beginner
    2. 7.2Conversation management13 min · Intermediate
    3. 7.3System instructions11 min · Intermediate
    4. 7.4Chat history and context management12 min · Intermediate
    5. 7.5Streaming responses14 min · Intermediate
    6. 7.6Markdown and code rendering11 min · Intermediate
    7. 7.7Syntax highlighting11 min · Intermediate
    8. 7.8Error handling13 min · Intermediate
    9. 7.9File upload and document understanding concepts12 min · Intermediate
    10. 7.10Building a frontend chatbot19 min · Intermediate
    Open module 7 →
  8. 8 Memory and RAGA model only knows its training data and what is in the prompt. This module teaches the two ways around that: memory and retrieval, built from scratch so nothing is magic. 8 lessons⏱ 2 h 32 minBeginner → Intermediate → Advanced
    1. 8.1What is AI memory?16 min · Beginner
    2. 8.2Short-term vs long-term memory21 min · Intermediate
    3. 8.3Embeddings and vector databases19 min · Intermediate
    4. 8.4Semantic search19 min · Intermediate
    5. 8.5Retrieval-Augmented Generation (RAG)16 min · Intermediate
    6. 8.6Chunking and document retrieval17 min · Intermediate
    7. 8.7Build a basic document Q&A system26 min · Advanced
    8. 8.8Context injection and source citations18 min · Intermediate
    Open module 8 →
  9. 9 Function Calling and AI AgentsA model that can only write text becomes an agent when it can ask your code to do things. We build the loop, the tools and, just as important, the limits. 9 lessons⏱ 2 h 44 minIntermediate → Advanced
    1. 9.1What is function calling?16 min · Intermediate
    2. 9.2Tool definitions and JSON schemas16 min · Intermediate
    3. 9.3Calling external tools18 min · Intermediate
    4. 9.4Tool execution loops17 min · Advanced
    5. 9.5Search, calculator and other tools21 min · Intermediate
    6. 9.6Multi-step reasoning and planning17 min · Advanced
    7. 9.7Agent architecture14 min · Advanced
    8. 9.8Safety restrictions and tool permissions18 min · Advanced
    9. 9.9Build a basic tool-using AI agent27 min · Advanced
    Open module 9 →
  10. 10 Fine-Tuning and TrainingWhat it takes to change what a model knows or how it behaves, with honest numbers: what fits on your laptop, what needs a rented GPU, and what only a frontier lab can afford. 8 lessons⏱ 2 h 23 minIntermediate → Advanced
    1. 10.1Pretraining vs fine-tuning19 min · Intermediate
    2. 10.2Dataset collection and cleaning20 min · Intermediate
    3. 10.3Instruction datasets18 min · Intermediate
    4. 10.4Fine-tuning concepts16 min · Advanced
    5. 10.5LoRA and QLoRA23 min · Advanced
    6. 10.6GPU and VRAM requirements14 min · Advanced
    7. 10.7Training costs and realistic hardware requirements13 min · Intermediate
    8. 10.8Model evaluation and benchmarking20 min · Advanced
    Open module 10 →
  11. 11 Deployment and ProductionFrom "it works in a notebook" to a service people can rely on: making inference fast and cheap, running open models locally, and operating an AI API safely. 9 lessons⏱ 2 h 36 minIntermediate → Advanced
    1. 11.1Model inference18 min · Intermediate
    2. 11.2Quantization17 min · Advanced
    3. 11.3CPU vs GPU inference16 min · Intermediate
    4. 11.4Running open-source LLMs locally13 min · Intermediate
    5. 11.5Ollama and Hugging Face concepts12 min · Intermediate
    6. 11.6API design22 min · Intermediate
    7. 11.7Docker deployment13 min · Intermediate
    8. 11.8Monitoring and logging15 min · Intermediate
    9. 11.9Security, rate limiting and cost optimization30 min · Advanced
    Open module 11 →
  12. 12 Final Capstone Project: Your Own Claude-like AssistantEverything comes together: a complete assistant that runs in the browser, talks to a model provider you choose (including a local open model), reads your documents, remembers and uses tools. 8 lessons⏱ 2 h 2 minIntermediate → Advanced
    1. 12.1Capstone overview and architecture16 min · Intermediate
    2. 12.2The conversational UI13 min · Intermediate
    3. 12.3Conversation history and system prompts16 min · Intermediate
    4. 12.4Streaming output with Markdown and code15 min · Advanced
    5. 12.5Configurable model providers and error handling17 min · Advanced
    6. 12.6Document Q&A and memory13 min · Advanced
    7. 12.7Tool calling16 min · Advanced
    8. 12.8Testing, deployment and the capstone challenge16 min · Advanced
    Open module 12 →

What you will be able to do

An honest note before you start

What "build Claude from scratch" means here

You will build every kind of part a Claude-like assistant has: the model architecture, training, sampling, the chat application, retrieval, memory and tools. Your model will be tiny, trained in seconds on a few kilobytes of text. It shows how the real thing works; it is not a replacement for it.

What this course does not claim

Claude is made by Anthropic. Its exact architecture, size, training data and training recipe are not public, and this course does not pretend to know them. Module 6 separates what Anthropic has published (for example Constitutional AI) from general industry practice and from what is unknown.

The scale of frontier models

Training a frontier model takes thousands of specialised GPUs running for months, trillions of tokens of data and budgets in the tens to hundreds of millions of dollars. The practical path for an individual is to use an existing model through an API or run an open-weight model locally, and to fine-tune small models with LoRA. Module 10 has the numbers.

How the course works

Who it is for

You can write basic code in any language (variables, loops, functions). You do not need a maths degree or any AI experience: each idea starts with an analogy and the intuition, then the equation, then the code. Lessons are marked Beginner, Intermediate or Advanced.

Every lesson has

Learning objectives, an explanation with an analogy and a deeper technical part, diagrams or an interactive demo, real code explained line by line with the output you should see, common mistakes, an exercise with hints, and a knowledge check.

Running the code

Python examples use only Python 3 and NumPy and were run before publishing. Many have a ▶ Run button that runs them in your browser with Pyodide (a Python runtime of about 15 MB, downloaded only if you press it). The expected output is always shown, so you can follow along without running anything.

Your progress

Mark lessons complete, bookmark the ones to revisit, search every lesson, and resume where you stopped. Progress is saved in this browser only (localStorage); there is no account and nothing is sent anywhere. You can delete it on the privacy page.

The capstone: your own assistant

Module 12 brings everything together into one application you can keep using: a responsive chat interface with conversation history, streaming replies, Markdown and highlighted code, editable system prompts, document question answering with citations, long-term memory, tool calling, clear error handling and a switch between model providers: a built-in offline demo model, an open model running on your own computer with Ollama, or any OpenAI-compatible endpoint you configure. It runs as static files with no server of its own.

See the capstone module →

Frequently asked questions

Is this course really free?

Yes. There is no sign-up, no paywall and no paid API is required. The optional exercises that call a hosted model say so and offer a free local alternative (an open model with Ollama).

Will I have built Claude at the end?

No, and no course can give you that. You will have built a small working language model that shows every core idea, and a complete assistant application that can use a real open-weight model or an API. You will understand what makes frontier assistants different: scale, data, and the post-training that teaches them to be helpful, honest and harmless.

What do I need on my computer?

For modules 1 to 6: Python 3.10 or newer and NumPy (pip install numpy), or just your browser with the ▶ Run buttons. For modules 7 to 9 and 12: a text editor and a browser. Running local models (module 11) works best with 16 GB of RAM; a GPU helps but is not required for small models.

How long does it take?

The reading time is shown on every lesson. Doing the exercises and mini-projects roughly doubles or triples it; the overview's estimate assumes about two and a half times the reading time.

Do I need to do the modules in order?

Modules 1 to 5 build on each other. If you only want to build applications on top of existing models, you can read module 1, skim module 6 and jump to module 7.