Neural networks practice problems
18 problems · 0 solved
A neural network is a stack of simple layers, each doing a matrix multiply followed by a nonlinearity. Training adjusts the weights so the output gets closer to the target, using gradients computed by backpropagation. These problems build that understanding from the ground up without any deep learning library. You will count the parameters of an MLP, compute Xavier and He initialisation scales, write the backward pass of a dense layer, implement inverted dropout, backpropagate through an embedding lookup, write the forward pass of a pre-norm residual MLP block and backpropagate through it, find where early stopping halts, train a tiny MLP to learn XOR, and backprop a two-layer ReLU network with softmax cross-entropy, ignored labels and weight decay. Start with the Easy problems on parameter counts, initialisation and dense layer backward. Then do dropout, embeddings and the residual forward pass, and finish with the full two-layer backprop and XOR training. Writing a network by hand is a common interview task, and it gives you the intuition to spot exploding gradients, bad initialisation or overfitting in real training runs.
Easy 8
- Backward pass of a dense layer
- Compute Xavier and He initialisation scales for dense and conv weights
- Count the parameters of an MLP
- Find where early stopping halts
- Run an MLP forward pass and keep every layer's activation
- Add L1 and L2 penalties and their gradients to weight matrices only
- Measure the vanishing gradient through a chain of sigmoid layers
- Apply drop path (stochastic depth) to a residual branch
Medium 7
- Implement inverted dropout
- Forward pass of a pre-norm residual MLP block
- Backpropagate through an embedding lookup
- Backpropagate through a 2-layer tanh net for regression and binary classification
- Trace activation spread through deep ReLU layers for Xavier and He init
- Run one training epoch with full-batch, mini-batch or SGD updates
- Estimate prediction uncertainty with Monte Carlo dropout