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

  1. LLM foundations3 lessons · 1 h 25 min

    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.
    1. How LLMs work30 min
    2. Tokenization and embeddings25 min
    3. Sampling parameters and the model landscape30 min
  2. Prompting and structured output2 lessons · 55 min

    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.
    1. Prompting fundamentals25 min
    2. Reasoning models and structured outputs30 min
  3. Embeddings and vector search2 lessons · 1 h

    Beginner2 quizzes1 homework task

    • Explain embeddings, similarity metrics and approximate nearest-neighbour search.
    • Choose a vector store for a given scale.
    1. Embeddings and similarity search25 min
    2. Vector databases35 min
  4. Retrieval-augmented generation6 lessons · 3 h

    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.
    1. RAG architecture and chunking30 min
    2. The core RAG pipeline30 min
    3. Better retrieval30 min
    4. All RAG types35 min
    5. RAG evaluation and hallucination25 min
    6. RAG evaluation in depth30 min
  5. Multimodal and document AI1 lesson · 35 min

    Intermediate1 quiz

    • Choose a parsing and extraction approach for PDFs, tables and images, and evaluate it.
    1. Multimodal GenAI and document AI35 min
  6. Tools and agents3 lessons · 1 h 35 min

    Advanced3 quizzes

    • Explain how tool calling works and design a tool-using agent.
    • Use MCP to connect tools and know its security risks.
    1. Function and tool calling30 min
    2. Agentic patterns: ReAct, planning and memory30 min
    3. Model Context Protocol and tool ecosystems35 min
  7. Context, memory and multi-agent systems3 lessons · 1 h 20 min

    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.
    1. Context engineering and memory35 min
    2. Multi-agent systems: when to use them and what they cost20 min
    3. Agent evaluation: state, trajectory, pass^k and release gates25 min
  8. Safety and guardrails2 lessons · 50 min

    Advanced2 quizzes

    • Design a layered defence against prompt injection that does not rely on the system prompt.
    1. Guardrails, safety and prompt injection25 min
    2. Limiting blast radius and treating output as untrusted25 min
  9. Production: cost, serving and observability5 lessons · 2 h 30 min

    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.
    1. Cost and latency optimization30 min
    2. LLM inference and serving35 min
    3. Observability and eval pipelines30 min
    4. Production deployment of RAG30 min
    5. RAG security, reliability and release25 min
  10. Evaluation and model adaptation4 lessons · 1 h 45 min

    Production4 quizzes

    • Build and interpret evaluations of LLM systems.
    • Decide between prompting, RAG and fine-tuning, and know how LoRA, QLoRA and DPO work.
    1. Evaluating LLM systems35 min
    2. Fine-tuning vs RAG vs prompting25 min
    3. Fine-tuning methods: SFT, LoRA, QLoRA and DPO25 min
    4. Fine-tuning data, risks and shipping20 min
  11. GenAI system design5 lessons · 3 h 45 min

    Production5 quizzes

    • Produce a design with requirements, estimates, an evaluation plan and failure modes, raising trade-offs unprompted.
    1. Designing a RAG QA system40 min
    2. Designing an agent product40 min
    3. Designing content moderation and guardrail systems40 min
    4. RAG interview drills and mock60 min
    5. Coding, project defense and mock rounds45 min
  12. Harness engineering7 lessons · 4 h 5 min

    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.
    1. What is an agent harness?35 min
    2. The agent loop and tool design35 min
    3. Context and long-running agents35 min
    4. Guides, sensors and enforcement35 min
    5. Orchestration, subagents and people in the loop30 min
    6. Evaluating and operating a harness35 min
    7. Harness engineering: interview drills40 min
  13. LangChain ecosystem7 lessons · 4 h 35 min

    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.
    1. The LangChain map and Runnables35 min
    2. Agents, middleware and memory40 min
    3. LangGraph: state, nodes, edges and control flow40 min
    4. LangGraph: persistence, human approval and failure40 min
    5. LangSmith: tracing, datasets and evaluation40 min
    6. LangSmith Deployment: running agents in production40 min
    7. LangChain ecosystem: interview drills40 min
  14. Inference engineering7 lessons · 5 h 5 min

    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.
    1. Request lifecycle, metrics and the roofline40 min
    2. Memory and the KV-cache45 min
    3. Model and kernel optimization45 min
    4. Scheduling and decoding45 min
    5. Distributed serving, engines and hardware45 min
    6. Production operations: capacity, scaling and failure45 min
    7. Inference engineering: interview drills40 min
  15. Fine-tuning7 lessons · 5 h

    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.
    1. When to tune, and what it costs40 min
    2. Data engineering for fine-tuning40 min
    3. PEFT, LoRA and QLoRA in depth45 min
    4. Training practice and distributed training40 min
    5. Alignment and preference optimisation45 min
    6. Evaluation, deployment and special cases45 min
    7. Fine-tuning: interview drills45 min

Study materials

Everything below belongs to this course and lives on its own page. The numbers are counted from the course.