Skip to content
KPHB Colony, Kukatpally, Hyderabad Mon–Sat · 9 AM – 9 PM +91 96664 47822 Free demo class — book your seat

Interview Prep

Top 10 AI Interview Questions and How to Answer Them

Ten AI and machine learning interview questions with model answers and tips — bias-variance, cross-validation, imbalanced data, transformers, RAG and more.

The Data School · Updated 5 min read

How to use this guide

AI and machine learning interviews test two things: whether you understand the concepts, and whether you can explain them clearly. For each question below we give a short model answer and a tip on what interviewers are really checking. Say the idea in one or two sentences first, then add an example — that structure works for almost every technical question.

For more practice, see our free bank of Data Science & AI interview questions with answers.

1. What is the difference between supervised and unsupervised learning?

Answer: Supervised learning trains on labelled data — each example has the correct output — to predict a target, as in classification (spam or not) or regression (house price). Unsupervised learning finds structure in unlabelled data, such as clustering customers into segments or reducing dimensions with PCA.

Tip: Give one real example of each. Mentioning semi-supervised or self-supervised learning (used to pre-train LLMs) shows breadth.

2. Explain the bias-variance trade-off

Answer: Bias is error from a model that is too simple and misses patterns (underfitting). Variance is error from a model that is too sensitive to the training data (overfitting). Increasing complexity lowers bias but raises variance; we choose the complexity that minimises error on unseen data.

Tip: Connect it to practice — regularisation, more data or simpler models reduce variance; richer features or more flexible models reduce bias.

3. What is cross-validation and why use it?

Answer: In k-fold cross-validation the data is split into k parts. The model trains on k−1 parts and is tested on the remaining part, rotating k times. Averaging the scores gives a more reliable estimate than one train/test split and is used for model selection and tuning.

Tip: Mention stratified folds for imbalanced classes and time-based splits for time-series data, where random shuffling leaks the future into the past.

4. How do you handle an imbalanced dataset?

Answer: First use metrics that reflect the problem — precision, recall, F1, PR-AUC — rather than accuracy. Then consider class weights, oversampling the minority class (for example with SMOTE), undersampling the majority class, and tuning the decision threshold to the business cost of errors.

Tip: Interviewers love the "99% accuracy, useless model" example for fraud detection.

5. How does a random forest work?

Answer: It trains many decision trees, each on a bootstrap sample of rows and a random subset of features at each split, then averages predictions (regression) or takes a majority vote (classification). The randomness makes the trees less correlated, so the ensemble has lower variance than a single tree.

Tip: Contrast with gradient boosting, which builds trees sequentially to fix earlier errors.

6. Precision vs recall — which matters more?

Answer: Precision is the share of predicted positives that are correct; recall is the share of actual positives we catch. It depends on the cost of mistakes: in cancer screening or fraud detection we favour recall; in spam filtering, where a false alarm hides a real email, we favour precision. F1 balances the two.

Tip: Always tie the metric choice to a business consequence.

7. What is regularisation? L1 vs L2?

Answer: Regularisation adds a penalty on large weights to reduce overfitting. L1 (Lasso) penalises absolute values and can shrink some weights to zero, effectively selecting features. L2 (Ridge) penalises squared values, shrinking all weights smoothly and coping well with correlated features. Elastic Net combines both.

8. What is gradient descent?

Answer: Gradient descent is an optimisation method that adjusts model parameters step by step in the direction that reduces the loss most quickly — the negative gradient. The learning rate controls step size: too large and training diverges, too small and it is slow. Variants include stochastic and mini-batch gradient descent, and optimisers such as Adam.

Tip: Be ready to sketch a loss curve and explain what happens when the learning rate is too high.

9. What is a transformer, and why did it matter?

Answer: A transformer is a neural network architecture built on self-attention, which lets each token weigh the importance of every other token in the input. Unlike RNNs it processes sequences in parallel, which made it possible to train very large models efficiently. Transformers power today's large language models.

Tip: You don't need the maths — explain attention as "the model learns which words to focus on for each word".

10. What is RAG, and when would you use it instead of fine-tuning?

Answer: Retrieval-augmented generation retrieves relevant passages from your own documents — usually via embeddings and a vector database — and gives them to an LLM so it answers from those sources. Use RAG when the model needs private or frequently changing knowledge and you want citations. Use fine-tuning to change style or format, or to improve a narrow task where you have good training examples.

Tip: Mention evaluation — how you would measure answer quality and hallucination rate.

Beyond the technical questions

Expect these too, and prepare short, specific stories:

  • Walk me through a project. Problem → data → approach → result → what you would do differently.
  • How did you handle messy data? Name the issues you found and how you fixed them.
  • Explain a model to a non-technical manager. Use plain words and one clear chart.
  • What would you do if your model performed worse in production? Talk about data drift, monitoring and retraining.

Prepare with a mentor

Interview preparation — technical questions, project walkthroughs and mock interviews — is part of every program at The Data School in KPHB, Kukatpally. Explore the AI & Machine Learning course, the Generative AI course, or book a free demo class.

All articles
Chat on WhatsApp