All puzzles › Deep Learning

Deep Learning Practice Problems

27 puzzles (12 easy, 12 medium, 3 hard), 7 free, in Python, JavaScript and C++.

Activations, layers, convolutions and the building blocks of neural nets.

The puzzles, easiest first

  1. A Mask in a Handful of Numbers (Easy, free): A segmentation mask marks which pixels belong to an object, and it is mostly long runs of the same value.
  2. How Far Back It Can See (Easy, free): Each layer of a convolutional network sees a little further than the one below it.
  3. Shorter, Same Direction (Easy, free): One bad batch can produce a gradient so large that a single step wrecks the model.
  4. Squeeze the Stutter Out (Easy, free): A speech model outputs one symbol for every sliver of audio, so a single letter comes out many times in a row, with a special blank symbol in the gaps.
  5. Apply Dropout Mask (Easy): Given a list of activations and a mask of 0s and 1s, return the activations with every masked-out spot set to 0.
  6. Argmax (Predicted Class) (Easy): Given a list of numbers, return the INDEX of the biggest one, not the value.
  7. Embedding Lookup (Easy): Given an embedding table with one row per token, and a list of token IDs, return the row for each ID, in order.
  8. Flatten Feature Map (Easy): Given a 2D grid, return all its values in one flat array, row by row.
  9. Leaky ReLU (Easy): Given a list of numbers, apply Leaky ReLU to each one.
  10. ReLU Activation (Easy): Given a list of numbers, apply ReLU to each one and return the results.
  11. Sigmoid (Easy): Given a number x, return the sigmoid of x, rounded to 4 decimals.
  12. Tanh Activation (Easy): Given a list of numbers, apply tanh to each one, rounded to 4 decimals.
  13. Cut the Picture Into Words (Medium, free): A vision transformer reads an image the way a language model reads a sentence, so the image first has to become a sequence.
  14. Cut the Weakest Weights (Medium, free): Most of a trained network's weights are close to zero and can be removed with little harm.
  15. 1D Convolution (Medium): Given a signal and a smaller kernel, slide the kernel along the signal and return the weighted sum at each spot where it fully fits, rounded to 3 decimals.
  16. Batch Normalization (Medium): Given a batch of numbers, normalize them to a mean of 0 and a spread of 1, rounded to 3 decimals.
  17. Count Parameters (Medium): Given the number of neurons in each layer, return the total trainable parameters.
  18. Cross-Entropy Loss (Medium): Given a list of predicted probabilities and the index of the true class, return the cross-entropy loss, rounded to 4 decimals.
  19. Dense Layer Forward (Medium): Given a weight matrix, a bias vector, and an input vector, return the layer's outputs, rounded to 3 decimals.
  20. GELU Activation (Medium): Given a list of numbers, apply the GELU activation to each one and return the results, rounded to 4 decimals.
  21. Max Pooling (1D) (Medium): Given a list of numbers and a window size, split the list into chunks of that size, with no overlap, and return the biggest value in each chunk.
  22. Mean Pooling (1D) (Medium): Given a list of numbers and a window size, split the list into chunks of that size, with no overlap, and return the average of each chunk, rounded to 3 decimals.
  23. MSE Gradient (Medium): Given predictions and targets, return the gradient of the mean squared error for each prediction, rounded to 3 decimals.
  24. Softmax (Medium): Given a list of scores, turn them into probabilities that add up to 1, rounded to 4 decimals.
  25. One Box per Object (Hard, free): A detector proposes many overlapping boxes for the same object, and non-maximum suppression keeps the best one.
  26. 2D Convolution (Hard): Given an image and a smaller kernel, both as 2D grids, slide the kernel over every spot where it fully fits and return the grid of weighted sums, rounded to 3 decimals.
  27. Attention Weights (Hard): Given a query vector and a list of key vectors, return the attention weights, rounded to 4 decimals.

Practice another pattern

Or browse by subject

Browse all 676 puzzles