Course 7 of 7 · Advanced

Generative AILLMs, RAG, agents and diffusion, measured.

Every mechanism runs first on a model you train yourself, then on a real open-weight model, and every prompt, retriever and agent is scored on an evaluation set.

Lessons in this course are being published. The syllabus below lists every module and lesson.

13modules
54lessons planned

Who Generative AI is for and what you will learn

This track is for you if

  • You can train a neural network and want to know how large language models actually work.
  • You build on LLMs and want to measure prompts, retrieval and agents, not judge them on a few examples.
  • You need to ship an LLM application that is evaluated, affordable and secure.

By the end you can

  • Train and inspect a small GPT and a small diffusion model.
  • Explain how a large language model is pretrained and post-trained, from supervised fine-tuning to preference optimisation and reasoning models.
  • Build retrieval-augmented generation, tool use and agents, and measure them on an evaluation set.
  • Choose between prompting, retrieval and fine-tuning, and fine-tune an open model with LoRA.
  • Secure an LLM application against prompt injection, and measure the defence.

Before you start

The Deep Learning course's Modules 0 to 6: the training loop, embeddings, attention and the transformer, and fine-tuning a pretrained transformer. The application modules also use the Machine Learning course's evaluation and production lessons, and re-establish what they need.

Each lesson is free to read once it opens. As in every track, the opening modules are a free sample: a free account opens all of their material. Pro adds it for the rest of the course.

The syllabus13 modules, each ending in its own finish line.

Every lesson is listed, including the ones still in production, so you can see where the track goes. Open lessons have their parts and key terms free to read, and their quiz free with an account.

  1. Module 0 · 1 lesson · planned

    The Result First

    1. 0.1What Generative AI IsWatch a language model produce a reply one token at a time from a probability distribution, and an image model produce a picture from noise, and say what "generative" means.
      What it will cover
      • A real open-weight model given a prompt: the top ten next-token probabilities, one sampled, appended, repeated
      • An image model's sampling steps, from noise to picture
      • A generative model is a model of the data's distribution that can be sampled; against the classifiers of the ML track (ML 6.3)
      • What these systems are used for, and where they fail: invented facts, cost, security
      • What the track opens, in order
      Planned
  2. Module 1 · 5 lessons · planned

    Language Modelling

    1. 1.1Language Models: Predicting the Next TokenEstimate the probability of the next token from counts, score a model by perplexity, and generate text by sampling.
      What it will cover
      • The problem: assign a probability to any text; the unigram model as the baseline
      • The bigram table counted from the books, each row a distribution over the next character
      • The probability of a sentence as a product of conditional probabilities; its log (Maths 1.2)
      • Cross-entropy and perplexity on held-out text (Stats 7.2)
      • Sampling from the table, character by character; why the text makes no sense past a few characters
      • The same model as a one-layer network trained by gradient descent, matching the counts
      Planned
    2. 1.2Tokenisation: Byte-Pair EncodingBuild a BPE tokeniser by hand, and predict how a real tokeniser splits words, numbers and code.
      What it will cover
      • Characters, words and subwords: vocabulary size against sequence length
      • Bytes as the base vocabulary, so every text can be encoded
      • BPE merges run step by step on a four-word corpus, then trained on the books
      • A real tokeniser's splits: common words, rare words, numbers, code, and languages other than English
      • Why models miscount letters and digits: they see tokens
      • Common mistake: estimating context and cost in words or characters instead of tokens
      Planned
    3. 1.3Training a Small GPTTrain a decoder-only transformer on real text, and watch its samples and perplexity improve against the bigram model.
      What it will cover
      • The problem: the same next-token task; the bigram model's perplexity as the baseline
      • The decoder-only transformer: token and position embeddings, causal self-attention (DL 6.2), blocks (DL 6.3), the output softmax over the vocabulary
      • The training set built by shifting each sequence by one token
      • Training on the stories: the loss curve, and samples at four checkpoints
      • Perplexity against the bigram model on held-out stories
      • Failure modes: repetition, loss of coherence past the context length, memorised training text
      • Code: the full model in one file of PyTorch
      Planned
    4. 1.4Sampling and DecodingControl what a model generates with temperature, top-k and top-p, and measure the trade-off between diversity and quality.
      What it will cover
      • Greedy decoding and its repetition
      • Temperature: the softmax sharpened and flattened, its distribution redrawn at each value
      • Top-k and top-p (nucleus) truncation computed on one real distribution
      • Repetition penalties; beam search named for translation
      • Diversity and quality measured over many samples at each setting
      • Seeds: when the same prompt gives the same output, and when it cannot
      Planned
    5. 1.5The KV Cache and the Cost of GenerationSee why generating each new token reuses the keys and values already computed, and calculate the memory and time it costs.
      What it will cover
      • Recomputing attention for the whole sequence at every step, counted
      • Caching keys and values: prefill against decode
      • Memory per token computed from layers, heads and head size; a long context's cache in gigabytes
      • Tokens per second measured with and without the cache
      Planned
  3. Module 2 · 5 lessons · planned

    Large Language Models

    1. 2.1Pretraining at ScaleKnow what goes into pretraining a large model, and see what a base model does and does not do.
      What it will cover
      • The data: web text, books, code; filtering, deduplication and the mixture
      • The compute: tokens, parameters and floating-point operations, related by one formula
      • A base model completes documents: the same question given to a base and an instruction model, both real
      • What pretraining cannot supply: following instructions, refusing, a stated persona (Module 3)
      Planned
    2. 2.2Scaling LawsPredict how loss falls as parameters, data and compute grow, from a sweep the video runs itself.
      What it will cover
      • The video's own small GPTs at five sizes: final loss against parameters on log–log axes (Maths 1.2)
      • A power law fitted to those points (ML 3.1 on logs), and its prediction for a larger model checked
      • Loss against training tokens; the compute-optimal ratio of tokens to parameters
      • What scaling laws do not predict: specific abilities, and behaviour after post-training
      Planned
    3. 2.3Inside a Current LLMRead a real model's configuration file and name each change from the original transformer.
      What it will cover
      • Pre-norm and RMSNorm; rotary position embeddings; SwiGLU feed-forward layers
      • Grouped-query attention, with the KV-cache memory it saves (GAI 1.5)
      • Mixture of experts: a router choosing a few feed-forward blocks per token; total against active parameters
      • The parameter count computed from the configuration, and checked against the real model
      Planned
    4. 2.4Context LengthMeasure how the cost and accuracy of a model change as the context grows.
      What it will cover
      • Attention cost against context length (DL 6.2), and the KV cache (GAI 1.5)
      • Position embeddings and the limit a model was trained to
      • Retrieval of one fact placed at different depths in a long context, measured on a real model
      • Long context against retrieval (Module 5): cost and accuracy compared
      Planned
    5. 2.5Why Language Models State False FactsExplain hallucination from how text is generated, measure it, and know what reduces it.
      What it will cover
      • A fluent answer is a high-probability continuation, not a checked fact
      • A set of questions with known answers: correctness against the model's token probability, as a reliability diagram (ML 17.1)
      • The training cut-off: questions about later events
      • Abstention: answering only above a confidence threshold, with coverage and accuracy traded (ML 5.2)
      • Retrieval (Module 5) and tools (Module 6) as the main fixes, previewed
      Planned
  4. Module 3 · 6 lessons · planned

    Post-Training

    1. 3.1Supervised Fine-Tuning and Chat TemplatesTurn a base model into an instruction-following model by fine-tuning on instruction–response pairs.
      What it will cover
      • The problem: a base model continues the prompt instead of answering it
      • Instruction data; the chat template with its special tokens for each role
      • The loss masked to the response tokens only, shown token by token
      • A small open base model fine-tuned on the instructions; the same prompts before and after
      • Failure modes: copying the style of the data, forgetting earlier abilities
      Planned
    2. 3.2Preferences and Reward ModelsLearn a score for responses from pairs of chosen and rejected answers.
      What it will cover
      • Pairwise preference data: why people compare more consistently than they rate
      • The Bradley–Terry model: the probability one response is preferred is a sigmoid of the score difference, which is logistic regression (ML 7.2)
      • A reward model trained on preference pairs; its accuracy on held-out pairs
      • Reward hacking previewed: a response the reward model scores highly that people would not prefer
      Planned
    3. 3.3Reinforcement Learning from Human FeedbackOptimise a model to maximise a reward with a policy gradient, kept close to the starting model by a KL penalty.
      What it will cover
      • The minimum of reinforcement learning: a policy, an action, a reward; the policy gradient on a two-armed bandit, every update on screen
      • A language model as a policy: each response an action, the reward model as the reward
      • The KL penalty to the reference model (Stats 7.3), and what happens without it, measured
      • PPO named; its clipping shown in one update
      • Reward hacking measured: reward rising while held-out preference accuracy falls
      Planned
    4. 3.4Direct Preference OptimisationTrain on preference pairs directly, without a separate reward model or reinforcement learning.
      What it will cover
      • The problem: RLHF needs a reward model, sampling and a policy-gradient loop
      • The DPO loss: logistic loss on the difference of log-probability ratios against the reference model, derived from GAI 3.3's objective
      • Every term computed for one preference pair
      • A small instruction model trained with DPO; preference win rate against the SFT model, judged on held-out prompts
      • Failure modes: over-optimisation, longer answers preferred for length alone
      • Variants named in the learner pack
      Planned
    5. 3.5Reasoning Models: Reinforcement Learning with Verifiable RewardsTrain a model to produce working before its answer, rewarded by checking the answer, and measure what extra generated tokens buy.
      What it will cover
      • Chain of thought: the same maths problems answered directly and with working, scored
      • A verifiable reward: 1 if the final answer is correct, 0 otherwise; no reward model needed
      • Group-relative advantage: several samples per problem, each scored against the group mean, computed on screen
      • A small model trained this way on maths problems; accuracy before and after
      • Test-time compute: accuracy against tokens generated; majority vote over samples (self-consistency) measured
      • What the working is and is not: tokens that raise the answer's accuracy, not a record the model consulted
      Planned
    6. 3.6Distillation and Synthetic DataTrain a small model on a large model's outputs, and know the limits.
      What it will cover
      • Distillation on outputs against on probabilities (DL 9.4)
      • Synthetic instruction data generated, filtered and used for SFT
      • Measured: the small model before and after, against the large one
      • Model terms of use and output licences; training repeatedly on generated data, named
      Planned
  5. Module 4 · 4 lessons · planned

    Working with LLMs

    1. 4.1Calling a Language Model from PythonSend messages to a model, local or hosted, and handle tokens, cost, errors and keys correctly.
      What it will cover
      • A local open-weight model and a hosted API, given the same messages
      • Messages and roles; the system prompt; the response object and its token counts
      • Cost computed from input and output tokens
      • Streaming; timeouts, rate limits and retries with backoff
      • API keys from the environment, never in code or notebooks (common mistake, with what leaks when it happens)
      Planned
    2. 4.2Prompting, MeasuredImprove a prompt by measuring it on a labelled set, and compare it with a trained classifier.
      What it will cover
      • The task: spam detection, with ML 6.2's Naive Bayes score on the board
      • Zero-shot, a clearer instruction, few-shot examples: each scored on the same labelled messages
      • Sensitivity: five paraphrases of one prompt, and the spread of their scores
      • Cost per thousand messages against the trained classifier's
      • Common mistake: judging a prompt on the three examples it was written for
      Planned
    3. 4.3Structured OutputMake a model return valid structured data, and measure how often it does.
      What it will cover
      • The task: extract product, issue and amount from complaints into JSON
      • A schema in the prompt, and the invalid outputs that still occur, counted
      • Constrained decoding: tokens that would break the schema masked before sampling (GAI 1.4)
      • Validation, retry, and field-level accuracy against labelled extractions
      Planned
    4. 4.4Text Embeddings for SearchSearch a document collection by meaning with text embeddings, and measure retrieval.
      What it will cover
      • A text embedding model (DL 5.1, ML 6.1): one vector per passage
      • Cosine similarity and the top-k passages for a question
      • Approximate nearest-neighbour indexes named (ML 4.10); a vector database as an index plus storage
      • Keyword search (BM25) against embedding search against both combined, by recall@k on labelled questions
      Planned
  6. Module 5 · 3 lessons · planned

    Retrieval-Augmented Generation

    1. 5.1Retrieval-Augmented GenerationAnswer questions about documents a model was not trained on, by retrieving passages and giving them to the model.
      What it will cover
      • The problem: questions about one Python release; the model without retrieval as the baseline, scored
      • Chunking the documents; embedding the chunks (GAI 4.4)
      • Retrieving the top-k for a question; the prompt built from them
      • Answers with citations to the retrieved passages
      • Accuracy and citation correctness against the baseline, on the evaluation set
      • Failure modes: the answer not in any retrieved chunk, conflicting passages, the model ignoring the context
      Planned
    2. 5.2Improving RetrievalRaise answer accuracy by improving what is retrieved, one change at a time.
      What it will cover
      • Chunk size and overlap, swept
      • Hybrid search (GAI 4.4); re-ranking the top fifty with a cross-encoder
      • Rewriting the question before retrieval
      • One table: recall@k and answer accuracy after each change
      Planned
    3. 5.3Evaluating a RAG SystemMeasure retrieval and generation separately, so a failure can be traced to one of them.
      What it will cover
      • Retrieval metrics: recall@k and the rank of the first relevant passage
      • Answer metrics: correctness against reference answers; faithfulness to the retrieved passages
      • Building the evaluation set: questions, reference answers and source passages, and how many are needed (Stats 5.1)
      • Each failure in the evaluation set labelled as retrieval or generation
      Planned
  7. Module 6 · 6 lessons · planned

    Tools and Agents

    1. 6.1Tool UseLet a model call functions, and follow every message between the model and the program.
      What it will cover
      • A tool as a name, a description and a JSON schema for its arguments
      • The model returns a call; the program runs it; the result goes back as a message, each shown
      • A calculator tool and a table-query tool over the bike counts
      • Errors from tools returned to the model, and its next call
      • Accuracy on arithmetic and data questions with and without tools
      Planned
    2. 6.2AgentsWrite an agent loop that plans, calls tools and stops, and measure its success rate and cost on a set of tasks.
      What it will cover
      • The problem: answer analysis questions about the bike data that need several steps; one model call as the baseline
      • The loop: the model chooses a tool call or a final answer; the program runs it; repeat until done or a step limit
      • A sandboxed Python tool; the program's limits on what code may do
      • Success rate, steps and tokens per task, on a labelled task set
      • Failure modes: loops, errors that compound, a confident wrong final answer
      • Code: the loop by hand; frameworks named in the learner pack
      Planned
    3. 6.3The Model Context ProtocolExpose tools and data to any compatible model application through a standard protocol.
      What it will cover
      • Why a protocol: one tool server, many applications
      • A server exposing a tool and a resource; a client discovering and calling them, each message shown
      • The documentation search of GAI 5.1 served as a tool
      • Permissions: what the server can reach, and who approves each call
      Planned
    4. 6.4Context EngineeringDecide what goes into a model's context at each step, and measure the effect on accuracy and cost.
      What it will cover
      • Everything the model sees: system prompt, tools, retrieved passages, history, tool results, counted in tokens
      • Long tool outputs truncated, summarised or stored and retrieved, each measured
      • Accuracy and cost as the context grows (GAI 2.4)
      • Caching repeated context named, with its cost saving computed
      Planned
    5. 6.5Multi-Agent Systems (optional)Split a task between an orchestrating agent and sub-agents, and measure when it helps.
      What it will cover
      • An orchestrator delegating sub-tasks, each with its own context
      • Success rate, tokens and time against GAI 6.2's single agent on the same tasks
      Planned
    6. 6.6Coding AgentsUse an agent that edits code, and verify its work with tests rather than by reading its explanation.
      What it will cover
      • The loop on a code base: read files, edit, run the tests, read the failures, edit again
      • A task with a failing test, run by an agent, every step shown
      • Tests as the verifiable reward (GAI 3.5) and as the reviewer's check
      • What to check in an agent's change: the diff, the tests it ran, the files it should not have touched (Python 5.6–5.7)
      Planned
  8. Module 7 · 3 lessons · planned

    Evaluating LLM Systems

    1. 7.1Evaluating Model OutputsChoose how to score generated text, and know how far an LLM judge can be trusted.
      What it will cover
      • Exact match, programmatic checks, rubrics and pairwise comparison, each on one task
      • An LLM as judge: its agreement with human labels measured
      • Its biases measured: position in a pair, length, its own outputs
      • Confidence intervals on an evaluation score (Stats 5.1); how many examples a difference needs (ML 17.2)
      • Common mistake: a twenty-example evaluation set reported as a result
      Planned
    2. 7.2Benchmarks and ContaminationRead a benchmark score critically, and know why your own evaluation set decides.
      What it will cover
      • What a public benchmark measures, with maths problems as the example
      • Contamination: test questions in the training data; a check by searching for them, run
      • Saturated benchmarks; scores that move with the prompt format
      • Leaderboards named in the learner pack, with their dates
      Planned
    3. 7.3Testing and Monitoring an LLM ApplicationCatch regressions before release and drift after it.
      What it will cover
      • The evaluation set as a regression test, run on every prompt or model change
      • Tracing: each request's prompt, retrieved passages, tool calls, tokens and latency recorded
      • Monitoring cost, latency, refusal rate and user questions drifting from the evaluation set (ML 17.5)
      • Rolling out a new model behind a comparison (ML 17.4)
      Planned
  9. Module 8 · 4 lessons · planned

    Adapting and Running Models

    1. 8.1Prompt, Retrieve or Fine-TuneChoose between prompting, retrieval and fine-tuning for a task, from measurements on that task.
      What it will cover
      • What each changes: the input, the input's facts, the weights
      • One extraction task solved all three ways; accuracy, cost per request and setup effort in one table
      • The decision table: new facts call for retrieval, a new format or behaviour for fine-tuning
      Planned
    2. 8.2Parameter-Efficient Fine-Tuning: LoRAFine-tune a model by training a low-rank update to its weights, and count what it saves.
      What it will cover
      • The problem: full fine-tuning updates and stores every weight
      • The update W + BA with rank r; parameters counted for one layer and for the model (Maths 3.6)
      • Which layers to adapt; the rank and scale hyperparameters
      • A small open model fine-tuned with LoRA against full fine-tuning: accuracy, memory and stored size
      • Quantised base weights with LoRA (QLoRA) named
      • Code: one LoRA layer by hand, then peft
      Planned
    3. 8.3Quantisation and Running Models LocallyCompute the memory a model needs at each precision, and measure what quantisation costs in quality.
      What it will cover
      • Memory from the parameter count at 16, 8 and 4 bits, computed (DL 2.1)
      • Quantising one weight matrix by hand: scale, round, store
      • Perplexity and task accuracy at each precision, measured
      • Running a quantised model on a laptop; local inference runtimes named in the learner pack
      Planned
    4. 8.4Serving LLMsKnow what decides the throughput, latency and cost of a served language model.
      What it will cover
      • Prefill and decode (GAI 1.5); time to first token and tokens per second
      • Batching requests together, and the KV-cache memory it needs
      • Speculative decoding: a small model proposes, the large model checks, measured
      • Cost per million tokens computed for a given GPU and load
      Planned
  10. Module 9 · 7 lessons · planned

    Diffusion and Image Generation

    1. 9.1Generative Models of ImagesSee why sampling from an autoencoder gives blurry images, and what a better image model has to do.
      What it will cover
      • Generating an image means sampling from the distribution of images
      • Random points decoded by DL 5.2's autoencoder: mostly not clothing
      • The variational autoencoder: a regular latent space, sampled, and its blur under squared error
      • Adversarial networks named; why diffusion replaced them for most uses
      Planned
    2. 9.2Diffusion ModelsTrain a network to predict the noise added to an image, and generate new images by removing noise step by step.
      What it will cover
      • The problem: sample new clothing images; the VAE's samples as the baseline
      • The forward process: noise added at a schedule of levels, with the closed form for any step, on a 1-D distribution first
      • The objective: predict the added noise; squared error between predicted and true noise
      • The network: a U-Net (DL 4.6) given the noisy image and the noise level
      • Sampling: start from pure noise and apply the learned denoising step a thousand times
      • Samples over training, against the VAE's
      • Code: the 1-D case in NumPy, then a small model in PyTorch
      Planned
    3. 9.3Faster Sampling: DDIM and Flow MatchingGenerate in tens of steps instead of a thousand, and measure the quality given up.
      What it will cover
      • DDIM: a deterministic sampler with fewer steps
      • Flow matching: learning a velocity field along straight paths from noise to data
      • Sample quality against the number of steps, scored by a classifier-based metric
      • Few-step distilled models named
      Planned
    4. 9.4Conditioning and GuidanceGenerate an image of a requested class or prompt, and control how strongly the request is followed.
      What it will cover
      • Class conditioning: the label given to the network beside the noisy image
      • Classifier-free guidance: conditional and unconditional predictions combined; the guidance scale swept
      • Prompt adherence against diversity, measured at each scale
      • Text conditioning through cross-attention (DL 6.2), previewed for GAI 9.5
      Planned
    5. 9.5Latent DiffusionFollow a text-to-image model through each of its components, and compute why it runs in a latent space.
      What it will cover
      • The problem: diffusion on full-resolution pixels is too expensive; the cost computed
      • The autoencoder: images to a small latent and back (DL 5.2)
      • The text encoder: the prompt to embeddings (GAI 10.1)
      • The denoising U-Net or transformer, with cross-attention to the text
      • One generation traced through a real pretrained model, the latent decoded at several steps
      • Failure modes: text in images, counting, hands, prompts the training captions did not cover
      Planned
    6. 9.6Fine-Tuning an Image ModelTeach a pretrained image model a new subject or style with a small LoRA, and see it overfit.
      What it will cover
      • A LoRA (GAI 8.2) trained on a few pet photos
      • Generations at several training steps: the subject learned, then the prompt ignored
      • Consent, copyright and the licence of the base model
      Planned
    7. 9.7Evaluating Generated ImagesScore image generators, and know what each score misses.
      What it will cover
      • Fréchet distance between feature distributions, computed on the video's own samples
      • Text–image similarity for prompt adherence (GAI 10.1)
      • Human preference comparisons; where the automatic scores disagree with them
      Planned
  11. Module 10 · 3 lessons · planned

    Multimodal Models

    1. 10.1Text–Image Contrastive ModelsTrain an image encoder and a text encoder into one embedding space, and classify images with no labelled training examples.
      What it will cover
      • The problem: classify pet breeds without training on them; DL 4.4's fine-tuned network as the comparison
      • Two encoders and a contrastive loss over a batch of image–caption pairs (DL 5.4), the similarity matrix on screen
      • Zero-shot classification: each class name written as a caption, the nearest one chosen
      • Zero-shot accuracy against the fine-tuned network
      • Failure modes: counting, negation, rare words
      Planned
    2. 10.2Vision-Language ModelsSee how an image becomes tokens a language model reads, and measure where such models fail.
      What it will cover
      • An image encoder (DL 6.6), a projection, and the image as a sequence of tokens in the language model's input
      • Image tokens counted, and their cost
      • Captioning, questions about images and reading documents, each scored
      • Failure modes measured: counting objects, left and right, small text
      Planned
    3. 10.3Speech Recognition and Speech Generation (optional)Follow audio into text and text into audio through current models.
      What it will cover
      • Speech recognition with an encoder–decoder transformer on spectrograms (DL 8.1)
      • Audio as discrete tokens; text-to-speech as language modelling over audio tokens
      • Word error rate measured; consent and voice cloning
      Planned
  12. Module 11 · 4 lessons · planned

    Safety, Security and Responsible Use

    1. 11.1Prompt Injection and Agent SecurityShow how instructions hidden in retrieved text or tool output change what a model does, and design an application so that they cannot do harm.
      What it will cover
      • An instruction planted in one document of the viewer's own RAG system (GAI 5.1), retrieved and followed
      • The same through a tool result in the agent (GAI 6.2)
      • Why the model cannot reliably tell data from instructions
      • Defences: least privilege for tools, allow-lists, confirmation before actions, separating untrusted content; the attack's success rate measured before and after
      • Common mistake: relying on a prompt that tells the model to ignore injected instructions
      Planned
    2. 11.2Safety Training and RefusalsKnow how refusal behaviour is trained, and measure the trade-off between refusing too much and too little.
      What it will cover
      • Safety behaviour as post-training data and preferences (Module 3)
      • Over-refusal and under-refusal measured on a labelled set of benign and disallowed requests, as precision and recall (ML 5.1)
      • Red-team evaluations: what they test and how they are reported
      Planned
    3. 11.3Bias, Privacy and CopyrightMeasure bias in generated outputs, and know the privacy and copyright obligations of training and using these models.
      What it will cover
      • Bias in outputs measured across groups on one task (ML 17.7)
      • Memorised training text: verbatim recall tested on the video's own small GPT (GAI 1.3)
      • Personal data in prompts and logs (ML 17.8)
      • Licences of models, data and outputs; provenance and watermarking of generated media named
      Planned
    4. 11.4InterpretabilityRead information out of a model's hidden states, and see which features a model represents.
      What it will cover
      • Linear probes: logistic regression (ML 7.2) on the small GPT's hidden states, predicting a property of the text
      • Attention patterns read for one sentence
      • Sparse autoencoders (DL 5.2) on hidden states: features found and inspected
      • What these methods show and what they cannot establish
      Planned
  13. Module 12 · 3 lessons · planned

    Case Studies

    1. 12.1Case Study: A Documentation AssistantBuild, evaluate and secure a question-answering assistant over a real documentation set.
      What it will cover
      • The decision: deflecting support questions; accuracy, citation correctness and cost as the constraints
      • The evaluation set first; the model alone as the baseline
      • A ladder: RAG (GAI 5.1), improved retrieval (GAI 5.2), a re-ranker, a larger model
      • Error analysis split into retrieval and generation (GAI 5.3)
      • The injection test (GAI 11.1); monitoring (GAI 7.3)
      Planned
    2. 12.2Case Study: A Data-Analysis AgentBuild an agent that answers questions about a table by writing and running code, and decide whether it is reliable enough to use.
      What it will cover
      • The decision: self-service answers about bike demand for non-programmers
      • A task set with reference answers; one model call as the baseline
      • A ladder: tools (GAI 6.1), the agent loop (GAI 6.2), better context (GAI 6.4)
      • Success rate, cost and steps per task; the sandbox and its limits; the injection test
      • When a fixed dashboard is the better program (ML 1.1)
      Planned
    3. 12.3Case Study: Replacing a Large Model with a Small OneFine-tune a small open model to match a large model on one task at a fraction of the cost.
      What it will cover
      • The decision: extracting fields from complaints at volume; the large model's accuracy and cost as the baseline
      • A ladder: prompting the small model, LoRA on labelled data (GAI 8.2), distillation from the large model (GAI 3.6), quantisation (GAI 8.3)
      • Accuracy, cost per thousand requests and latency in one table
      • The choice justified by all three
      Planned

Start free, go further with Pro

Compare the plans

Free

In Generative AI:

  • Each lesson's parts and key terms once it opens, no account
  • Quizzes and saved progress with a free account
Pro

Pricing announced soon.

  • Every course, from Python to deep learning and generative AI
  • Practice problems for every lesson, levels A to C, with values to check
  • Self-checking notebooks that mark your answers as you go
  • Module projects, cheat sheets, common mistakes and interview answers
  • A certificate for every course you complete
  • Weekly live sessions with Gaurav
  • Everything in Free

Worked articles on Generative AI

All Generative AI resources

Where Generative AI is used

All AI applications

Questions about Generative AI

Do I need a paid API key?

No. The notebooks are built to run on a small open-weight model on a free Colab or Kaggle GPU. Calling a hosted model is an optional section, with its cost estimated before the call is made.

Which models and frameworks does it teach?

The mechanisms, which last: tokenisers, attention, post-training, retrieval, an agent loop written by hand and the Model Context Protocol. Current model names, API parameters, prices and framework names are kept in the notebooks and learner packs, so they can be updated as they change.

Does it cover agents and coding agents?

Yes. Tool use, an agent loop written by hand, the Model Context Protocol, context engineering and coding agents checked with tests, then prompt injection and agent security, demonstrated on your own system with a harmless payload.

Does it cover image generation?

Yes. Diffusion is built from scratch, then faster sampling, guidance, latent diffusion and fine-tuning an image model, followed by text–image and vision-language models.