Interview prep
AI & Machine Learning Interview Questions 164 questions across 18 topics — from the maths foundations to retrieval-augmented generation, AI agents, prompt engineering, fine-tuning, multimodal and diffusion models, AI safety, data engineering and the behavioural rounds. Every question comes with a plain-English analogy, a precise answer, and code where it helps.
All Foundations & Math Intuition Classical Machine Learning Deep Learning Large Language Models & GenAI MLOps & Production Systems Computer Vision Natural Language Processing Reinforcement Learning Model Evaluation & Statistics ML System Design Retrieval-Augmented Generation & Vector Search AI Agents, Tools & Orchestration Prompt Engineering & Context Design Fine-Tuning & Model Optimization Multimodal, Diffusion & Generative Media AI Safety, Alignment & Responsible AI Data Engineering for AI AI Career, Behavioural & Case Rounds
All easy medium hard
Foundations & Math Intuition easy What's the difference between bias and variance, and why can't you minimize both freely? medium Explain gradient descent as if teaching someone with no ML background, then show the update rule in code. medium What is the curse of dimensionality, and why does it hurt distance-based models like k-NN? easy Why do we use cross-entropy loss instead of mean squared error for classification? medium What is the difference between a generative and a discriminative model? medium Explain the intuition behind eigenvectors/eigenvalues in the context of PCA. hard What is the difference between Maximum Likelihood Estimation (MLE) and Maximum A Posteriori (MAP) estimation? easy What is the difference between parametric and non-parametric models? medium Why is the softmax function used for multi-class classification, and what's a numerically stable implementation? hard What is the difference between convex and non-convex optimization, and why does it matter for training neural networks? Classical Machine Learning medium How does a Random Forest reduce overfitting compared to a single Decision Tree? hard Explain how gradient boosting (e.g., XGBoost) differs fundamentally from bagging methods like Random Forest. easy Why do we scale/normalize features before training models like SVM or k-NN, but not for tree-based models? medium What's the difference between L1 and L2 regularization, and why does L1 tend to produce sparse models? medium How does the kernel trick let SVMs handle non-linearly separable data without explicitly computing high-dimensional features? easy What is k-means clustering, and what's a major limitation of the algorithm? medium What's the difference between bagging and stacking as ensemble techniques? hard Explain the exploration-exploitation tradeoff via Bayesian optimization for hyperparameter tuning. medium What is feature leakage, and give a concrete example of how it silently inflates reported performance. easy What is the difference between a validation set and a test set, and why do you need both? Deep Learning medium What is the vanishing gradient problem, and how do architectures like ResNet or LSTMs address it? hard Explain self-attention in Transformers in plain terms, then show the scaled dot-product formula. medium What is batch normalization, and why does it help training converge faster? medium Dropout seems like it should hurt performance — why does it actually help generalization? hard Why do we need positional encodings in Transformers, when RNNs don't need them? medium Why is ReLU generally preferred over sigmoid/tanh as an activation function in deep networks? medium What's the difference between a CNN's convolutional layer and a fully connected layer, and why are CNNs so effective for images? hard What is the difference between an autoencoder and a variational autoencoder (VAE), and why does the VAE's latent space enable generation? medium What is transfer learning, and why does fine-tuning a pretrained model usually beat training from scratch on a small dataset? hard What is the difference between layer normalization and batch normalization, and why do Transformers use LayerNorm? Large Language Models & GenAI medium What is Retrieval-Augmented Generation (RAG), and why do we need it if the model already 'knows' things? hard What causes LLM hallucination, and what practical strategies reduce it? medium Explain the difference between fine-tuning and prompt engineering/few-shot learning — when would you choose each? medium What is LoRA (Low-Rank Adaptation), and why has it become so popular for fine-tuning large models? hard What is RLHF (Reinforcement Learning from Human Feedback), and why is it needed on top of standard pretraining? medium Why is tokenization (e.g., Byte Pair Encoding) important, and what problems can it cause? medium What is the difference between temperature and top-p (nucleus) sampling when generating text from an LLM? hard What is chain-of-thought (CoT) prompting, and why does it improve performance on multi-step reasoning tasks? medium What is an embedding, and why does cosine similarity tend to be preferred for comparing text embeddings? hard What is model distillation, and how does it differ from quantization as a compression technique? MLOps & Production Systems medium What is data/concept drift, and how would you detect it in a production ML system? hard Why is 'accuracy' often a misleading metric, and what would you use instead for an imbalanced fraud-detection dataset? medium What's the difference between online (real-time) and batch inference, and how do you decide which to use? medium What is model quantization, and why does it matter for deploying LLMs? hard How would you design an A/B test to validate a new ML model before fully replacing the current production model? medium What is a feature store, and what problem does it solve in ML systems? medium What is the difference between model monitoring and data quality monitoring, and why do you need both? hard What is canary deployment in the context of ML models, and how does it differ from a full A/B test? medium Why is reproducibility hard in ML pipelines, and what practices help ensure it? hard How would you design a system to serve an LLM cost-effectively at scale while keeping latency acceptable? Computer Vision easy What is the difference between image classification, object detection, and semantic segmentation? medium What is data augmentation in computer vision, and why does it help even without new real information? medium What is the purpose of anchor boxes in object detection models like Faster R-CNN or YOLO? hard What is Non-Maximum Suppression (NMS), and why is it necessary in object detection? medium What is the intuition behind Intersection over Union (IoU), and how is it used to evaluate detection models? medium What is the difference between a Vision Transformer (ViT) and a CNN in how they process images? hard What is the difference between how GANs and diffusion models generate images? medium Why do we use transfer learning with ImageNet-pretrained backbones even for very different domains (e.g., medical imaging)? medium What is the purpose of pooling layers (e.g., max pooling) in a CNN? hard What is contrastive learning (e.g., CLIP or SimCLR), and why is it useful for learning representations without labels? Natural Language Processing easy What is the difference between stemming and lemmatization? medium What is TF-IDF, and what problem does it solve compared to raw word counts? medium What is Named Entity Recognition (NER), and why is it framed as a sequence-labeling problem? hard What is the difference between encoder-only, decoder-only, and encoder-decoder Transformer architectures, and when is each used? medium What is word2vec, and how do the skip-gram and CBOW variants differ? medium What is the difference between extractive and abstractive text summarization? hard Why does perplexity matter as a language model evaluation metric, and what does a lower perplexity actually mean? medium What is the difference between a sparse retriever (like BM25) and a dense retriever (embedding-based) in a search/RAG pipeline? medium What are subword tokens, and why do modern NLP models almost never tokenize whole words directly? hard What is catastrophic forgetting, and why is it a risk when fine-tuning a pretrained language model on a narrow new task? Reinforcement Learning easy What are the core components of a reinforcement learning problem (agent, environment, state, action, reward)? medium What is the exploration-exploitation tradeoff in RL, and how does epsilon-greedy address it? hard What is the difference between value-based methods (Q-learning) and policy-based methods (REINFORCE/PPO)? medium What is the discount factor (gamma) in reinforcement learning, and what happens at the extremes? hard What is reward hacking, and give a concrete example of an RL agent 'gaming' a poorly designed reward function. medium What is the difference between on-policy and off-policy reinforcement learning algorithms? medium Why is PPO (Proximal Policy Optimization) so widely used in practice, including for RLHF? hard What is the credit assignment problem in RL, and how do techniques like advantage estimation help? medium What is a Markov Decision Process (MDP), and what does the 'Markov property' actually assume? hard Why is RL generally considered more sample-inefficient than supervised learning, and how does this affect real-world applicability? Model Evaluation & Statistics easy What is the difference between precision and recall, and why is there usually a tradeoff between them? medium What does the ROC-AUC score actually measure, and what's a common misinterpretation of it? medium What is k-fold cross-validation, and why is it generally more reliable than a single train/test split? hard What is statistical significance, and why can a result be significant but not practically meaningful? medium What is calibration in the context of a classifier's predicted probabilities? medium What is the difference between Type I and Type II errors, and how does adjusting a significance threshold affect the tradeoff? hard What is the difference between epistemic and aleatoric uncertainty in a model's predictions? medium Why is a confusion matrix often more informative than a single accuracy number, especially for multi-class problems? hard What is bootstrapping, and how can it estimate a confidence interval around a model's performance metric? medium What is the difference between R-squared and adjusted R-squared? ML System Design medium How would you approach designing a recommendation system for an e-commerce site from scratch? hard How would you design a real-time fraud detection system that needs to score transactions in under 100ms? medium What tradeoffs would you weigh when deciding whether to build a custom ML model or use a pretrained/off-the-shelf model or API? hard How would you design a scalable system to generate and serve embeddings for millions of products, supporting fast similarity search? medium How would you handle the cold-start problem for a brand-new user with no interaction history? hard How would you design a system to detect and moderate harmful content at scale, balancing accuracy, cost, and user experience? medium What key considerations go into choosing between a monolithic ML pipeline and a microservices-based ML architecture? hard How would you design an experimentation platform to safely test many ML model variants simultaneously without experiments interfering? medium How would you design a system to keep a RAG-based chatbot's knowledge base up to date as source documents change frequently? hard What would you consider when designing an ML pipeline that must support both batch retraining and online/incremental learning? Retrieval-Augmented Generation & Vector Search easy What is RAG and when is it a better choice than fine-tuning? medium How do you choose a chunking strategy for a document corpus? medium Explain hybrid search and why pure vector search often underperforms. medium What does a reranker add on top of a vector store? hard How do you evaluate a RAG system beyond 'the answers look good'? medium What are HNSW and IVF, and how do they trade accuracy for speed? hard How do you stop a RAG system from answering confidently when retrieval fails? hard How would you handle multi-tenant data isolation in a vector database? AI Agents, Tools & Orchestration easy What separates an LLM agent from a plain LLM call? medium Explain the ReAct pattern. medium How do you design a good tool schema for function calling? hard How do you keep an agent from looping forever or burning budget? medium What memory types does an agent typically need? hard What is prompt injection in an agent setting and how do you defend against it? medium Single agent with many tools, or a multi-agent system? hard How do you evaluate an agent? Prompt Engineering & Context Design easy Why does few-shot prompting work? medium When does chain-of-thought help and when does it hurt? medium What is the 'lost in the middle' effect? medium How do you reliably get structured output from an LLM? hard What is self-consistency decoding? medium How does prompt caching change prompt design? medium What is the difference between temperature and top-p? hard How do you version and test prompts like code? Fine-Tuning & Model Optimization medium What is LoRA and why is it so widely used? medium Compare SFT, RLHF and DPO. medium What is quantization and what are the real trade-offs? hard What is knowledge distillation? hard What is catastrophic forgetting and how do you mitigate it? medium How much data do you need to fine-tune, and what does good data look like? hard Explain KV caching and why it matters for inference cost. hard What is speculative decoding? Multimodal, Diffusion & Generative Media medium How does a diffusion model actually generate an image? medium What is CLIP and why was it a turning point? medium What is classifier-free guidance? medium How do vision-language models feed images into an LLM? hard Why is high-resolution image understanding hard for VLMs? medium How do you evaluate generative image or video models? hard What is ControlNet and why is it useful in production? medium How do modern speech models handle transcription and generation? AI Safety, Alignment & Responsible AI easy Why do LLMs hallucinate? medium What is RLHF actually aligning, and what can go wrong? medium How do you measure and reduce bias in an AI system? hard What is red teaming for LLM applications? medium What does the EU AI Act mean for a typical AI product team? hard What is differential privacy and when does it belong in an ML pipeline? medium How do you build content moderation into an LLM feature? hard What is model interpretability and which techniques are practical today? Data Engineering for AI medium What is a feature store and what problem does it solve? hard What is data leakage and how does it hide in a pipeline? medium How do you detect data drift in production? medium How do you build a training dataset with labels you can trust? hard How would you deduplicate a large text corpus for pretraining? medium Batch versus streaming for ML pipelines — how do you choose? medium Why do embeddings need their own lifecycle management? hard How do you handle PII in AI training data? AI Career, Behavioural & Case Rounds easy How should you structure an answer to 'tell me about an ML project you shipped'? medium In an ML case round, how do you open a vague problem like 'improve our recommendations'? medium How do you answer 'your model is 95% accurate, is that good?' medium What does a strong AI engineer portfolio look like in 2026? medium How do you stand out when applying to remote-first AI companies? hard How do you answer 'how would you reduce our LLM feature's cost by 70%?' medium How do you disagree with a senior engineer about a modelling decision? medium What questions should you ask the interviewer at the end of an AI role interview?