Neural-net foundations15 / 15

Lesson 15 · Exam

Neural-net foundations exam

These questions cover every lesson in the course, in order: building and training networks, the primitives toolbox, and the two practical lessons. Most test what an idea means or what happens when something changes. The few sums use numbers you can do in your head. Pick one answer per question, then press "Check answers" at the bottom to see your score and an explanation for each one.

  1. A single neuron with a sigmoid activation is trained with binary cross-entropy loss. Which model from ML fundamentals is it?

  2. A 2 → 3 → 1 network has two linear layers and no activation between them. It has 13 weights and biases. What is the fewest numbers that compute exactly the same function?

  3. How many weights and biases does a 2-16-2 MLP have?

  4. Your network's last layer is a softmax, and you train it with F.cross_entropy. What happens?

  5. In the backward pass, a box computes z=a×bz = a \times b, with a=2a = 2 and b=3b = 3. The gradient arriving from above is ∂L/∂z=2\partial L / \partial z = 2. What is ∂L/∂a\partial L / \partial a?

  6. In a ReLU network, one hidden unit's weighted sum is −0.4 for this example. What gradient reaches the weights into that unit?

  7. You train on 200 examples in batches of 32. How many optimiser steps are in one epoch?

  8. You forget optimizer.zero_grad() in the training loop. What happens?

  9. When you measure validation loss, which switch turns off dropout, and which turns off gradient tracking?

  10. Momentum with β=0.9\beta = 0.9 runs on a slope whose gradient never changes. Once its velocity settles, how many times as far per step does it move as plain SGD with the same learning rate?

  11. Adam with learning rate α=0.1\alpha = 0.1 takes its first step. Weight aa's gradient is 100 times weight bb's. How far does each move?

  12. On its way back, a gradient is multiplied by 0.5 at each of 10 layers. About what fraction of it reaches the first layer?

  13. Every weight and bias in a 2-16-16-2 network starts at exactly 0.1. After training as usual, what are the 16 units in each hidden layer like?

  14. The gradient is (6, 8). You clip it by norm, with a maximum length of 5. What is the clipped gradient?

  15. nn.Dropout(p=0.2) is in training mode. A unit outputs 4 and survives the mask. What does the dropout layer pass on?

  16. Which optimiser shrinks every weight by the same fraction at each step, whatever the size of its gradient?

  17. A convolution layer has 8 filters of 3 × 3 and reads a greyscale 28 × 28 image. How many weights does it have, not counting biases?

  18. A vertical-edge filter (left column −1, middle 0, right column +1) slides over an image of horizontal stripes. What does the feature map look like?

  19. Two notes: "extra cheese, no onions" and "no cheese, extra onions". Which can give them different answers: averaging their word vectors, or an RNN that reads the words in order?

  20. A note has two words, with vectors (2, 0) and (0, 4). One word's attention scores against them are 0 and 0. What is that word's output?

  21. An autoencoder has only linear layers and squared-error loss. It squeezes 6 numbers through a bottleneck of 2. What does it learn?

  22. You want to predict whether a molecule dissolves in water from its atoms and the bonds between them. Which building block fits best?

  23. A 10-class classifier is freshly built with small random weights. What should its first cross-entropy loss be?

  24. You train on one batch of 8 examples alone, and the loss falls to 0.0002. Which bug could still be there?

  25. You have 5,000 rows and 20 mixed columns: prices, categories and dates. What should you try first?