L1 Beginner · Module 0: Orientation

0.3How to use this site and the labs

How the chapters are built, what the lab badges mean, how to set up your machine, and how to pick a path through 109 chapters without getting lost.

Runs on a CPU or in the browser~15 min

By the end you will be able to

  • ✓Know what each part of a chapter is for, and how to use it
  • ✓Set up a Python environment and check what your machine can run
  • ✓Choose a path through the curriculum that fits your background

This site is a field guide, not a textbook. It’s meant to be read with a terminal open next to it.

The anatomy of every chapter

  1. Concept: the idea from first principles, with the arithmetic written out. If a number appears, you should be able to reproduce it with a pencil.
  2. Animation: an interactive figure (marked ✦). Don’t just watch it: break it. Drag sliders to extremes and find where it runs out of memory, goes memory-bound, or stops paying off.
  3. Code lab: a short script in labs/<module>/<chapter>/ with exercises. Run it, then change it.
  4. Sources: the repo, paper, blog or book section the idea comes from. Go there for depth.
  5. Quiz: four questions, each with an explanation. If you miss one, reread the section it points to.

Press Mark chapter complete at the end of a chapter. Your progress is stored in this browser and shows up on the roadmap and in the sidebar.

What the lab badges mean

BadgeMeaningWhere to run it
CPUPure Python/NumPy or in-browserAny laptop
GPU optionalWorks on CPU, faster or more realistic on a GPULaptop, or a GPU if you have one
GPUCUDA, Triton, Nsight or vLLM: needs an NVIDIA GPUYour GPU, Colab/Kaggle, or a rented one

Set up your machine

Terminal window
git clone <this repo> && cd AI-INFERENCE-ENGINEERING-FROM-SCRATCH
python -m venv .venv && source .venv/bin/activate
pip install -r labs/requirements.txt
python labs/m00/0.3/check_env.py

check_env.py looks for Python, NumPy, PyTorch, a CUDA GPU, nvcc, Triton and vLLM, then tells you which lab tiers you can run:

example output (a laptop with a small NVIDIA GPU)
✔ Python ≥ 3.10
✔ numpy 2.x
– torch optional: pip install torch
– CUDA GPU NVIDIA GeForce RTX ... (install torch to use it)
– nvcc (CUDA C++) needed for .cu labs in M4–M6
You can run:
🟢 CPU labs yes
🟡 GPU-optional labs yes (CPU fallback) — and fast on your GPU
🔴 GPU-required labs yes, after installing PyTorch and the CUDA toolkit (nvcc, for .cu labs)

No NVIDIA GPU?

  • Google Colab / Kaggle notebooks: free T4 GPUs, enough for every kernel lab in Modules 4–8 and small-model serving.
  • Rented GPUs by the hour: needed only for the big serving labs (7–8B models in Modules 10–13, about 24 GB of GPU memory) and the optional H100 sessions in the capstone. A whole module usually costs a few dollars.
  • A small laptop GPU (4–8 GB): fine for all CUDA/Triton kernels and for serving 0.5–1.5B models.

Pick your path

The roadmap is ordered for someone starting from zero. If you already know some of it, skip ahead, but don’t skip the labs.

If you are…Start atYou can skim
New to LLMs and GPUsM0 → in ordernothing
An ML engineer who knows PyTorchM2 GPU first principlesmost of M1
A CUDA programmer new to LLMsM1, then M3 → M8M4–M5
A backend/infra engineerM0–M3 for the mental model, then M9 → M13, then M15M4–M8 (come back later)

Pace. The time-to-first-token course behind the serving modules assumes 30 minutes a day, 5 days a week. That is a good default here too. One chapter is roughly one session.

How the sources fit together

This curriculum stands on eight sources. Each one is strongest at a different layer of the stack from 0.1:

  • Hardware and kernels: BEFORE-GPU-ENGINEERING explains why, 100 Days of CUDA shows how in code, and Fregly’s book connects both to PyTorch.
  • Engines and serving: LLM Inference at Scale builds intuition, and time-to-first-token has you build and measure a real service.
  • At scale: the vLLM Router post and the Inference Control Plane paper cover routing, disaggregation and the control layer.

See every source and the modules that use it on the sources page.

Sources

Check your understanding

0 / 3 answered
  1. 1.A chapter is marked 🔴 GPU required and you only have a laptop. What should you do?

  2. 2.What is the best way to use an interactive figure?

  3. 3.You are a backend engineer who has never written CUDA. Which order fits you best?