Free · 12 modules · 63 lessons

AI Engineering in Practice: From Calling an LLM to Writing Your Own GPT

A free AI course for developers. First build things that work with large language models, then implement neural networks and a Transformer from scratch to see why they work.

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

This course comes in two halves.

The first half teaches you to use large language models: calling APIs, writing prompts, answering questions over your own documents, building agents, and finally evaluating the result and putting it online. By the end you can build an AI application that real people use, on your own.

The second half teaches you to understand them: gradient descent and backpropagation written by hand in numpy, a small GPT built from scratch in PyTorch and trained to write classical Chinese poems, and a LoRA fine-tune done yourself. After that, words like "attention", "KV cache" and "quantization" will bring concrete code to mind instead of fog.

The halves can be taken separately. If you only want to build applications, the first part is enough. If you already build them and want the theory underneath, you can start straight at the second part.

One project runs through the course

Most of the first part builds a single thing: a Q&A assistant for the open-source library httpx, which we call RepoBot.

It starts as a command-line chat program, then learns to answer questions from the project's documentation, then to search the docs and read the source code by itself, and finally gets an evaluation set, logging and guardrails and becomes a web service. Each module adds one piece, so you watch an AI application grow step by step.

Part 1: Building with LLMs

API calls, prompting, RAG, agents, evaluation and deployment, around one real Q&A assistant project.

Module 00Before you start

Pick your route through the course, set up Python, get an API key for a large language model, and make your first call.

3 lessons
Module 01What an LLM actually is

With no math at all, work out the basic facts about large language models by experiment: tokens, next-token prediction, temperature, context and cost, embeddings, and how to choose a model.

6 lessons
Module 02Prompting

Comparison experiments that make clear how a prompt is structured, few-shot examples, thinking before answering and JSON output, ending with a small tool for testing prompts in bulk.

5 lessons
Module 03Building apps on the API

From a single call to a real program: multi-turn chat, streaming, tool calling, error retries and cost tracking, ending with the first version of the running project, RepoBot.

5 lessons
Module 04RAG, letting the model read your material

Build a retrieval-augmented generation system from scratch: chunking documents, vector search, keyword search, query rewriting, reranking, answers with citations and evaluation, and finally teach RepoBot the httpx documentation.

7 lessons
Module 05Agents

First decide whether you need an agent at all, then write one from scratch: tool design, planning and self-checking, memory, multiple agents, MCP and security, and finally teach RepoBot to read the source on its own.

9 lessons
Module 06Evaluation and going live

Build an evaluation set, use a model as a judge and calibrate it, log every step, cut cost and latency, add input and output guardrails, and finally deploy RepoBot as a web service.

6 lessons
Module 07Writing code with AI

The forms AI coding tools take and what each suits; how to use a project instructions file so it understands your project; and a dependable workflow: set acceptance criteria first, change things in small steps, and judge whether it's done by tests rather than by the AI's own account.

3 lessons

Part 2: Understanding LLMs from scratch

Backpropagation by hand, a small GPT built and trained from scratch, then LoRA fine-tuning and local deployment.

What you need to know first

  • Basic Python: functions, lists, dictionaries, classes, and installing packages with pip or uv.
  • Basic command line: cd and running a script.
  • Math: none at all for the first part. The derivatives and matrix multiplication in the second part are explained from the beginning; high-school math is enough.

No GPU is needed. The first part only calls APIs. Every experiment in the second part runs on an ordinary laptop CPU: training the small GPT takes about 7 minutes, and fine-tuning a 500-million-parameter open model takes a dozen seconds. Only the last lesson of module 10, on vLLM, needs a server with an NVIDIA GPU, and it says so.

What it costs

The first part calls an LLM API, DeepSeek by default. Running every example and exercise in the first part usually costs less than 10 CNY, about US$1.40 (at September 2026 prices). You can swap in any service with an OpenAI-compatible API, or run models locally with Ollama for free, with somewhat weaker results. The second part calls no API and costs nothing.

Where the code is

Each lesson's code is in the matching module directory under code/, and the four versions of RepoBot are under projects/repobot/. Every output shown in a lesson came from a real run while the lesson was written, and each lesson notes the date, model or software versions of that run at the top. Code that doesn't call an API uses fixed random seeds, so you should get the same numbers or very close ones.

How to get the most out of it

Type every lesson's code yourself, or at the very least run it yourself. Then do the exercises, especially the ones that say "change one thing and see what happens". Reading without doing throws away most of what this course has to offer.