How do you compute the parameter count of a linear layer and a convolution?
mediumAnswer
- Linear(in, out): in * out + out (weights + bias).
- : .
- Multi-head attention with hidden d and n heads: (Q, K, V, out projections) + biases.
- MLP block: (up + down projection).
- Practical parameter count for a transformer layer ≈ .
Check yourself — multiple choice
- Only the number of layers matters
- Linear: in*out + out; Conv: ; transformer layer ≈ 12·
- Bias never counts
- Attention has no parameters
Basic counts + ~12· per transformer layer .
#fundamentals#architectures
Practise Deep Learning
214 interview questions in this topic.
Related questions
- Depth vs width — which do you scale first?
- How do FLOPs scale for a forward pass through an MLP and a transformer?
- What do residual connections actually fix?
- ReLU vs sigmoid vs GELU — when do you use each?
- Why do residual (skip) connections help training deep networks?
- In one sentence, what is backpropagation?