Notebooks

One lab per module, each opens in Google Colab

Start with the setup notebook, then follow the modules in order. Every notebook loads its own data from this repository, so you can open any of them cold, with two exceptions: Lab 10 starts from Lab 9’s preference data and reward model, which are not built yet, and Lab 12’s comparison with Lab 11 uses a file that Lab 11 writes.

Before Day 1

Start here · 10 minutes

Setup and environment check

Check the runtime, load optional API keys from Colab Secrets, and choose a provider.

Day 1 · Foundations

# Notebook Lecture Lab
1 Text as data Tokenization, n-gram language models, TF-IDF and linear classifiers: the count-based baseline everything else is measured against. Lecture 1 Open in Colab
2 Word vectors and neural networks From one-hot vectors to learned embeddings, with a PyTorch refresher and the first neural language model. Lecture 2 Open in Colab
3 Sequence models RNNs, LSTMs and neural language modeling, and why gradients vanish over long sequences. Lecture 3 Open in Colab
4 Seq2seq and attention Encoder-decoder models, the fixed-vector bottleneck, and attention as the fix. Lecture 4 Open in Colab

Day 2 · Transformers and pretraining

# Notebook Lecture Lab
5 The transformer Self-attention, multi-head attention and positional encodings, assembled into a small GPT. Lecture 5 Open in Colab
6 Pretraining and the Hugging Face stack Subword tokenization, masked and causal pretraining, and using pretrained models through Hugging Face. Lecture 6 Open in Colab
7 Fine-tuning and LoRA Turning a pretrained language model into an instruction follower, efficiently. Lecture 7 Open in Colab

Day 3 · Using and aligning LLMs

# Notebook Lecture Lab
8 LLMs through APIs OpenAI and Claude side by side: prompting, structured output, tool use, cost and evaluation. Lecture 8 Open in Colab
9 Reinforcement and preference learning Text generation as a reinforcement-learning problem, the policy gradient, and reward models learned from comparisons. Lecture 9 Open in Colab
10 RLHF The full reinforcement-learning-from-human-feedback pipeline, DPO, and the ways it goes wrong. Lecture 10 Open in Colab

Day 4 · Calibration, decisions, RAG

# Notebook Lecture Lab
11 Calibration What a probability should mean, how to measure it, and how to use confidence to decide when to abstain. Lecture 11 Open in Colab
12 Calibrated decisions: RLCD and Jev Training and using models for calibrated decisions: outcome rewards, thresholds from costs, and TypeSafe’s RLCD and Jev as a case study in what is and is not public. Lecture 12 Open in Colab
13 Retrieval-augmented generation Building a RAG pipeline with LlamaIndex and LangChain, and evaluating retrieval and answers separately. Lecture 13 Open in Colab

Day 5 · Agents and capstone

# Notebook Lecture Lab
14 Agents Tool-using agents as explicit graphs in LangGraph, with state, human-in-the-loop interrupts and confidence-gated control. Lecture 14 Open in Colab
15 Capstone Combine retrieval, an agent graph and calibrated control into one system, evaluate it, and explain the design. Lecture 15 Open in Colab

Notebooks are stored without outputs. Work through the cells one at a time. Runtime → Run all stops at the first exercise you have not written, which is the point: to see a whole lab run, tick WORKED_EXAMPLE in the harness cell first.

How the labs are laid out

  • Setup cell. Installs and imports. Run it first.
  • Exercises. Each has a # TODO cell for you to complete.
  • Harness. The first code cell. Run it first; it keeps the solutions from replacing your code. Tick WORKED_EXAMPLE in it to run the whole lab as a worked example instead.
  • Solutions. Folded directly beneath each exercise. Try the exercise first, then open the solution to compare. Running a solution cell stores the reference; it does not overwrite your function.
  • Checkpoints. A cell after each exercise that passes or fails and says whose code it checked: yours or the reference. If you are stuck, run exercise N’s folded solution cell, then workshop.use_reference(N), and go on with the reference solution.
  • Summary. The last code cell lists which checkpoints passed on your own code.
  • Stretch. An optional final section. Nothing later depends on it.

API keys are optional. See Setup.