Skip to content

Interview questions

AI/ML engineer interview questions

Common questions for AI/ML engineer roles. Read, copy and practise.

Free with every account.

Practice questions from open collections and written with AI. Not reported from interviews.

Technical

Coding

  1. Write a Python function to compute the mean squared error (MSE).

  2. Implement a simple linear regression model from scratch.

  3. Implement K-Nearest Neighbors (KNN).

  4. How would you implement k-means clustering?

  5. Write code to perform k-fold cross-validation.

  6. Write code to calculate precision and recall.

  7. Write a function to implement gradient descent for a simple linear regression model with a single feature.

  8. How would you implement a function to calculate the precision, recall, and F1-score from prediction and ground truth arrays?

Show 10 more coding questions
  1. Given an imbalanced dataset, write code to perform random undersampling and explain how it affects model training.

  2. Write a function that performs k-means clustering on a set of 2D points without using any external libraries.

  3. How would you implement the forward and backward pass for a single neuron with ReLU activation in Python?

  4. Given a large dataset that doesn’t fit into memory, write code to process it batch-wise for training a machine learning model.

  5. Explain and implement a function to compute the confusion matrix from predicted and true labels.

  6. Write code to detect and handle missing values in a dataset using mean or median imputation.

  7. Implement a decision tree prediction function that traverses a tree represented as nested dictionaries.

  8. Write an efficient algorithm to find the top-k frequent words in a large text corpus.

  9. How would you implement a mini-batch stochastic gradient descent algorithm for logistic regression?

  10. Given time-series data, write code that generates lag features for supervised learning.

System design

  1. Design a Real-Time Voice AI Agent.

  2. Design ChatGPT: Training to Serving (End to End)

  3. Design a RAG System (Chat with Your Documents)

  4. Design Memory for a Personal AI Assistant.

  5. Design a Deep Research Agent.

  6. Design a Multi-Agent Customer Support System.

  7. Design an On-Device AI Assistant.

  8. Design a Multimodal Search System (Text, Image, Video)

Show 33 more system design questions
  1. Design an LLM Inference Platform (vLLM-as-a-Service)

  2. Design an LLM Evaluation Platform.

  3. Design a Text-to-Image Generation Service (Midjourney-like)

  4. Design a Music Generation Service (Suno-like)

  5. Design a Video Generation Service (Sora-like)

  6. Design an AI Coding Agent.

  7. Design a Machine Learning System for YouTube Video Recommendation.

  8. Design a Machine Learning System for Personalized Content Feed.

  9. Design a Machine Learning System for Harmful Content Detection.

  10. Design a Machine Learning System for Similar Listings on Airbnb.

  11. Design a Machine Learning System for Replacement Product Recommendation.

  12. Design a Machine Learning System for Multimodal Search.

  13. Design a Machine Learning System for Ad Click Prediction.

  14. Design a Machine Learning System to Estimate Delivery Time.

  15. How would you build a system to detect fraudulent transactions?

  16. How would you build a spam detection system?

  17. Describe how you would implement an image classification system.

  18. How would you build a system to detect anomalies in network traffic?

  19. How would you design a scalable distributed training system to efficiently use dozens or hundreds of GPUs?

  20. Can you describe how you would design a scalable model serving architecture for real-time predictions?

  21. Explain how you would build a scalable NLP inference system that serves real-time predictions from a large language model.

  22. How would you design a scalable recommendation system that handles millions of users and items with low latency?

  23. Describe the data pipeline architecture you would build for training a machine learning model on large-scale streaming data.

  24. What considerations would you take into account when designing an ML system to ensure it is scalable and fault-tolerant?

  25. Explain how you would architect an A/B testing platform to evaluate multiple ML models in production safely.

  26. How do you design a feature store that supports both batch and online serving for machine learning models?

  27. What system design choices would you make to reduce data drift impact in a deployed machine learning model?

  28. Describe an architecture to automate model retraining and deployment triggered by new incoming data.

  29. How would you design a monitoring system to track model performance, data quality, and alert on anomalies in production?

  30. Explain how you would design an ML pipeline that supports multiple teams collaborating and experimenting concurrently.

  31. How would you approach designing a personalized search ranking system that updates frequently with user feedback?

  32. Design a system that can handle imbalanced data for training real-time fraud detection models without sacrificing latency.

  33. How would you approach designing a system to perform real-time object detection on a mobile device with limited computational resources?

Other technical questions

  1. Explain Epoch, Batch, Batch Size, and Iteration.

  2. What are embeddings in Machine Learning?

  3. What is Softmax Activation Function?

  4. What is Reinforcement Learning?

  5. What is Bias?

  6. What is the difference between Classification and Regression?

  7. Explain Overfitting and Underfitting. How can you prevent them?

  8. What Are L1 and L2 Loss Functions?

Show 287 more other technical questions
  1. What is Regularization? Explain L1 (Lasso) and L2 (Ridge) regularization.

  2. What are Loss Functions and Cost Functions? Explain the key difference between them.

  3. What are dropouts?

  4. What is a Perceptron?

  5. Explain Multilayer Perception (MLP).

  6. Why can't a single perceptron solve the XOR problem?

  7. What is Cross-Entropy?

  8. What are Logits?

  9. Explain Cross-Validation. Why is it used?

  10. What is anomaly detection?

  11. What is the difference between policy-based and value-based methods?

  12. What is Q-Learning?

  13. Explain the concept of exploration vs exploitation.

  14. Explain the curse of dimensionality and how to address it.

  15. Explain Local Loss, Focal Loss, and Gradient Blending in the context of Multi-Task Learning.

  16. Explain Contrastive Learning.

  17. What is Generative AI?

  18. How does a Decision Tree algorithm work?

  19. Explain how Decision Trees make splits and handle categorical features.

  20. Explain Ensemble Methods. Why are they powerful?

  21. What is the difference between bagging and boosting?

  22. What are the key hyperparameters for XGBoost?

  23. Explain Gradient Boosting and its advantages over Random Forests.

  24. Explain how Logistic Regression differs from Linear Regression.

  25. How does logistic regression work?

  26. Explain R-squared and adjusted R-squared.

  27. How do you check for multicollinearity in regression models?

  28. How does K-Nearest Neighbors (KNN) work?

  29. Explain Support Vector Machines (SVM). What is the kernel trick?

  30. What is the decision boundary in classifiers?

  31. Explain Naive Bayes.

  32. What is Dimensionality Reduction?

  33. Explain Gradient Descent and its variants.

  34. What is the ROC-AUC curve, and how is it interpreted?

  35. What is Feature Engineering?

  36. How do you deal with missing data?

  37. How do you handle Outliers?

  38. Explain Feature Scaling. Why is it needed?

  39. How do you handle Categorical Features?

  40. Explain Feature selection vs feature extraction.

  41. How would you create new features from existing ones?

  42. How do you approach a dataset with highly imbalanced classes?

  43. How do you select features for a model?

  44. What is stochastic gradient descent (SGD)?

  45. What are vanishing gradients?

  46. How does the learning rate affect model training?

  47. How do you approach hyperparameter tuning?

  48. How do you ensure fairness and reduce bias in ML models?

  49. Explain Grid Search vs Random Search vs Bayesian Optimization.

  50. Explain TPE hyperparameter optimization.

  51. Explain Bayesian Optimization.

  52. Explain Adam Optimizer.

  53. Explain the RMSprop Optimizer.

  54. What is Adagrad Optimizer?

  55. What are neural networks?

  56. How does matrix multiplication work in neural networks?

  57. Explain the Feedforward Neural Network.

  58. What are forward propagation and backward propagation?

  59. What is backpropagation?

  60. Can you name and explain a few hyperparameters used for training a neural network?

  61. What is the advantage of deep learning over traditional machine learning?

  62. What are activation functions, and why are they used?

  63. Explain Sigmoid, Tanh, ReLU, LeakyReLU, and Softmax activation functions with their pros and cons.

  64. Why are Sigmoid and Tanh not preferred in the hidden layers of a neural network?

  65. What is dropout, and why is it effective?

  66. What is the effect of dropout on training and inference speed?

  67. What is L1/L2 regularization, and how does it affect a neural network?

  68. What is batch normalization, and why is it used?

  69. What are the hyperparameters for batch normalization that can be optimized?

  70. What is parameter sharing in deep learning?

  71. What is representation learning, and why is it useful?

  72. What is a generative model, and how does it differ from a discriminative model?

  73. Can you explain how a generative model works?

  74. Explain Encoder-Decoder Architecture.

  75. What is the difference between encoder-only, decoder-only, and encoder-decoder Transformer architectures?

  76. What is Latent Space?

  77. What are autoencoders? Explain their layers and practical uses.

  78. What is a Variational Autoencoder (VAE), and how is it different from a traditional autoencoder?

  79. How does VAE impose a probabilistic structure on the latent space, and why is that important?

  80. What is the architecture of a Generative Adversarial Network (GAN)?

  81. What are the roles of the generator and discriminator in a GAN?

  82. What is mode collapse in GANs, and how can it be mitigated?

  83. How are GANs used in image synthesis or image-to-image translation tasks?

  84. Explain Convolutional Neural Networks (CNN).

  85. Explain filters in CNN.

  86. Explain the stride in CNN.

  87. Explain padding in CNN.

  88. Explain pooling in CNN.

  89. Explain fully connected layers in CNN.

  90. What are the limitations of RNNs, and how are they solved?

  91. What are the main gates in LSTM and their roles?

  92. How to identify exploding gradient issues in your model?

  93. What is a Transformer architecture, and what makes it different from CNNs and RNNs?

  94. What is the Attention mechanism in deep learning, and why is it significant?

  95. What is the basic difference between LSTM and Transformers?

  96. Why does Diffusion work better than Auto-Regression?

  97. Explain transfer learning and when to use it.

  98. What are Multimodal AI models, and how do they process different types of data?

  99. How does a Vision-Language Model (VLM) work?

  100. How do World Models work?

  101. How do Diffusion Language Models (DLMs) work?

  102. What are the advantages of Transformers over traditional sequence-to-sequence models?

  103. What are the limitations of Transformers, and how can they be addressed?

  104. What is BERT, and how does it improve language understanding?

  105. How are Transformers trained (pre-training and fine-tuning)?

  106. Explain transfer learning in the context of Transformers.

  107. Describe the process of text generation using Transformer-based language models.

  108. What are Seq2Seq models?

  109. Compare N-gram models and deep learning models (trade-offs).

  110. What is the n-gram model?

  111. What is TF-IDF, and how does it differ from word embeddings?

  112. What is Bag-of-Words?

  113. What is perplexity used for in NLP?

  114. What is stemming vs lemmatization?

  115. What is Latent Semantic Indexing (LSI)?

  116. What is dependency parsing?

  117. What are some approaches for text summarization?

  118. What are word embeddings?

  119. What is Word2Vec?

  120. What is t-SNE, and how is it used for NLP?

  121. What is computer vision, and why is it important?

  122. What is image segmentation, and what are its applications?

  123. What is object detection, and how does it differ from image classification?

  124. What are the steps to build an image recognition system?

  125. What are the challenges in real-time object tracking?

  126. What is feature extraction in computer vision?

  127. What is OCR, and what are its main applications?

  128. How does CNN differ from traditional neural networks in computer vision?

  129. What is data augmentation, and what techniques are commonly used?

  130. What are some popular deep learning frameworks for computer vision?

  131. How can Transformers be used for computer vision tasks?

  132. What is a Large Language Model (LLM), and how does it work?

  133. What is the Transformer architecture and how does it work?

  134. What are the key components of the Transformer architecture?

  135. Why do we scale the dot product attention by √dₖ in the Transformer architecture?

  136. What is Flash Attention?

  137. What is speculative decoding, and how does it speed up inference?

  138. How does continuous batching improve LLM inference throughput?

  139. What is pre-training vs fine-tuning in LLMs?

  140. What are some challenges in training LLMs?

  141. What is zero-shot learning in the context of LLMs?

  142. How do you handle bias and fairness in LLMs?

  143. How does the Transformer architecture improve LLM performance over RNNs?

  144. Explain the Query(Q), Key(K), and Value(V) in attention.

  145. What is self-attention, and how does it work in Transformers?

  146. What is Cross Attention in Transformers?

  147. How does attention help capture long-range dependencies?

  148. What is Grouped-Query Attention (GQA), and how does it differ from Multi-Head Attention (MHA)?

  149. What are Feed-Forward Networks in LLMs?

  150. What is subword tokenization?

  151. What is BPE (Byte Pair Encoding) in LLMs?

  152. What is positional embedding in LLMs?

  153. What is temperature in the context of LLMs?

  154. Why do LLMs hallucinate?

  155. What are stop tokens in LLMs?

  156. What is causal masking?

  157. What are skip connections?

  158. How does Rotary Position Embedding (RoPE) work, and why is it preferred over learned positional embeddings?

  159. What is normalization?

  160. Explain RMSNorm (Root Mean Square Layer Normalization)

  161. What is dropout, and how is it applied in LLMs?

  162. Why does Attention use Softmax?

  163. What does a vector database (Vector DB) store for LLM usage?

  164. How do you improve inference speed in production LLM deployments?

  165. Why is the context window limited in LLMs?

  166. Explain Prompting, Retrieval-Augmented Generation (RAG), and Fine-Tuning.

  167. What is Mixture of Experts (MoE), and how does it work in models like Mixtral?

  168. What is the difference between dense and sparse models?

  169. Transformers work on text, so can they also understand images?

  170. How does Knowledge Distillation work?

  171. What is instruction tuning, and why is it important for chat models?

  172. How does Sliding Window Attention work?

  173. How do Attention Sinks work?

  174. What are precision, recall, F1 score, and accuracy?

  175. What are common evaluation metrics for Classification?

  176. When would you use accuracy vs other metrics?

  177. When would you use log loss vs accuracy?

  178. What metrics would you use for a multi-class classification problem?

  179. How do you handle class imbalance in classification metrics?

  180. How do you handle imbalanced datasets?

  181. What's the difference between MAE, MSE, and RMSE?

  182. How do you choose the right evaluation metric for a given problem?

  183. How do you compare the performance of different models?

  184. Explain cross-validation and its importance.

  185. What is Hyperparameter Tuning?

  186. How do you evaluate unsupervised learning models?

  187. How do you evaluate a clustering algorithm?

  188. What metrics would you use for a recommendation system?

  189. What is A/B testing in the context of ML?

  190. How would you approach a time series forecasting problem?

  191. What approach would you take for a sentiment analysis task?

  192. How would you design a customer churn prediction model?

  193. What would be your approach to ranking search results?

  194. How do you choose the right machine learning algorithm?

  195. How would you handle large-scale data for training?

  196. How do you deal with noisy data in machine learning models?

  197. What strategies would you use to optimize the training time for a deep learning model?

  198. How do you deploy an ML model in production?

  199. How do you monitor a model's performance in production?

  200. How would you deploy a model with low-latency requirements?

  201. What are the common challenges when deploying ML models?

  202. How do you ensure your model is scalable and performs well with large datasets?

  203. What techniques would you use to make a model more interpretable?

  204. Describe your approach to debugging an underperforming ML model.

  205. Explain MLOps and its key components.

  206. What is a feature store, and why is it important?

  207. Tell about the Model Compression Techniques.

  208. Explain the Bias-Variance Tradeoff.

  209. How would you use Pandas to load and clean data?

  210. What is cosine similarity, and how is it different from Euclidean distance?

  211. How would you approach a project with limited labeled data?

  212. What would you do if a model performs well in testing but poorly in production?

  213. Can you explain the bias-variance tradeoff and how it impacts model performance?

  214. What are the differences between supervised, unsupervised, and reinforcement learning?

  215. Describe how you would handle imbalanced datasets in a classification problem.

  216. Explain the concept of overfitting and name at least two techniques to prevent it.

  217. How would you detect and correct multicollinearity among features in your dataset?

  218. Can you describe the difference between parametric and non-parametric models with examples?

  219. How does gradient descent work, and what are some challenges in using it for training models?

  220. What is the role of the activation function in neural networks, and why can’t it be linear?

  221. Explain the concept of cross-validation and its importance in model selection.

  222. How do decision trees decide where to split, and what criteria are commonly used?

  223. Can you explain the concept of backpropagation in neural networks and why it is essential?

  224. Describe the vanishing gradient problem and strategies to mitigate it in deep neural networks.

  225. What are the differences between LSTM and GRU units in recurrent neural networks?

  226. How would you design a deep learning model pipeline for image classification in a resource-constrained environment?

  227. Explain the role and importance of activation functions in neural networks and examples of where certain functions excel.

  228. Can you discuss dropout regularization and its impact on the training of deep neural networks?

  229. How do batch normalization layers improve the training process of deep neural networks?

  230. Describe a scenario when transfer learning is beneficial and how you would implement it for a new dataset.

  231. What techniques would you use to interpret or visualize what a deep neural network has learned?

  232. How do attention mechanisms work in transformer models, and why have they become so popular?

  233. How do you optimize data loading and preprocessing pipelines to prevent GPU underutilization during large-scale training?

  234. Can you explain the differences between data parallelism and model parallelism when training machine learning models at scale on GPUs?

  235. Describe how mixed precision training improves performance and memory efficiency on GPUs at scale.

  236. What strategies do you use to handle GPU memory limitations when training very large deep learning models?

  237. Explain the concept of gradient accumulation and its benefits in large-scale training with limited GPU memory.

  238. How do you monitor and debug performance bottlenecks during training on GPU clusters?

  239. What are the trade-offs between synchronous and asynchronous gradient updates in distributed GPU training?

  240. What considerations do you make for fault tolerance when training models across multiple GPUs or nodes?

  241. How do you decide when to move from single-GPU training to multi-GPU or distributed training?

  242. How do you handle versioning and rollback when deploying new machine learning models in production?

  243. What strategies do you use to monitor model performance and detect concept drift after deployment?

  244. What considerations do you take into account when choosing between batch inference and online serving?

  245. Explain how you would containerize a machine learning model for deployment using Docker or similar technologies.

  246. Describe your experience with model deployment tools like TensorFlow Serving, TorchServe, or MLflow.

  247. What are the main challenges you have faced when deploying models in multi-cloud or hybrid cloud environments?

  248. How do you manage feature consistency between training and serving pipelines to avoid data skew?

  249. How do you handle model caching and load balancing to optimize serving latency and throughput?

  250. Can you describe your experience building and managing end-to-end ML pipelines, including data preprocessing, model training, and deployment?

  251. How do you implement continuous integration and continuous deployment (CI/CD) in MLOps workflows to ensure model reliability?

  252. Explain how you would approach automating retraining of a model when monitoring metrics indicate performance degradation.

  253. How do you handle versioning of datasets, code, and models to enable reproducibility in ML pipelines?

  254. What metrics would you monitor to ensure an NLP model deployed in a customer service chatbot remains effective over time?

  255. How would you design an alerting system for data quality issues that could affect an ML model's predictions?

  256. Can you explain the difference between data drift and concept drift and their impact on model performance?

  257. Can you explain how the Transformer architecture works and why it’s effective for NLP tasks?

  258. Describe how you would preprocess text data for training a large language model.

  259. What strategies do you use to fine-tune a large pre-trained language model on a domain-specific dataset?

  260. How do attention mechanisms improve the performance of LLMs compared to traditional RNNs or CNNs?

  261. Can you discuss how bias in training data affects language model outputs and what mitigation techniques you apply?

  262. How do you evaluate the quality and relevance of outputs generated by large language models?

  263. How do domain-specific knowledge and context influence the design or tuning of language models for specialized applications?

  264. Explain the differences between masked language modeling and autoregressive language modeling and when each is appropriate.

  265. Describe a method to address the cold start problem in a recommendation system for new users.

  266. What techniques do you use to handle and reduce bias in recommendation algorithms?

  267. Explain how matrix factorization works in collaborative filtering and why it is effective.

  268. How would you incorporate user feedback or implicit signals like clicks and dwell time into a recommendation model?

  269. Can you discuss challenges related to diversity and novelty in recommendations, and how you address them?

  270. What trade-offs do you consider when choosing between on-device inference and server-based inference in an ML system?

  271. Can you explain the differences between convolutional neural networks and transformers in computer vision tasks?

  272. Describe a method to handle class imbalance in a dataset used for image classification.

  273. What are common techniques to improve the robustness of image segmentation models against noise and occlusion?

  274. Explain how you would evaluate the performance of a computer vision model detecting defects in manufacturing parts.

  275. Describe the role of data augmentation in training deep learning models for computer vision and provide examples.

  276. How would you manage a situation where the visual dataset contains biased representations affecting fairness in the model's predictions?

  277. Explain the trade-offs between using classical computer vision algorithms versus deep learning for image recognition tasks in production.

  278. How do you ensure labeling quality and consistency when preparing data for machine learning models?

  279. What strategies can you use to detect and prevent data leakage during model development?

  280. Can you explain the impact of class imbalance on model performance and how to address it?

  281. What techniques do you apply to automate or scale the labeling process for large datasets?

  282. How would you handle a situation where different annotators label data inconsistently?

  283. What are the risks of using future data in training and how does it relate to leakage?

  284. Explain how synthetic data generation can help with imbalanced datasets and any potential pitfalls.

  285. When building a model for an imbalanced dataset, how do you choose the right evaluation metric?

  286. What measures can you take during feature engineering to minimize the risk of data leakage?

  287. Discuss how overfitting can be a sign of data leakage and how to troubleshoot it.

Domain knowledge

  1. What are some real-world applications of LLMs in business and tech?

  2. Explain different probability distributions (Normal, Binomial, Poisson, Uniform).

  3. What is the normal distribution and its functions?

  4. What is an exponential distribution?

  5. What is the binomial distribution?

  6. What is the Bernoulli distribution?

  7. What is the lognormal distribution?

  8. What is a logistic distribution?

Show 22 more domain knowledge questions
  1. When would you use a Poisson distribution over a Binomial distribution?

  2. What is the variance?

  3. What is stddev?

  4. Explain the difference between mean, median, and mode.

  5. What is the difference between correlation and covariance?

  6. What does a correlation coefficient of +1, 0, and -1 indicate?

  7. Explain Correlation vs Causation.

  8. What are Type I and Type II errors?

  9. Explain p-values and their limitations.

  10. What is hypothesis testing, and when is it used in ML?

  11. What statistical tests would you use to compare two models?

  12. How do you assess if a feature is statistically significant?

  13. What is a confidence interval, and how is it used?

  14. Explain Bayes' Theorem. How is it relevant to Naive Bayes or Bayesian methods?

  15. What's the difference between MLE and MAP estimation?

  16. What is Maximum Likelihood Estimation (MLE)?

  17. Explain the Bayesian vs Frequentist approach in statistics.

  18. What are sampling techniques?

  19. What is the bootstrap method, and how is it used?

  20. Where do you see ML/AI heading in the next 5 years?

  21. How do you ensure data privacy and compliance during model deployment and serving in regulated industries?

  22. How do you ensure compliance and governance in ML pipelines when deploying models in regulated industries?

Behavioral

Motivation

  1. Why are you interested in this role/company?

  2. What motivates you to specialize in model deployment and serving within machine learning engineering?

  3. What motivates you to focus on MLOps and deployment rather than solely on model development?

  4. What makes you interested in working specifically with NLP and large language models within our industry?

Other behavioral questions

  1. Describe a time you improved a model’s performance.

  2. How do you stay updated with ML advancements?

  3. Describe a situation where your ML model failed or didn't perform as expected. What did you do?

  4. How would you handle disagreements with colleagues about model choices or approaches?

  5. Discuss a time you debugged a complex deep learning model and the approach you took to resolve the issue.

  6. Tell me about a time you resolved a critical issue with a model already deployed in production.

  7. Describe a time when you identified model drift in production and the steps you took to diagnose and remediate it.

  8. Describe a project where you implemented or improved NLP components—what were the key challenges and outcomes?

Show 4 more other behavioral questions
  1. Describe an experience when you improved an existing ranking system. What changes did you implement and what impact did they have?

  2. Tell me about a time you had to debug a machine learning pipeline for a recommendation system. What approach did you take?

  3. Can you discuss an experience where you improved a computer vision pipeline’s accuracy or efficiency and the steps you took?

  4. Describe a time you identified data leakage in a project and how you resolved it.

All interview questions

How this data is collected

By company

Shaped by a company.

More AI/ML engineer questions, shaped by what each of these companies publicly builds.

Next

When the interview comes.

  • Transcribe

    Live transcription of a call, readable on any phone as it happens.

    Learn more
  • Interview copilot

    Suggested answers during your interview, from your resume and the role.

    Learn more