P
prepair.app
Start interview →
EnglishУкраїнськаРусскийDeutsch
🧠

Middle AI/ML EngineerAI/ML engineer interview questions

Middle · 2–4 years of experience

AI/ML interviews mix two things: classical machine learning theory — the kind you can be quizzed on a whiteboard — and the modern stack built around Python, PyTorch or TensorFlow, and increasingly transformers and LLMs. Below are the questions asked most often, each with a model answer. Middle: deeper understanding, optimization, and real-world situations.

Try it — no account needed
Preparing your question…

Topics to prepare

Supervised, unsupervised and reinforcement learning
Model evaluation and the bias-variance trade-off
Neural networks, backpropagation and optimization
Transformers, attention and LLM fine-tuning
RAG, embeddings and vector databases
MLOps: serving, monitoring and drift

5 Middle-level questions with answers

1

What causes vanishing and exploding gradients, and how do you deal with them?

Answer

In a deep network, gradients are multiplied together across many layers during backpropagation, so if those factors are consistently below 1 the gradient shrinks toward zero by the time it reaches early layers, and if they are above 1 it blows up. ReLU-family activations, careful weight initialization (Xavier, He), batch or layer normalization, and residual connections all address this — which is part of why ResNets and transformers can be trained so much deeper than plain feedforward nets.

2

What is transfer learning, and when does it help?

Answer

Transfer learning takes a model pretrained on a large, general dataset and adapts it to a smaller, more specific task, either by fine-tuning some layers or by using it as a frozen feature extractor. It helps most when your own dataset is too small to train a good model from scratch — which is most real projects — because the pretrained model already learned generic features like edges or syntax that transfer across tasks.

3

How do CNNs, RNNs and transformers differ in what they are good at?

Answer

CNNs use convolutional filters that exploit spatial locality, which is why they dominate image tasks. RNNs process sequences step by step and carry a hidden state forward, which made them the default for text and time series until their sequential nature made them slow to train and bad at long-range dependencies. Transformers process the whole sequence in parallel using attention, which is both faster to train and better at long-range dependencies, and is why they now dominate NLP and are increasingly used for vision too.

4

Walk through a typical PyTorch or TensorFlow training loop.

Answer

Load a batch, run the forward pass to get predictions, compute the loss against the ground truth, call backward to compute gradients via autograd, then step the optimizer to update the weights and zero the gradients before the next batch. Around that core loop sits validation on a held-out set every epoch, checkpointing the best model, and usually a learning rate scheduler that decays the rate as training progresses.

5

How do you approach hyperparameter tuning?

Answer

Grid search is exhaustive but expensive and wasteful when some parameters barely matter. Random search often finds a good configuration faster because it does not waste trials on unimportant dimensions. Tools like Optuna use Bayesian optimization to actively pick the next configuration based on past results, which converges faster than either — but the real skill is narrowing the search space first using domain knowledge instead of tuning blindly.

🦎

Reading answers is not enough

In a real interview you speak under pressure. Cam asks these same questions, scores every answer, and shows exactly what to fix.

Practice a Middle AI/ML Engineer interview →
Free · 3 interviews per month

Other levels — AI/ML Engineer

Junior AI/ML EngineerSenior AI/ML EngineerAll AI/ML Engineer questions

Other specializations

🔍Middle Manual QA🤖Middle QA AutomationMiddle Java Backend🐍Middle Python Backend🐘Middle PHP Backend🦫Middle Go Backend🟢Middle Node.js Backend💎Middle Ruby on Rails🟣Middle .NET Backend Developer🔷Middle C++