All courses

Intermediate · module I9 · Sublevel Advanced

Generative AI and Large Language Models in Practice

By the end: Explain how an LLM produces text, use prompting techniques reliably, call an LLM from Python, and build a simple retrieval-based assistant

Start here
Covers
How LLMs work and how to build useful applications on top of them
Contents
4 chapters, 19 topics
Time
About 4 hours
Level
Intermediate
Your progress
0 / 19

This module builds on Neural Networks and Deep Learning Essentials. We suggest looking at it first, but the choice is yours.

Chapter 1 How LLMs Work

  1. 1.1

    What Is a Large Language Model?

    Next-token prediction at very large scale

    Interactive: predict the next token

    10 min Read Activity
  2. 1.2

    Tokens and Context Windows

    How text is split into tokens, and why limits and costs follow

    Interactive: count tokens

    8 min Read Activity
  3. 1.3

    Embeddings and Meaning

    How models represent meaning as vectors

    Interactive: semantic search demo

    10 min Read Activity
  4. 1.4

    How LLMs Are Trained

    Pre-training, instruction tuning and learning from human feedback

    Interactive: the three training stages

    10 min Read Activity
  5. 1.5

    Sampling and Temperature

    Why answers vary, and how to control it

    Interactive: change the temperature

    8 min Read Activity

Chapter 2 Prompt Engineering

  1. 2.1

    Prompting Techniques

    Zero-shot, few-shot, step-by-step reasoning and role prompts

    Interactive: compare techniques on one task

    12 min Read Activity
  2. 2.2

    Structured Outputs

    Asking for JSON and tables, and checking them

    Code: extract fields from text

    10 min Read Activity
  3. 2.3

    Testing and Improving Prompts

    Building a small test set and comparing versions

    Lab: evaluate three prompts

    12 min Read Activity

Chapter 3 Building with LLMs

  1. 3.1

    Using an LLM API from Python

    Messages, parameters, errors, cost and keeping keys safe

    Code: a homework helper

    15 min Read Activity
  2. 3.2

    Building a Chatbot with Memory

    Keeping conversation history within limits

    Code: a multi-turn chatbot

    15 min Read Activity
  3. 3.3

    Retrieval-Augmented Generation

    Answering from your own documents

    Code: a question-answering bot for a PDF

    20 min Read
  4. 3.4

    Introduction to AI Agents

    LLMs that use tools and take steps

    Code: an agent with a calculator tool

    15 min Read
  5. 3.5

    Fine-Tuning and Adapting LLMs

    When to prompt, retrieve or fine-tune, and how LoRA keeps fine-tuning cheap

    Code: count the parameters LoRA trains

    W′ = W + BA

    10 min Read Activity
  6. 3.6

    Image Generation

    How diffusion models create images, and responsible use

    Lab: create and compare images

    10 min Read Activity
  7. 3.7

    Multimodal AI Models

    Models that link images, text and audio in a shared embedding space

    Code: match pictures to captions

    10 min Read Activity

Chapter 4 Quality and Safety

  1. 4.1

    Hallucinations and Grounding

    Why LLMs invent facts and how grounding reduces it

    Lab: compare grounded and ungrounded answers

    10 min Read Activity
  2. 4.2

    Evaluating a RAG Assistant

    Hit@k, MRR, answer correctness, grounding, abstention, failure diagnosis and automated judges

    Lab: audit twenty college FAQ responses and diagnose failures

    MRR = mean of 1 ÷ rank of the first relevant passage

    25 min Read Activity
  3. 4.3

    Safety, Privacy and Cost

    Prompt injection, private data and token budgets

    Case study discussion

    10 min Read Activity
  4. 4.4

    Module Review and Assessment

    Exercises and a scored quiz

    Graded build task

    15 min Read Activity