Course 17 · Craft

AI engineering
Building on a model you do not control.

The parts of an LLM application that are engineering rather than magic: tokens, sampling, retrieval, tools, evaluation and cost — all of them computed and checked in the page.

24Lessons
≈ 5hReading
24Playable now
TokensPromptingRAGToolsEvaluation

0 of 24 lessons finished — nothing yet

The syllabus

24 lessons,
in the order they build on each other.

Start lesson one ↗
01

What a model actually does

Next-token prediction, and the five consequences that explain almost every surprise.

≈ 12 min
02

Tokens

Why a word is not a token, what that costs, and the cases where it changes the answer.

≈ 13 min
03

Sampling

Temperature, top-k and top-p — the knobs, computed by hand, on a real distribution.

≈ 13 min
04

The context window

A budget in tokens: what goes in, what gets dropped, and how to decide.

≈ 13 min
05

Writing the prompt

Structure, specificity and the instructions that actually change the output.

≈ 13 min
06

Examples

Choosing and ordering the demonstrations, and when they beat an instruction.

≈ 12 min
07

Structured output

A schema, a validator, and what to do with the reply that does not fit it.

≈ 14 min
08

Tool calling

The declaration, the loop, and validating arguments you did not write.

≈ 14 min
09

Agents

The loop with a budget: termination, state, and the four ways it goes wrong.

≈ 14 min
10

Embeddings

Vectors, cosine similarity, and exactly what "similar" turns out to mean.

≈ 13 min
11

Chunking

Size, overlap and boundaries — the decision that quietly decides retrieval quality.

≈ 13 min
12

Vector search

Nearest neighbours, approximate indexes, and measuring recall.

≈ 13 min
13

Keyword search

BM25, implemented — and the queries where it beats embeddings outright.

≈ 13 min
14

Hybrid retrieval

Fusing two rankings without comparing their scores, then reranking.

≈ 13 min
15

Retrieval-augmented generation

The whole pipeline, and the six places it fails in production.

≈ 15 min
16

Context engineering

Ordering, compression and the middle of a long prompt that nobody reads.

≈ 13 min
17

Evaluation

A dataset, a metric and a number — exact match, F1 and what they miss.

≈ 14 min
18

Using a model as a judge

Rubrics, pairwise comparison, and the biases that make a judge useless.

≈ 13 min
19

Evals in the pipeline

A gate on every change: drift, flakiness, and the golden set.

≈ 13 min
20

Cost and latency

Token accounting, caching, batching, and where the time actually goes.

≈ 14 min
21

Streaming

Parsing server-sent events, partial JSON, and cancelling properly.

≈ 13 min
22

Reliability

Timeouts, retries with backoff, fallbacks and idempotency for a service that fails.

≈ 13 min
23

Injection and data handling

Prompt injection, untrusted content, PII and output filtering.

≈ 14 min
24

Practice: a RAG pipeline you can measure

Chunk, index, retrieve, answer — then an eval harness that proves a change helped.

≈ 16 min