Module quiz

Deep learning and transformers quiz

61 questions across 4 lessons. Choose an answer, check it, and read why each option is right or wrong.

Checking answers needs JavaScript. You can still read every question and option below.

0 of 61 answered

Keyboard: arrow keys move between options. Space or Enter selects the focused option.

Neural networks and backpropagation: gradients, checks and initialisation12 questions

ObjectiveExplain why a network needs non-linear activations, choose between ReLU, GELU, sigmoid and tanh by how they saturate, and give the shape of every tensor and the parameter count of a 2-layer network.

  1. Question 1 of 61A classifier takes 20 input features, has one hidden layer of 50 units, and predicts 4 classes. Every layer has a bias. How many trainable parameters does it have?

    Choose one answer.

  2. Question 2 of 61A hidden ReLU unit's pre-activation is negative for every example in the training set. What happens to that unit's own weights during training?

    Choose one answer.

  3. Question 3 of 61Which of these statements about activations and depth are true? Select all that apply.

    Choose all that apply.

  4. Question 4 of 61A mini-batch X has 32 rows and 784 columns, and W1 has shape 128 x 784 (hidden units by inputs). What is the shape of the hidden pre-activation Z1 = X W1^T + b1?

    Choose one answer.

ObjectiveWork backpropagation by hand through a 2-layer ReLU network with softmax cross-entropy using the chain rule, and verify the result with a central-difference gradient check.

  1. Question 5 of 61In a classifier the logits z2 have 3 entries and the hidden activation a1 has 5. What is the shape of dL/dW2, and how is it formed?

    Choose one answer.

  2. Question 6 of 61Use the lesson's worked-example network and input, but now the true class is 0. The softmax output is still (0.8808, 0.1192). What is the error delta1 at the hidden pre-activations?

    Choose one answer.

  3. Question 7 of 61You compare a hand-written backward pass with a central-difference check on a small ReLU network in double precision. The maximum relative error is 0.4. What is the best conclusion?

    Choose one answer.

  4. Question 8 of 61Which statements about the backward pass of the lesson's 2-layer network are true? Select all that apply.

    Choose all that apply.

ObjectiveExplain vanishing and exploding gradients as products of per-layer factors, and say how the choice of activation and of Xavier or He initialisation changes those factors.

  1. Question 9 of 61A 40-layer, width-64 ReLU network is initialised with Xavier weights (variance 1/n for square layers). The loss does not move and the gradients in the first layers are close to zero. What is the most likely cause?

    Choose one answer.

  2. Question 10 of 61A 20-layer tanh network has weights drawn with standard deviation 1.0 at every layer (width 64). Which observations agree with the lesson's experiment? Select all that apply.

    Choose all that apply.

  3. Question 11 of 61A 12-layer sigmoid network with Xavier weights trains slowly: the gradient at the first layer is roughly 1e-8 of the gradient at the last. Which change addresses the cause?

    Choose one answer.

  4. Question 12 of 61Every weight in a small network, in all layers, is initialised to 0.1, with zero biases. After training, all hidden units in a layer still have identical weights. Why?

    Choose one answer.

Training deep networks: normalisation, regularisation, AdamW and debugging14 questions

ObjectiveCompare batch norm and layer norm by what their statistics are computed over, and explain how train and eval mode change batch norm and dropout.

  1. Question 13 of 61A model with dropout and batch norm is served after training. Sending the identical request twice returns two slightly different scores. What is the most likely cause?

    Choose one answer.

  2. Question 14 of 61Which statements about batch norm and layer norm are true? Select all that apply.

    Choose all that apply.

  3. Question 15 of 61A team trains a tabular MLP with batch norm (BatchNorm1d) using only 2 rows per step. Validation scores jump around from epoch to epoch. Which explanation fits best?

    Choose one answer.

  4. Question 16 of 61A layer uses dropout with p = 0.25 in a modern library. Which statements are true? Select all that apply.

    Choose all that apply.

ObjectiveExplain what dropout, weight decay and early stopping each do, how AdamW differs from Adam with an L2 penalty, and read a small regularisation experiment without over-claiming.

  1. Question 17 of 61A fine-tuning run uses Adam with an L2 penalty of 0.01. Some embedding rows are absent from the batch for many steps in a row, so their loss gradient is exactly 0. At learning rate 0.001 and weight 1, how does the penalty act on them per step, compared with AdamW (decay 0.01)?

    Choose one answer.

  2. Question 18 of 61You train with early stopping, restore the weights from the epoch with the lowest validation loss, and report that validation loss as the model's expected error on new data. What is wrong with that report?

    Choose one answer.

  3. Question 19 of 61Which statement is supported by the lesson's two-moons experiment (30 training points, 8 seeds)?

    Choose one answer.

  4. Question 20 of 61Which statement about an L2 penalty and weight decay is correct?

    Choose one answer.

ObjectiveSet up AdamW with a warmup-plus-cosine schedule and gradient clipping by global norm, and work through a debugging checklist for a NaN or flat loss.

  1. Question 21 of 61A run uses 2,000 steps, a peak learning rate of 6e-4, 200 warmup steps, and cosine decay to 0 afterwards. What is the learning rate at step 650?

    Choose one answer.

  2. Question 22 of 61A training step produces a gradient with L2 norm 0.4, and the code clips by global norm with max_norm = 1. What does clipping do to this gradient?

    Choose one answer.

  3. Question 23 of 61A new model prints loss = nan on the very first batch, before any weight update. Printing the logits shows values near 1000 for some rows because the inputs were not scaled. What should you do first?

    Choose one answer.

  4. Question 24 of 61A run has been steady for 12,000 steps with a loss near 0.8. At one step the loss is NaN, with no earlier rise. Reloading the previous checkpoint and replaying the same batch gives NaN again. What is the most likely cause?

    Choose one answer.

  5. Question 25 of 61A balanced two-class model prints a training loss of 0.693 at step 0 and at step 10,000. The code runs without errors. Which check comes first?

    Choose one answer.

  6. Question 26 of 61A 3-class model ends with a softmax layer, and the loss is torch's CrossEntropyLoss on that output. What is the effect?

    Choose one answer.

CNNs, ResNets, transfer learning and recurrent networks, with RMSNorm and label smoothing15 questions

ObjectiveCompute the output size, parameter count and receptive field of a stack of convolution and pooling layers with padding and stride, and explain what weight sharing buys compared with a dense layer.

  1. Question 27 of 61A convolution layer has a 3 by 3 kernel, stride 2 and padding 1 on each side. What is its output length along an axis whose input length is 12?

    Choose one answer.

  2. Question 28 of 61A layer takes a 64-channel feature map and applies 128 filters of size 3 high by 5 wide, with bias. How many parameters does it have, and how does the count change if the feature map is 4 times larger in height and width?

    Choose one answer.

  3. Question 29 of 61A model applies a 2 by 2 max pool with stride 2, then a 3 by 3 convolution with stride 1. A second model uses the same two layers in the opposite order. Which statement about the receptive field of the final unit (along one axis) is correct?

    Choose one answer.

  4. Question 30 of 61Which statements about convolution and pooling are true? Select all that apply.

    Choose all that apply.

ObjectiveExplain why a skip connection y = x + F(x) keeps a gradient path through a deep stack, and describe how transfer learning and data augmentation reuse a pretrained model or enlarge the effective training set.

  1. Question 31 of 61A plain 40-layer network has higher training error than a 20-layer one. A teammate adds identity skip connections around pairs of layers and says this fixes it because 'skips remove vanishing gradients'. What is the most accurate response?

    Choose one answer.

  2. Question 32 of 61You fine-tune a pretrained image model on 800 labelled images of your own. Which plan is most consistent with the standard recipe?

    Choose one answer.

  3. Question 33 of 61A team uses random flips and crops on training images and finds their validation loss is below their training loss. Which explanation fits, and what do they check?

    Choose one answer.

ObjectiveExplain vanishing and exploding gradients through time as a product of per-step factors, write the LSTM and GRU updates, say why the additive cell path helps, and count their parameters.

  1. Question 34 of 61A one-unit tanh recurrent network has recurrent weight w = 3 and a constant input of 0.1. A teammate predicts the gradient from step 0 to step 50 explodes. What does the lesson's calculation show?

    Choose one answer.

  2. Question 35 of 61A gradient-norm clipping threshold is added to a plain RNN that suffers from both exploding and vanishing gradients. What does it fix?

    Choose one answer.

  3. Question 36 of 61In an LSTM, which statement correctly explains how gradients survive many time steps?

    Choose one answer.

  4. Question 37 of 61In PyTorch's GRU, h_t = (1 - z_t) * n_t + z_t * h_(t-1). At a time step the update gate z_t is close to 1 for every unit. What happens to the hidden state?

    Choose one answer.

  5. Question 38 of 61A PyTorch nn.LSTM has input size 10 and hidden size 20, one layer, bias on. How many parameters does it have, and why does the count differ from a textbook formula with one bias per gate?

    Choose one answer.

ObjectiveCompare RMSNorm with layer norm, and write the label-smoothed target and loss, including the loss floor and the logit gap it asks for.

  1. Question 39 of 61Which statements about RMSNorm and layer norm are true? Select all that apply.

    Choose all that apply.

  2. Question 40 of 61Cross-entropy with label smoothing 0.1 on a 10-class problem. What is the target for the true class, and what is the lowest loss the model can reach?

    Choose one answer.

  3. Question 41 of 61A model trained with label smoothing 0.1 shows a training loss that stays near 0.5 on a 10-class problem while its accuracy is high. A teammate says the model is underfitting. What is the right reading?

    Choose one answer.

Transformers, large language models, sampling and fine-tuning20 questions

ObjectiveExplain how text becomes tokens and embeddings, why self-attention alone cannot see word order, and how sinusoidal or rotary positions fix that.

  1. Question 42 of 61A model has a vocabulary of 6 tokens and embedding width 4. What does looking up the embedding of token 3 compute?

    Choose one answer.

  2. Question 43 of 61Unmasked (bidirectional) self-attention is applied to the rows of X with no positional information. The rows are then shuffled before the layer. What happens to the output?

    Choose one answer.

  3. Question 44 of 61Which description of byte pair encoding is correct?

    Choose one answer.

  4. Question 45 of 61Vaswani et al. compared their sinusoidal position encoding with learned position embeddings. What did they report, and what reason did they give for choosing the sinusoids?

    Choose one answer.

ObjectiveCompute scaled dot-product attention with tensor shapes, explain the square-root-of-d_k scale through the variance of a dot product, build multi-head attention and the causal mask, and state why the cost grows with the square of the sequence length.

  1. Question 46 of 61Queries are 5 by 16, keys 9 by 16 and values 9 by 4. What are the score-matrix shape, the output shape and the scale applied to the scores?

    Choose one answer.

  2. Question 47 of 61Queries and keys have independent components with mean 0 and variance 1. Why is their dot product divided by the square root of d_k and not by d_k?

    Choose one answer.

  3. Question 48 of 61A team applies the causal mask by setting future attention weights to 0 after the softmax. What is wrong with this?

    Choose one answer.

  4. Question 49 of 61The context window is doubled from 4,000 to 8,000 tokens. By what factor does the number of score-matrix entries in one attention head change?

    Choose one answer.

ObjectiveDescribe a pre-norm transformer block (normalisation, attention, MLP, residual paths, GELU or SiLU), say why pre-norm trains more easily than post-norm, and estimate parameters with 12 L d squared.

  1. Question 50 of 61What is the main difference between pre-norm and post-norm transformer blocks, and why does it matter?

    Choose one answer.

  2. Question 51 of 61A transformer has d_model = 2048, 24 layers and d_ff = 4 d_model. Using the lesson's rule, about how many weights are in the attention and MLP blocks (no biases, norms or embeddings)?

    Choose one answer.

  3. Question 52 of 61Which statement about GELU and SiLU is correct?

    Choose one answer.

  4. Question 53 of 61In a standard transformer block, where do most of the weights sit when d_ff = 4 d_model, and which layer mixes information between positions?

    Choose one answer.

ObjectiveExplain next-token training with teacher forcing, why a KV cache removes repeated work and what it costs in memory, and how temperature, top-k and top-p change the next-token distribution.

  1. Question 54 of 61A decoder-only model is trained on a sequence of 20 tokens in one forward pass with a causal mask. How many next-token training targets does that pass provide, and why?

    Choose one answer.

  2. Question 55 of 61What does a KV cache save during generation, and what does it cost?

    Choose one answer.

  3. Question 56 of 61The next-token distribution is very confident: one token has probability 0.97 and the rest is spread thinly over 50,000 others. How do top-p = 0.9 and top-k = 50 differ here?

    Choose one answer.

  4. Question 57 of 61A product team wants more repeatable outputs from a sampling-based chat model without switching to greedy decoding. Which change does this, and why?

    Choose one answer.

ObjectiveCompare pre-training, supervised fine-tuning, LoRA and preference tuning, count the parameters LoRA trains, choose between prompting, RAG and fine-tuning, and explain why a language model can hallucinate.

  1. Question 58 of 61A weight matrix of shape 8192 by 2048 gets a LoRA adapter of rank 4. How many parameters does the adapter train, and what happens to inference cost after merging?

    Choose one answer.

  2. Question 59 of 61A support assistant must answer from refund rules that change every week and must cite the policy page. Which first approach fits, and why?

    Choose one answer.

  3. Question 60 of 61Why can a language model state a false claim fluently?

    Choose one answer.

  4. Question 61 of 61Compared with RLHF as described in the DPO paper, what does direct preference optimisation change?

    Choose one answer.

Boss challenge: Deep learning from backprop to transformers

A longer check of the whole module. It is optional, and nothing else on the site depends on it.

  • 10 questions, taken from the lesson quizzes above.
  • Pass mark: 7 correct of 10.
  • You can try it as many times as you like.
  • A correct answer is kept, so a pass can build up across several tries.
  • If you miss some, you get links to the lesson sections to read again.

Checking answers needs JavaScript. You can still read every question and option below.

0 of 10 answered

Keyboard: arrow keys move between options. Space or Enter selects the focused option.

  1. Question 1 of 10A 40-layer, width-64 ReLU network is initialised with Xavier weights (variance 1/n for square layers). The loss does not move and the gradients in the first layers are close to zero. What is the most likely cause?

    Choose one answer.

  2. Question 2 of 10You compare a hand-written backward pass with a central-difference check on a small ReLU network in double precision. The maximum relative error is 0.4. What is the best conclusion?

    Choose one answer.

  3. Question 3 of 10A fine-tuning run uses Adam with an L2 penalty of 0.01. Some embedding rows are absent from the batch for many steps in a row, so their loss gradient is exactly 0. At learning rate 0.001 and weight 1, how does the penalty act on them per step, compared with AdamW (decay 0.01)?

    Choose one answer.

  4. Question 4 of 10A balanced two-class model prints a training loss of 0.693 at step 0 and at step 10,000. The code runs without errors. Which check comes first?

    Choose one answer.

  5. Question 5 of 10A one-unit tanh recurrent network has recurrent weight w = 3 and a constant input of 0.1. A teammate predicts the gradient from step 0 to step 50 explodes. What does the lesson's calculation show?

    Choose one answer.

  6. Question 6 of 10A PyTorch nn.LSTM has input size 10 and hidden size 20, one layer, bias on. How many parameters does it have, and why does the count differ from a textbook formula with one bias per gate?

    Choose one answer.

  7. Question 7 of 10A model applies a 2 by 2 max pool with stride 2, then a 3 by 3 convolution with stride 1. A second model uses the same two layers in the opposite order. Which statement about the receptive field of the final unit (along one axis) is correct?

    Choose one answer.

  8. Question 8 of 10The next-token distribution is very confident: one token has probability 0.97 and the rest is spread thinly over 50,000 others. How do top-p = 0.9 and top-k = 50 differ here?

    Choose one answer.

  9. Question 9 of 10A transformer has d_model = 2048, 24 layers and d_ff = 4 d_model. Using the lesson's rule, about how many weights are in the attention and MLP blocks (no biases, norms or embeddings)?

    Choose one answer.

  10. Question 10 of 10A support assistant must answer from refund rules that change every week and must cite the policy page. Which first approach fits, and why?

    Choose one answer.