Generative AI Lab
From how a language model writes one token at a time to how a production system is built, tested and served. Each lesson ends with a quiz.
- Level
- Beginner to Production
- Modules
- 15
- Lessons
- 64
- Time
- 37 h 25 min
- Quizzes
- 64
- Homework
- 4
- Projects
- 10
Who it is for
- Audience
- Anyone who wants to understand and build with large language models. Start at the beginning, or at a higher level if you already know the basics. The Interview path revisits the same ideas for interview preparation.
- Prerequisites
- None for the Beginner level. The homework tasks are short Python programs that run in your browser, so basic Python helps. Each lesson lists the lessons it builds on.
What you will learn
- Explain how an LLM generates text: attention, the KV-cache, tokenization and sampling.
- Pick between zero-shot, few-shot and chain-of-thought prompting for a task.
- Explain embeddings, similarity metrics and approximate nearest-neighbour search.
- Explain every stage of a RAG pipeline and its trade-offs.
- Choose a parsing and extraction approach for PDFs, tables and images, and evaluate it.
- Explain how tool calling works and design a tool-using agent.
- Apply context engineering and design agent memory.
- Design a layered defence against prompt injection that does not rely on the system prompt.
- Measure first, then reduce cost and latency, and state each lever's quality cost.
- Build and interpret evaluations of LLM systems.
- Produce a design with requirements, estimates, an evaluation plan and failure modes, raising trade-offs unprompted.
- Define an agent harness and explain why the environment around the model, not the prompt, is the unit of improvement.
- Say which job LangChain, LangGraph and LangSmith each do, and when to use a plain SDK call instead.
- Predict how fast and how cheaply a model can serve before measuring it, using FLOPs, bytes, the roofline and the KV-cache.
- Decide whether a failure justifies fine-tuning, and estimate its memory, compute and break-even before committing.
- LLM fundamentals
- Tokenization
- Embeddings
- Sampling and decoding
- Model selection
- Prompting
- Structured output
- Reasoning models
- +26 more
Curriculum
LLM foundations
Beginner3 quizzes2 homework tasks
- Explain how an LLM generates text: attention, the KV-cache, tokenization and sampling.
- Choose sensible sampling settings and compare open and closed models.
- How LLMs workCompleted30 min
- Tokenization and embeddingsCompleted25 min
- Sampling parameters and the model landscapeCompleted30 min
Prompting and structured output
Beginner2 quizzes1 homework task
- Pick between zero-shot, few-shot and chain-of-thought prompting for a task.
- Get reliable structured output and know when a reasoning model is worth its cost.
- Prompting fundamentalsCompleted25 min
- Reasoning models and structured outputsCompleted30 min
Embeddings and vector search
Beginner2 quizzes1 homework task
- Explain embeddings, similarity metrics and approximate nearest-neighbour search.
- Choose a vector store for a given scale.
- Embeddings and similarity searchCompleted25 min
- Vector databasesCompleted35 min
Retrieval-augmented generation
Intermediate6 quizzes
- Explain every stage of a RAG pipeline and its trade-offs.
- Diagnose a failing RAG system by separating retrieval from generation, and choose a RAG variant for a scenario.
- RAG architecture and chunkingCompleted30 min
- The core RAG pipelineCompleted30 min
- Better retrievalCompleted30 min
- All RAG typesCompleted35 min
- RAG evaluation and hallucinationCompleted25 min
- RAG evaluation in depthCompleted30 min
Multimodal and document AI
Intermediate1 quiz
- Choose a parsing and extraction approach for PDFs, tables and images, and evaluate it.
- Multimodal GenAI and document AICompleted35 min
Tools and agents
Advanced3 quizzes
- Explain how tool calling works and design a tool-using agent.
- Use MCP to connect tools and know its security risks.
- Function and tool callingCompleted30 min
- Agentic patterns: ReAct, planning and memoryCompleted30 min
- Model Context Protocol and tool ecosystemsCompleted35 min
Context, memory and multi-agent systems
Advanced3 quizzes
- Apply context engineering and design agent memory.
- Choose between a workflow, a single agent and multiple agents, and say how you would evaluate it.
- Context engineering and memoryCompleted35 min
- Multi-agent systems: when to use them and what they costCompleted20 min
- Agent evaluation: state, trajectory, pass^k and release gatesCompleted25 min
Safety and guardrails
Advanced2 quizzes
- Design a layered defence against prompt injection that does not rely on the system prompt.
- Guardrails, safety and prompt injectionCompleted25 min
- Limiting blast radius and treating output as untrustedCompleted25 min
Production: cost, serving and observability
Production5 quizzes
- Measure first, then reduce cost and latency, and state each lever's quality cost.
- Deploy and observe a RAG system with an eval gate and rollback.
- Cost and latency optimizationCompleted30 min
- LLM inference and servingCompleted35 min
- Observability and eval pipelinesCompleted30 min
- Production deployment of RAGCompleted30 min
- RAG security, reliability and releaseCompleted25 min
Evaluation and model adaptation
Production4 quizzes
- Build and interpret evaluations of LLM systems.
- Decide between prompting, RAG and fine-tuning, and know how LoRA, QLoRA and DPO work.
- Evaluating LLM systemsCompleted35 min
- Fine-tuning vs RAG vs promptingCompleted25 min
- Fine-tuning methods: SFT, LoRA, QLoRA and DPOCompleted25 min
- Fine-tuning data, risks and shippingCompleted20 min
GenAI system design
Production5 quizzes
- Produce a design with requirements, estimates, an evaluation plan and failure modes, raising trade-offs unprompted.
- Designing a RAG QA systemCompleted40 min
- Designing an agent productCompleted40 min
- Designing content moderation and guardrail systemsCompleted40 min
- RAG interview drills and mockCompleted60 min
- Coding, project defense and mock roundsCompleted45 min
Harness engineering
Advanced7 quizzes
- Define an agent harness and explain why the environment around the model, not the prompt, is the unit of improvement.
- Classify an agent failure by layer (context, constraint, verification, planning) and change the right layer.
- Design the loop, tools, context handling, enforcement and orchestration around a model, and prove that a change helped.
- What is an agent harness?Completed35 min
- The agent loop and tool designCompleted35 min
- Context and long-running agentsCompleted35 min
- Guides, sensors and enforcementCompleted35 min
- Orchestration, subagents and people in the loopCompleted30 min
- Evaluating and operating a harnessCompleted35 min
- Harness engineering: interview drillsCompleted40 min
LangChain ecosystem
Advanced7 quizzes
- Say which job LangChain, LangGraph and LangSmith each do, and when to use a plain SDK call instead.
- Build and reason about an agent with middleware, a state graph, persistence and human approval, including what happens when a step runs twice.
- Trace, evaluate and deploy an agent so that a release gate and a runbook decide what ships.
- The LangChain map and RunnablesCompleted35 min
- Agents, middleware and memoryCompleted40 min
- LangGraph: state, nodes, edges and control flowCompleted40 min
- LangGraph: persistence, human approval and failureCompleted40 min
- LangSmith: tracing, datasets and evaluationCompleted40 min
- LangSmith Deployment: running agents in productionCompleted40 min
- LangChain ecosystem: interview drillsCompleted40 min
Inference engineering
Production7 quizzes
- Predict how fast and how cheaply a model can serve before measuring it, using FLOPs, bytes, the roofline and the KV-cache.
- Choose and sequence the levers (quantization, kernels, batching, scheduling, parallelism, engine) by the bottleneck each attacks and the price each adds.
- Plan capacity, benchmark honestly and operate an inference service, and defend a serving design in an interview with numbers.
- Request lifecycle, metrics and the rooflineCompleted40 min
- Memory and the KV-cacheCompleted45 min
- Model and kernel optimizationCompleted45 min
- Scheduling and decodingCompleted45 min
- Distributed serving, engines and hardwareCompleted45 min
- Production operations: capacity, scaling and failureCompleted45 min
- Inference engineering: interview drillsCompleted40 min
Fine-tuning
Production7 quizzes
- Decide whether a failure justifies fine-tuning, and estimate its memory, compute and break-even before committing.
- Plan the data, method, training run and evaluation gate for a tuning job, and say what each lever costs.
- Defend a fine-tuning plan in an interview: the baseline, data, method, cost, evaluation gate and rollback, stated without prompting.
- When to tune, and what it costsCompleted40 min
- Data engineering for fine-tuningCompleted40 min
- PEFT, LoRA and QLoRA in depthCompleted45 min
- Training practice and distributed trainingCompleted40 min
- Alignment and preference optimisationCompleted45 min
- Evaluation, deployment and special casesCompleted45 min
- Fine-tuning: interview drillsCompleted45 min
Study materials
Everything below belongs to this course and lives on its own page. The numbers are counted from the course.
- Interview prep12 question banks466 questionsPractise answering out loud, with the reasoning behind each answer.
- Quizzes64 quizzes697 questionsCheck yourself after a lesson; every answer is explained.
- Flashcards575 cards15 module decksReview what you have read, a few cards at a time.
- Cheat sheets15 cheat sheetsOne page per module, for a quick look before you build.
- Glossary292 termsPlain definitions of the vocabulary, linked from the lessons.
- Code snippets34 code blocksEvery code block from the lessons in one place.
- Resources171 sources12 sectionsPapers, docs and tools for further reading.
- Homework4 homework tasksRuns in your browser: 4Short exercises with tests that tell you when you are done.
- Projects10 projectsBuild something that puts several lessons to work.
- Learning paths9 pathsA sensible order through the modules for your level or goal.
- Your study tools
- My notes
- My progress