Module 00 · Lesson 1

How to take this course

The course has two parts, "building with LLMs" and "understanding LLMs from scratch". Pick a route for your goal, learn how each lesson is laid out, and what to do when you hit an error.

  • About 15 min
  • Level: Beginner
  • Tested: No code to run

Code and program output are shown exactly as they ran, so comments and printed output are in Chinese.

Most people who learn AI get stuck in one of two places. Some have read plenty about how large models work and can talk fluently about attention and Transformers, but have never called an API themselves, let alone built something useful. Others can glue a chatbot together from frameworks, but when the results are poor all they can do is try another prompt and hope, because they don't know what is happening underneath.

This course wants you to have both: to build things, and to know why they work and why they break.

Two parts

Part 1: Building with LLMs (modules 00–07). It starts with your first API call and goes through prompting, tool calling, RAG (letting the model read your own material) and agents, and ends with evaluation and deployment. This part only calls APIs. It needs no GPU and no math.

Most of the first part revolves around one project: a Q&A assistant for the open-source HTTP library httpx, which we call RepoBot. It starts as a small command-line program that can only chat, and grows version by version: first it learns to answer questions from the httpx documentation, then to find answers in the source code by itself, and finally it gets an evaluation set and logging and can go online for other people to use.

Part 2: Understanding LLMs from scratch (modules 08–11). You write gradient descent and backpropagation by hand in numpy, build a small GPT from scratch in PyTorch, and train it on Tang poetry until it writes a few passable lines of its own. Then you write LoRA by hand, fine-tune a real open model, and run a model on your own machine.

Using first and theory second is deliberate. Getting your first API call to work takes ten minutes; building your first assistant that reads documentation takes about three weeks. With that sense of achievement behind you, and some concrete problems in hand ("why does it keep inventing function names?"), you'll know what you're looking for when you come back to the theory.

Choose a route

Your situation Suggested route
You know Python and want to use AI in a product or to work faster Take Part 1 (00–07); look at Part 2 later if you're curious
You already build AI applications and want the theory Start Part 2 at 08; look things up in Part 1 when an application concept is unfamiliar
You want the whole thing, systematically Take everything in order. At 6–8 hours a week, about two and a half months
You only want to learn to write code with AI 00 → 01 → 07, a weekend is enough

The modules in Part 1 depend on each other: 04 RAG uses the chat and tool calling from 03, and 05 Agents uses 03 and 04. In Part 2, take 08 and 09 in order too. The other modules can be read in any order.

What a lesson looks like

Each lesson starts with a concrete problem: where you'll get stuck if you don't learn this. Then it explains the idea and moves on to code. Wherever something can be written by hand, you first write the simplest version without any framework, and then see which step it corresponds to in an existing library. That way no framework stays a black box.

The second half of a lesson covers when the method works poorly and the usual traps, and it ends with exercises and a self-check. The self-check answers are folded away; decide on your answer before you open them.

Every program output shown in the course came from a real run while the lesson was written. The verified field at the top of each lesson gives the date and model of that run. When an example calls an LLM, your output will differ from the one in the lesson; that's normal, and the next module explains why. Code that doesn't call an LLM, such as the neural-network training in Part 2, uses fixed random seeds, so you should get exactly the numbers in the lesson.

How to do the work

Always run the code yourself. Ideally type it out; at the very least copy it and run it, then change it: ask a different question, change a parameter, see how the result moves. The complete code for every lesson is in the code/ directory, but treat it as the answer key to check against, not as the place to start.

Exercises come in levels. The first is usually "change one thing and see what happens" and takes a few minutes; do all of those. The last usually asks you to write a small feature yourself; pick the ones that interest you.

When you hit an error

Errors are part of learning, so don't panic. Work through them in this order:

  1. Read the last line. Python error messages are long, but the real cause is almost always on the last line. For example, openai.AuthenticationError: Error code: 401 means the key is wrong, and ModuleNotFoundError: No module named 'openai' means the package isn't installed, or was installed into a different environment.
  2. Find which line of your code the error points to. Scroll up to the first line that mentions a file of your own; the problem is usually around there.
  3. Compare with the code in the lesson. Go through it line by line, looking for a typo or a missing line.
  4. Search for the complete error message, or ask an AI. The complete message, that is, not just "it errored".

Using AI to help you learn is a good idea. If you can't follow some code, ask it to explain line by line; if an idea won't click, ask it to explain from another angle or with a different example. But please write the exercises yourself. Having AI do your exercises is like paying someone to go to the gym for you: they're the one who builds the muscle.

What it costs

Part 1 calls an LLM API. The course uses DeepSeek by default, because it can be signed up for and paid for directly from mainland China, and it's cheap. At September 2026 prices, all the examples and exercises in Part 1 usually cost less than US$1 in total. The next lesson shows how to get a key, and also how to switch to Qwen or Kimi, or run models for free on your own computer with Ollama.

Part 2 costs next to nothing. The small GPT trains to a result in a few minutes on an ordinary laptop CPU. Only when module 10 fine-tunes a real open model is a free cloud GPU suggested, and the lesson explains how to use one.

Exercises

  1. Look over the course contents, choose your route with the table above, and write down how many hours a week you plan to spend and on which day.
  2. Think of something small you'd like to build with AI, such as "tidy up my weekly meeting notes" or "answer questions about our team's docs". Write it down. When you reach the end of Part 1, come back and see whether you can build it. There's no standard answer to this one.

Self-check

1. Why does this course teach using LLMs before the theory?

Once you've built something that works, you run into concrete problems, such as the model inventing a function that doesn't exist or contradicting itself. Learning the theory with those problems in mind, you know which answers you're looking for, so it sticks better, and you're less likely to give up halfway through a pile of math.

2. You call an LLM with the code from the lesson and get a different answer from the one shown. Did you do something wrong?

Not necessarily. LLM output is random by nature; ask the same question twice and you can get two different answers (lesson 3 of module 01 explains why). As long as the program doesn't error and the answer roughly makes sense, you did it right. Code that doesn't call an LLM uses fixed random seeds, and its numbers should match the lesson exactly.

3. Running your code produces a long wall of error text. Where do you look first?

At the last line. It usually states the error type and the cause directly. Then scroll up to the first line mentioning one of your own files to find which line of code failed.

Questions and discussion

Stuck on this lesson? Ask here. If you can answer someone else's question, please do.

A question earns 3 points, answering someone earns 6. Posts appear once reviewed.

Loading the discussion…