InterviewStack.io LogoInterviewStack.io

Activation Functions & Non Linearity Questions

Know common activation functions: ReLU, sigmoid, tanh, softmax, GELU, and Swish. Understand why non-linearity is necessary: stacking any number of purely linear layers collapses to a single linear transformation, eliminating the network's ability to model complex functions. Know the advantages and disadvantages of each activation function (vanishing gradients, dead neurons/dying ReLU, computational cost, output range, saturation). Understand why ReLU remains the default choice in modern architectures despite its simplicity, and when smoother alternatives (GELU, Swish) are preferred in transformer-style models.

HardSystem Design
65 practiced
You are rolling out a model change that replaces ReLU with Swish in a production service. Design an A/B testing and rollout plan: specify success metrics, sample size considerations, latency/throughput monitoring, safety checks, rollback criteria, and how to isolate effects from confounders.
HardTechnical
55 practiced
Case study: after deploying a quantized model to mobile, overall accuracy dropped significantly. Offline investigation shows many activations are clipping/saturating after quantization. As the ML Engineer, list debugging steps you would take, propose fixes (e.g., quantization-aware training, per-channel quantization, activation clipping tuning), and outline CI and production validation steps.
HardSystem Design
55 practiced
Quantify trade-offs between compute and memory cost versus accuracy when using advanced activations (GELU/Swish) versus ReLU in a production inference service handling 10k req/s. How would you measure and decide if the accuracy gain justifies increased latency or infrastructure cost?
MediumTechnical
80 practiced
Explain why deep learning frameworks expose fused 'logits + cross-entropy' ops (e.g., tf.nn.softmax_cross_entropy_with_logits, nn.CrossEntropyLoss) instead of computing softmax then log then cross-entropy separately. Discuss both numerical-stability and performance reasons and pitfalls when writing custom losses.
HardTechnical
57 practiced
Design a controlled experiment to compare multiple activation functions (ReLU, LeakyReLU, GELU, Swish) across two tasks: CIFAR-10 image classification and small transformer language modeling. Specify dataset splits, model architectures, hyperparameter tuning protocol, number of seeds, metrics to report, statistical tests, and reproducibility steps.

Unlock Full Question Bank

Get access to hundreds of Activation Functions & Non Linearity interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.