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

AI/ML engineer interview questions

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.

Junior · no experience / under 1 yearMiddle · 2–4 years of experienceSenior · 5+ years of experience

What they ask about

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

9 real questions with answers

Every question comes with a model answer you can compare yours against.

1

What is the difference between supervised and unsupervised learning?

Answer

Supervised learning trains on labeled examples — you have inputs and the correct outputs, and the model learns to map one to the other, as in classification or regression. Unsupervised learning has no labels; it looks for structure on its own, as in clustering or dimensionality reduction. Reinforcement learning is a third category where an agent learns from reward signals produced by its own actions rather than from a fixed dataset.

2

What is overfitting, and how do you prevent it?

Answer

Overfitting is when a model memorizes the training data — including its noise — instead of learning the underlying pattern, so it scores well on training data and poorly on anything new. You fight it with regularization (L1/L2), dropout in neural networks, more training data, early stopping, or simply a smaller model. Underfitting is the opposite failure: the model is too simple to capture the pattern at all, and both training and validation scores are bad.

3

Why split data into train, validation and test sets?

Answer

The training set is what the model learns from. The validation set is used during development to tune hyperparameters and pick between models without touching the true holdout. The test set is touched exactly once, at the end, to report a number you can trust — if you tune on it, that number stops meaning anything, which is a mistake I still see in real pipelines.

4

When is accuracy the wrong metric, and what do you use instead?

Answer

Accuracy is misleading on imbalanced data — a model that always predicts "not fraud" is 99% accurate on a dataset that is 99% legitimate transactions, and useless. Precision tells you how many predicted positives were actually correct; recall tells you how many actual positives you caught; F1 is their harmonic mean when you need one number. ROC-AUC is useful for comparing models across all thresholds at once, but precision-recall curves are more honest on heavily imbalanced classes.

5

What is backpropagation?

Answer

It is the algorithm that computes how much each weight in a neural network contributed to the error, using the chain rule to propagate the gradient of the loss backward from the output layer to the input layer. Each weight is then nudged in the direction that reduces the loss, scaled by the learning rate. It is not magic — it is calculus applied efficiently by reusing intermediate computations layer by layer instead of recomputing them from scratch.

6

What is the attention mechanism in a transformer?

Answer

Attention lets each token in a sequence look at every other token and decide how much to weight it when building its own representation, instead of processing the sequence strictly in order like an RNN does. Self-attention computes query, key and value vectors for every token, and the dot product of query and key gives the attention weight. This is what lets transformers model long-range dependencies in parallel and is the core reason they replaced RNNs for most NLP work.

7

When do you fine-tune a model versus just prompting it?

Answer

Prompting — including few-shot examples in the context — is faster to iterate on, needs no training infrastructure, and works well when the task is close to what the base model already does. Fine-tuning is worth the cost when you need a specific output format reliably, when the domain vocabulary is far from general training data, or when you need to bake in behavior that a prompt cannot reliably enforce. In practice, most teams try prompting and RAG first and only fine-tune when those hit a real ceiling.

8

What is RAG (retrieval-augmented generation), and why use it?

Answer

RAG retrieves relevant documents from a vector database — usually via embedding similarity — and stuffs them into the prompt so the model answers using that grounded context instead of only its training data. It is the standard fix for hallucination on domain-specific or fast-changing knowledge, because updating the index is far cheaper than retraining the model. The trade-off is that answer quality now depends heavily on retrieval quality: a bad chunking strategy or a stale embedding index quietly produces bad answers.

9

How do you monitor a model in production, and what is data drift?

Answer

You track prediction distributions, input feature distributions and the eventual ground-truth outcomes when they become available, comparing them against what the model saw during training. Data drift is when the input distribution shifts over time — user behavior changes, a new market opens, a sensor gets recalibrated — so a model that was accurate at training time slowly stops being accurate for reasons that have nothing to do with the model itself. Catching it requires monitoring inputs, not just waiting for accuracy metrics to visibly degrade, because by then real damage has already happened.

🦎

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 an AI/ML Engineer interview →
Free · 3 interviews per month

Worth reading

All articles →

Other specializations

🔍Manual QA🤖QA AutomationJava Backend🐍Python Backend🐘PHP Backend🦫Go Backend🟢Node.js Backend💎Ruby on Rails🟣.NET Backend Developer🔷C++🟨JavaScript⚛️React Frontend💚Vue Frontend🅰️Angular FrontendNext.js🍏iOS (Swift)🟩Android (Kotlin)📱React Native Developer⚙️DevOps / SRE🗄️Data Engineer📊Data Scientist📈Business Analyst🎯Product Manager📋Project Manager🎨UI/UX Designer📣Marketing🧑‍💼HR / Recruiter🤝Sales / Account Manager🎧Technical Support Engineer