FreeExam

Deep learning architectures

An AI/ML engineer interview on convolutional and recurrent networks, normalization, and why attention took over from recurrence.

These prompts are original practice. They are not questions from a named employer or a live hiring loop.

  1. 1.Why does a network need a nonlinear activation between its layers?

  2. 2.The largest value of the sigmoid's derivative is 0.25. Roughly how much can a gradient shrink after passing back through 10 sigmoid layers, ignoring the weights?

  3. 3.Why did ReLU largely replace sigmoid in hidden layers?

  4. 4.After a large learning-rate spike, 40 percent of the ReLU units in a layer output zero for every input. What happened?

  5. 5.What does Leaky ReLU change compared with ReLU?

  6. 6.Why is GELU common in transformer feed-forward layers?

  7. 7.What does backpropagation compute?

  8. 8.Why are weights not all initialized to zero?

  9. 9.He initialization sets weight variance to 2 divided by the number of inputs. Which activation is it designed for?

  10. 10.Gradient norms grow by about 10 times per layer going backward in a deep network. What is that called, and what is a common fix?

  11. 11.Why is softmax followed by cross-entropy the usual output for multi-class classification?

  12. 12.Why do libraries offer a fused 'cross-entropy from logits' instead of computing softmax and then the log?

  13. 13.The universal approximation theorem says a single hidden layer can approximate any continuous function. Why do we still use deep networks?

  14. 14.A new model will not train. What is a good first sanity check?

  15. 15.What does batch normalization do during training?

  16. 16.What does batch normalization use at inference time?

  17. 17.Why does batch normalization behave badly with a batch size of 2?

  18. 18.Transformers use layer normalization rather than batch normalization. What does layer normalization normalize over?

  19. 19.What problem do residual connections, as in ResNet, solve?

  20. 20.A residual block computes x + F(x). For the addition to work, what must be true?

  21. 21.What does momentum add to plain SGD?

  22. 22.What does Adam keep for each parameter?

  23. 23.Why do transformer training runs usually start with a learning-rate warmup?

  24. 24.What does a cosine learning-rate schedule do over a run?

  25. 25.What does gradient clipping by norm do?

  26. 26.Why is bfloat16 popular for training large models?

  27. 27.With mixed-precision training in float16, why is loss scaling used?

  28. 28.You raise the batch size from 256 to 2,048 and keep the learning rate the same. What often happens?

  29. 29.A model does not fit in GPU memory at the batch size you want. Which technique keeps the same effective batch size?

  30. 30.What does activation checkpointing trade?

  31. 31.What two ideas make a convolutional layer far smaller than a fully connected layer on an image?

  32. 32.What does it mean that convolution is translation equivariant?

  33. 33.A 32×32 input passes through a 5×5 convolution with stride 1 and no padding. What is the output height and width?

  34. 34.A 224×224 image goes through a 7×7 convolution with stride 2 and padding 3. What is the output size?

  35. 35.How many parameters are in a 3×3 convolution from 3 input channels to 64 output channels, with a bias for each output channel?

  36. 36.What does 'same' padding do for a 3×3 convolution with stride 1?

  37. 37.Three 3×3 convolutions with stride 1 are stacked. What is the receptive field of one output pixel?

  38. 38.Two stacked 3×3 convolutions cover the same 5×5 area as one 5×5 convolution. With C channels in and out, why are the two 3×3 layers often preferred?

  39. 39.A 56×56 feature map goes through 2×2 max pooling with stride 2. What comes out?

  40. 40.What is a 1×1 convolution used for?

  41. 41.A depthwise separable convolution splits a 3×3 convolution from 128 to 256 channels into a 3×3 depthwise step and a 1×1 pointwise step. Ignoring biases, how many weights does it use compared with the standard layer?

  42. 42.Why does a classification CNN often end with global average pooling instead of flattening into a large dense layer?

  43. 43.In a typical CNN, how do feature maps change as you go deeper?

  44. 44.You have 2,000 labeled X-ray images. What is the usual first approach with a CNN?

  45. 45.When fine-tuning a pretrained CNN on a small dataset, why do people often freeze the early layers?

  46. 46.When fine-tuning the whole pretrained network, why use a smaller learning rate than for training from scratch?

  47. 47.A model pretrained on daytime street photos is used on night-time infrared images. Why might transfer work poorly?

  48. 48.What is the difference between image classification and semantic segmentation?

  49. 49.Why does U-Net connect encoder layers directly to matching decoder layers?

  50. 50.What does intersection over union (IoU) measure in object detection?

  51. 51.A detector outputs five overlapping boxes around the same dog. What step keeps one?

  52. 52.Why do vision models often struggle when an object appears much smaller than in training images?

  53. 53.A Vision Transformer splits a 224×224 image into 16×16 patches. How many patch tokens does that give?

  54. 54.Why did early Vision Transformers need much more training data than CNNs to match them?

  55. 55.When would you still pick a CNN over a Vision Transformer for a new image task?

  56. 56.Can convolutions be used on sequences such as audio or text?

  57. 57.What does a recurrent neural network do at each time step?

  58. 58.What is backpropagation through time?

  59. 59.Why does a plain RNN have trouble learning that a word at position 5 affects the prediction at position 200?

  60. 60.What is truncated backpropagation through time?

  61. 61.What is the main idea that lets an LSTM keep information over long spans?

  62. 62.In an LSTM, what does the forget gate control?

  63. 63.Why is the LSTM forget-gate bias often initialized to a positive value such as 1?

  64. 64.An LSTM layer has input size 100 and hidden size 256, with one bias vector per gate. How many parameters does it have?

  65. 65.How does a GRU differ from an LSTM?

  66. 66.When is a bidirectional RNN appropriate?

  67. 67.In a sequence-to-sequence RNN without attention, what was the main limit on translating long sentences?

  68. 68.What did adding attention to seq2seq models let the decoder do?

  69. 69.What is teacher forcing when training a sequence decoder?

  70. 70.What is exposure bias in models trained with teacher forcing?

  71. 71.Why are RNNs slow to train on long sequences compared with transformers?

  72. 72.Where does an RNN still have an advantage over a standard transformer?

  73. 73.Gradient clipping is especially common when training RNNs. Why?

  74. 74.A character-level RNN generates plausible words but sentences that drift off topic after a line. What does that suggest?

  75. 75.What is the cost of self-attention as sequence length n grows?

  76. 76.Going from 1,024 to 4,096 tokens, how much larger is the attention score matrix per head?

  77. 77.Why do transformers need position information added to their inputs?

  78. 78.What is the main reason attention-based models replaced RNNs for most language tasks?

  79. 79.What does the causal mask in a decoder-only transformer do?

  80. 80.How does an encoder-only model like BERT differ from a decoder-only model like GPT?

  81. 81.Why does a transformer use several attention heads instead of one wide one?

  82. 82.Why are attention scores divided by the square root of the key dimension?

  83. 83.What is the key-value cache in transformer generation?

  84. 84.What does the feed-forward block in each transformer layer do?

  85. 85.Modern language models often apply layer norm before each sublayer (pre-norm) rather than after (post-norm). Why?

  86. 86.In a mixture-of-experts layer, what does the router do?

  87. 87.What is a word or token embedding?

  88. 88.Why do many language models share the weights of the input embedding and the output layer?

  89. 89.What does an autoencoder learn?

  90. 90.What makes a variational autoencoder able to generate new samples, unlike a plain autoencoder?

  91. 91.How is a generative adversarial network trained?

  92. 92.What is mode collapse in a GAN?

  93. 93.How does a diffusion model generate an image?

  94. 94.What does contrastive learning, as used in models like CLIP, train for?

  95. 95.Why do contrastive methods usually benefit from large batches?

  96. 96.What is knowledge distillation?

  97. 97.Why is a temperature above 1 used on the teacher's outputs during distillation?

  98. 98.What does post-training quantization to 8-bit integers do?

  99. 99.A model's accuracy drops 6 points after 4-bit quantization but only 0.3 points at 8 bits. What is a reasonable next step?

  100. 100.What is magnitude pruning?

  101. 101.Training loss of a CNN falls steadily, but validation accuracy stays at the level of always guessing the most common class. What is a likely bug?

  102. 102.A model trained on RGB images gets much worse in production, where images arrive as BGR. What happened?

  103. 103.Your deep model and a gradient-boosted model score about the same on a tabular dataset of 30,000 rows. Which is usually the better production choice?

  104. 104.Why is it hard to compare two papers' results when one used a larger compute budget?

  105. 105.A colleague replaces every ReLU in a trained network with GELU and evaluates without retraining. Accuracy drops sharply. Why?

  106. 106.Why are separate train and eval modes needed in most deep learning frameworks?