Phase 4 of 6 · Weeks 4962

Phase 4 — Generative AI

How machines generate text and images — derived, implemented and demonstrated, not described.

What you'll be able to do

  • Explain the difference between discriminative and generative models with examples you built
  • Derive the ELBO and implement a variational autoencoder
  • Explain how a diffusion model turns noise into an image, step by step
  • Turn text into vectors and build a working semantic-search demo
  • Build a retrieval-augmented generation pipeline and measure whether retrieval helped
  • Judge when fine-tuning is warranted and when prompting or retrieval is enough

What you need before you start

Assumed on day one

  • Phase 3 — transformers, attention and confident PyTorch
  • Probability from Phase 1, especially distributions and expectation
  • Comfort reading a research paper's method section

Taught here — not assumed

  • Autoencoders, denoising autoencoders and latent-space structure
  • Variational autoencoders, the reparameterisation trick and the ELBO
  • GANs and adversarial training
  • Diffusion models and the denoising process
  • Large language models, tokenisation and next-token prediction
  • Embeddings, vector search and retrieval-augmented generation

Week by week (14 weeks)

  1. W49Generative Models Overview + Autoencoders
  2. W50Variational Autoencoders
  3. W51GANs
  4. W52Diffusion I — Foundations
  5. W53Diffusion II — Modern Variants
  6. W54LLM Internals
  7. W55RLHF & Alignment
  8. W56Prompt Engineering & Reasoning
  9. W57Embeddings & Vector Stores
  10. W58Retrieval-Augmented Generation (RAG)
  11. W59RAG Evaluation
  12. W60Multimodal Models
  13. W61Inference Optimization
  14. W62GenAI Capstone

What you'll build

  • An autoencoder on MNIST with a visualised latent space
  • A VAE with latent-space interpolations you can sample from
  • A semantic-search demo over a corpus you choose
  • A RAG pipeline with a measured before/after on retrieval quality

Free, no-signup explainers and interactive demos covering this phase's ideas.

Questions about this phase

Can I start at Phase 4 if I only care about LLMs?
You can, but the derivations assume Phase 3. Without attention and backpropagation, Phase 4 becomes description rather than understanding — which is exactly what this curriculum exists to avoid.
Does this teach prompt engineering?
It teaches why prompting works — tokenisation, next-token prediction, context windows and sampling. Prompt technique follows from the mechanism rather than from a list of tricks.
Do I need paid API access?
The core work runs on open models you can run yourself. Where a hosted API is convenient, free tiers are sufficient for the exercises.

Start with a real lesson, not a sales page.

Play through a complete lesson — predict, explore the demo, prove you've got it. No account, no card.