Machine Learning Interview Questions: 2026 Round-by-Round Guide

|
28 min read
|
27 views
Machine Learning Interview Questions

The questions for machine learning interviews are asked to test three areas: the knowledge of basic algorithms, ability to write working code under time pressure, and ability to design a production-level machine learning system. The questions are structured by interviewers into rounds, not topics. Here, we have used the same approach. Below you will find seven rounds: concepts, data, evaluation, algorithms, deep learning/GenAI, MLOps, coding, and system design.

In each case below, you will find first the definition and after that the part that is expected from an interviewer. 

What Will I Learn?

What to Expect in a 2026 Machine Learning Interview

Machine learning interview generally consists of four to six rounds; these include recruiter screening, technical screening through phone, coding round, machine learning concept or design round, and lastly onsite round comprising multiple rounds of technical and behavioral interviews.

This list changes from company to company and from position to position. The data scientist position values statistics and experimentation more than coding. The ML engineer position values coding and system design more. The research scientist position values published papers and theoretical knowledge more.

There are three major shifts in the 2026 ML interview process:

  1. Questions related to GenAI and LLM are incorporated into the classical ML technical round, no longer just appearing in GenAI interviews. The ML engineer candidate for a general position must be prepared to solve at least one problem related to retrieval-augmented generation, fine-tuning, or LLM evaluation.
  2. Questions about safety and alignment of models emerge in the technical round of advanced AI labs. Now there are labs that are testing the reasoning ability of candidates about the possible misuses of models, data privacy issues, and high-risk output evaluation, along with traditional debugging problems.
  3. The system design round now includes topics related to GenAI systems such as inference batching, retrieval pipeline design, and evaluation frameworks for multiple ground truths, besides the classical recommendation and ranking system design.
Professional Certificate

Machine Learning Course

Learn supervised, unsupervised and ensemble ML techniques with Python — from model building to real-world deployment.

4.7 (5,874 ratings) • 13,510 already enrolled • Beginner level

Class Starts on 20 Sep, 2026 — SAT & SUN (Weekend Batch)

Average time: 5 month(s)

Skills you’ll build: Python, Scikit-learn, Supervised & Unsupervised Learning, Feature Engineering, Model Deployment, and more..

Find Your Track

Not every candidate needs every section below. Use the table to identify which sections apply to a specific role and experience level.

TrackPriority sectionsSkip or skim
New grad / entry-level ML engineerFundamentals, Data Handling, Core Algorithms, CodingSystem Design, Behavioral (light treatment only)
Mid-level ML engineerCore Algorithms, Model Evaluation, Deep Learning/GenAI, Coding, System Design
Senior / staff ML engineerSystem Design, MLOps, Deep Learning/GenAI, BehavioralBasic Fundamentals (review only)
Data scientistFundamentals, Model Evaluation, Core Algorithms, BehavioralDeep Learning (light treatment), Coding (SQL/stats focus instead)
GenAI / LLM engineerDeep Learning/GenAI, System Design, MLOpsClassic clustering and time-series sections

Machine Learning Fundamentals

1. What is the difference between artificial intelligence, machine learning, and deep learning?

Artificial intelligence refers to the development of algorithms that enable a computer to solve problems that a human being would otherwise solve using his/her intelligence. Machine learning refers to a branch of AI that involves the creation of models through data analysis, rather than hand coding. Deep learning refers to a subcategory of machine learning in which neural networks have many layers.

AI encompasses other branches such as rule-based systems, robotics, and search algorithms apart from machine learning. Machine learning encompasses techniques such as linear regression, decision trees, and support vector machines, all of which do not involve neural networks. Deep learning involves neural networks having many layers.

2. What is the difference between supervised, unsupervised, and reinforcement learning?

Supervised learning learns from labeled data. Unsupervised learning learns to find structure in unstructured or unlabeled data. Reinforcement learning involves training an agent based on rewarding desired behavior and/or punishing undesired behavior.

Learning typeData requiredExample task
SupervisedLabeled input-output pairsPredicting house prices from features
UnsupervisedUnlabeled dataGrouping customers by purchase behavior
ReinforcementReward signal from an environmentTraining a game-playing agent

Semi-supervised learning is the merging of a small amount of labeled data and a large amount of unlabeled data. Self-supervised learning creates labels by itself in the data, which is used for pretraining large language models.

3. What is the bias-variance tradeoff?

Bias-Variance trade-off is the interrelationship between two types of prediction errors: bias that arises from an overly simplistic model and variance that results from the model being overly dependent on the training dataset.

Total prediction error can be broken down as follows:

Total Error = Bias² + Variance + Irreducible Error

A model having large bias will underfit the data and generate low training accuracy and even lower testing accuracy. On the other hand, a model with high variance will overfit the training data and generate high training accuracy with low testing accuracy. Increasing model complexity reduces bias but increases variance. Increasing regularization reduces variance but increases bias. Cross-validation, appropriate model selection, and regularization techniques balance the two.

4. What is overfitting, and how can it be avoided?

When a model not only picks up on the true pattern in the training data but the noise as well, this leads to overfitting, where training accuracy is high and test accuracy is low.

There are five ways to minimize overfitting:

  1. Cross-validation. Use more than one fold in the data set for validation to ensure that the model can generalize well to any split.
  2. Regularization. Include an L1 or L2 regularization term in the loss function to prevent the coefficients from being too big.
  3. Early stopping. Stop the learning process when the validation accuracy does not increase anymore, even if the training accuracy is still improving.
  4. Dropout. In neural networks, randomly drop some neurons in every training iteration (Srivastava et al., 2014).
  5. Simplify the model. Employ fewer features, a shorter tree, or fewer parameters when a simple model can obtain similar validation accuracy.

5. What is underfitting?

Underfitting arises from the creation of a simple model which fails to capture the data’s inherent structure, hence generating poor results for the training and testing sets.

Underfitting can be solved by increasing model complexity, introducing new features, decreasing regularization or even by training for more time.

6. What is the difference between parametric and non-parametric models?

Parametric Model: A parametric model assumes a fixed functional form and a fixed number of parameters regardless of the amount of data present. Non-Parametric Model: Complexity of a non-parametric model increases with increase in the number of data points.

Example: Linear Regression & Logistic Regression are examples of Parametric Models because they assume a fixed number of coefficients. K-Nearest Neighbors & Decision Trees are examples of Non-Parametric Models because their complexity increases with more data.

Data Handling and Feature Engineering Questions

6. How should missing data be handled?

Missing data is handled through one of three approaches: removal, imputation, or flagging.

MethodWhen to use it
Row or column removalMissingness is rare or a column is missing more than 50% of its values
Mean, median, or mode imputationMissingness is random and the feature is numerical (mean or median) or categorical (mode)
Forward or backward fillThe data is a time series and adjacent values are informative
Model-based imputation (KNN, MICE)Missingness is not random and other features correlate with the missing feature
Missing-value flag columnMissingness itself might carry predictive information

Median imputation is preferred over mean imputation when the feature contains outliers, because the median is not sensitive to extreme values.

7. What is feature scaling, and why does it matter?

Feature scaling ensures that numerical features are mapped to a similar scale, ensuring that those with higher values do not have more influence on distance or gradient-based techniques.

There are two primary techniques:

  • Standardization transforms a feature to have a mean of 0 and a standard deviation of 1. Standardization is necessary for algorithms that assume normally distributed features, such as logistic regression, support vector machines, and principal component analysis.
  • Normalization scales a feature to a fixed interval, generally 0 to 1. Normalization is necessary for algorithms sensitive to distances, such as K-nearest neighbors and neural networks with sigmoid activation functions.

Tree-based algorithms, such as decision trees, random forest, and gradient boosting, do not require feature scaling since the splits are based on feature ranking, not feature magnitude.

8. What is the difference between label encoding and one-hot encoding?

In the case of label encoding, an individual integer is allocated to each class. With regard to one-hot encoding, a different binary attribute is assigned to each class.

The technique of label encoding is applied in cases when the classes possess a defined order, like “low,” “medium,” and “high.” On the other hand, one-hot encoding should be used when dealing with nominal data. Thus, there is no natural ordering of classes. Otherwise, it may create the ordinality in the data which should not exist there.

9. How should an imbalanced dataset be handled?

Class imbalance is solved using resampling, algorithm modifications, and metrics choice, since accuracy will be misleading if one class is over-represented in the dataset.

There are three types of resampling methods that solve the problem of class imbalance:

  • Random oversampling repeats examples of the minority class.
  • SMOTE (Synthetic Minority Oversampling Technique) creates synthetic examples for the minority class, based on interpolation between the minority class points and their nearest neighbors.
  • Random undersampling eliminates examples of the majority class.

The algorithm modifications consist of class weighting, where the classifier is penalized more for errors made in classifying the minority class, and threshold changing. The F1 score, precision, and recall are more informative metrics than accuracy.

10. What is the difference between feature selection and feature engineering?

Feature engineering involves creating new features from raw data. Feature selection is done by selecting the most relevant features out of an existing set of features and eliminating the rest.

Examples of feature engineering are obtaining “day of week” from a timestamp field and calculating the ratio of two numeric fields already present in the dataset. There are three types of feature selection techniques that are used: filter techniques where scoring is done independently on each feature based on some statistic like correlation or chi-square; wrapper techniques, for instance recursive feature elimination; and embedded techniques like lasso regression.

11. What are outliers, and how are they detected?

An outlier is a value that deviates from other values in a set because of measurement errors, data input errors, or unusual events.

There are two ways of detecting outliers:

  • An IQR outlier detection method identifies all values smaller than Q1 − 1.5 × IQR or larger than Q3 + 1.5 × IQR as outliers.
  • A Z-score outlier detection method identifies all values whose absolute Z-scores exceed 3 as outliers.

There are several options of dealing with outliers: deleting them if they are due to errors in data collection; using log or square root transformations to minimize the influence of outliers; setting them up to a certain percentile (winsorization); and using some models that are robust to outliers, for example, decision trees.

12. What is data leakage?

Data leakage takes place where data not available during the time of prediction is used in the model training phase, resulting in an artificially improved validation result which does not hold up in real-time scenarios.

Here are four typical causes of data leakage:

  • Target leakage. Where the feature is created in relation to or based on the target variable in a way that would be impossible in real-time scenarios, for instance, including “days since diagnosis” while making predictions about disease occurrence.
  • Train-test contamination. Preprocessing techniques such as scaling and imputation are performed on the entire dataset prior to the train-test split.
  • Temporal leakage. In case of time-series data, random splitting of the dataset rather than chronological splitting takes place.
  • Duplicate observations. The training and test datasets contain identical or nearly identical examples.

Data leakage can be avoided through the splitting data before performing any kind of preprocessing and using pipeline classes.

13. What is dimensionality reduction, and when is it used?

Dimensionality reduction helps in reducing the number of input features without losing much of the variance in the data. Dimensionality reduction helps in reducing the computational cost, avoiding overfitting and visualization of high dimensional data.

The widely-used linear dimensionality reduction technique is Principal Component Analysis (PCA) (Pearson, 1901). The process of PCA involves the calculation of eigenvectors of the feature covariance matrix and projection of data on the eigenvectors having highest values, i.e., principal components. A data set with 100 correlated features can easily be converted into 10-15 principal components with 90 percent retained variance.

The non-linear dimensionality reduction techniques that include t-SNE and UMAP are usually used for the purpose of visualization due to distortion of global distances for preserving local structure.

PCA beforeafter scatterplot showing variance retained per component

Model Evaluation and Metrics Questions

14. What is a confusion matrix?

A confusion matrix is a table that compares predicted classifications against actual classifications, reporting four outcomes: true positives, true negatives, false positives, and false negatives.

Predicted PositivePredicted Negative
Actual PositiveTrue Positive (TP)False Negative (FN)
Actual NegativeFalse Positive (FP)True Negative (TN)

Precision, recall, F1 score, and accuracy all derive from the four values in a confusion matrix.

15. What is the difference between precision and recall?

Precision measures how many of the predicted positives are correct, whereas recall measures how many of the actual positives are predicted correctly.

Precision = TP/(TP+FP) Recall = TP/(TP+FN)

The importance of precision is highest when a false positive comes at a great cost, for example, incorrectly predicting fraud. The importance of recall is greatest when a false negative comes at a great cost, for example, not detecting a disease. F1-score is the harmonic mean of precision and recall.

F1 = 2 × (Precision × Recall) / (Precision + Recall)

16. What is the ROC curve, and what does AUC measure?

The ROC curve charts the relationship between the true positive rate and the false positive rate over varying classification thresholds. The AUC, or the area under the ROC curve, is the measure of the probability that the classifier ranks a randomly picked positive sample higher than a randomly chosen negative sample.

If the AUC is equal to 1.0, it means that we have a perfect classifier. If the AUC is equal to 0.5, then we have the performance of a random guesser. Lastly, if the AUC is below 0.5, then it means that our classifier is worse than a random guesser.

17. What is cross-validation, and which method fits time-series data?

In cross validation, the data is divided into several folds, and the model is trained on some folds while validated on another fold. This procedure continues until all folds have been used for validation at least once.

MethodBest fit
k-fold cross-validationIndependent and identically distributed data
Stratified k-foldClassification tasks with class imbalance
Leave-one-out (LOO)Small datasets where every observation should be tested
Time-series (rolling or expanding window) splitSequential data where future values must not inform past predictions

Time series data cannot be validated using standard k-fold cross-validation as random folds can use data from the future to predict the past, and hence, the validation score becomes overly optimistic. Time series cross-validation, on the other hand, uses all the data prior to a certain point in time for training.

18. What is the difference between a Type I and a Type II error?

The first type of error, known as Type I error, refers to a situation where one rejects a true null hypothesis. The second type of error, known as Type II error, refers to a scenario where one fails to reject a false null hypothesis.

When applied to the screening of an individual to check whether he or she has a disease, Type I error will identify a healthy individual as suffering from the disease. On the other hand, Type II error will fail to recognize the presence of the disease in the individual suffering from it. The above two error types have a one-to-one correspondence with the confusion matrix, where Type I represents false positives, while Type II represents false negatives.

Core Algorithm Questions

19. How does linear regression work, and what are its assumptions?

Linear regression models predict a continuous target variable as a linear combination of the input features by minimizing the sum of squared differences between the predicted and true output values.

There are four key assumptions of linear regression:

  • Linearity: The association between the input features and the target should be linear.
  • Independence: Observations should be independent of each other.
  • Homoscedasticity: Variance of the residual is the same for all predicted values.
  • Normality of Residuals: Residuals should be normally distributed.

The fifth assumption of no multicollinearity ensures stable coefficient estimates.

20. How does logistic regression differ from linear regression?

The logistic regression algorithm estimates the probability of an outcome using the sigmoid function, whereas the linear regression algorithm predicts the numeric value itself.

The sigmoid function converts any real number into the range [0, 1]:

σ(z)=1/(1+e(z))σ(z) = 1 / (1 + e^(-z))

Notably, despite its name, the logistic regression algorithm is a classifier, not a regressor. The output probability is compared against the threshold, which is usually equal to 0.5.

21. How does a decision tree work?

In a decision tree, data is divided into branches on the basis of feature values; the choice of split is made in such a way that impurity is reduced as much as possible up to some stopping criterion.

Two measures of impurity are used for making splits:

  • Entropy is a measure of randomness of a data set. The entropy is 0 for a pure node when all examples are of the same class.
  • Gini impurity is a measure of probability of misclassification of a randomly chosen example if classification is done based on the class distribution in the node.

Decision trees overfit easily as they can be grown to any extent so that leaves contain only one example. Pruning removes branches that contribute little predictive value, using either pre-pruning, which stops tree growth early through constraints like maximum depth, or post-pruning, which grows the full tree and then removes low-value branches.

22. How does random forest improve on a single decision tree?

In a random forest, there is construction of many decision trees using random samples of the data and a random sample of the features, and prediction is made using voting for classification and averaging for regression.

The reduction of variance of a single decision tree takes place via two approaches in random forest:

  1. Bootstrap aggregating (or bagging). All trees are trained on a random sample of data selected by resampling (Breiman, 2001).
  2. Feature randomness. In each split, a random subset of the available features is used.

23. What is the difference between bagging and boosting?

Bagging works by training many models simultaneously on random subsets of data in order to lower the variance. On the other hand, boosting works through sequential training of many models where the later models compensate for the earlier models’ mistakes.

AttributeBaggingBoosting
Training orderParallelSequential
Primary goalReduce varianceReduce bias
Example algorithmRandom ForestXGBoost, AdaBoost
Overfitting riskLowerHigher without regularization

AdaBoost assigns higher weights to misclassified examples before training the next model (Freund & Schapire, 1997). XGBoost extends gradient boosting with regularization terms and parallelized tree construction (Chen & Guestrin, 2016).

24. How does K-nearest neighbors (KNN) work?

The k-nearest neighbor classifier uses the majority class among the K nearest data points to classify an unseen data point, where distance between two points can be defined using distance metrics such as Euclidean distance.

The k-nearest neighbor algorithm is referred to as a lazy learner because it has no training phase. The entire computation is done at the time of prediction. In this step, the distance between the query point and all the training points is calculated. A small value of K increases sensitivity to noise and overfitting risk. A large value of K smooths the decision boundary and increases underfitting risk. Cross-validation identifies the optimal K value for a given dataset.

25. How does a support vector machine (SVM) work?

The Support Vector Machine constructs the hyperplane which maximizes the margin, where the margin is the gap between the hyperplane and the nearest data points of each class, known as the support vectors (Cortes & Vapnik, 1995).

Handling of non-linearly separable data is carried out using a concept known as the kernel trick, whereby data points are mapped to a higher dimensional space where linear separation can be achieved. Some of the popular kernels include linear, polynomial, and radial basis function (RBF) kernels.

26. What is Naive Bayes, and why is it called “naive”?

The Naive Bayes algorithm is a classification algorithm that is built on the foundation of Bayes’ theorem but makes an unrealistic assumption that all features are independent of each other given the class label, hence the name.

According to Bayes’ theorem, the probability of the class given the set of features is given by:

P(class | features) = P(features | class) x P(class)/ P(features)

The algorithm still works well for text classification, such as spam filtering, despite the assumption of independence due to the fact that the ranking of the probabilities of classes is correct regardless of the independence assumption.

Professional Certificate

Machine Learning Course

Learn supervised, unsupervised and ensemble ML techniques with Python — from model building to real-world deployment.

4.7 (5,874 ratings) • 13,510 already enrolled • Beginner level

Class Starts on 20 Sep, 2026 — SAT & SUN (Weekend Batch)

Average time: 5 month(s)

Skills you’ll build: Python, Scikit-learn, Supervised & Unsupervised Learning, Feature Engineering, Model Deployment, and more..

27. What is K-means clustering, and how is the optimal number of clusters chosen?

The K-means algorithm groups data into K clusters by repeatedly assigning each observation to the nearest centroid and recomputing the centroid as the average of its observations until convergence (i.e., when there is no change in the centroids).

There are two techniques for finding the optimal K value:

  1. The elbow technique involves plotting WCSS versus K and picking the point where the decrease becomes much slower.
  2. The silhouette score evaluates how similar each observation is to its own cluster relative to other clusters; this score can range from -1 to 1, and the K value with the highest silhouette score is chosen.

28. What is hierarchical clustering, and how does it differ from K-means?

In hierarchical clustering, a tree structure called a dendrogram is formed by iteratively either grouping small clusters to form bigger clusters or dividing bigger clusters to form smaller ones. In K-means, the number of clusters needs to be specified beforehand, but in hierarchical clustering, that is not the case.

The method of agglomerative clustering, which is the bottom-up method, begins by treating each point as a separate cluster and then merges the two closest clusters at each iteration until only one cluster is left. On the other hand, the divisive clustering method, which is the top-down method, begins by having all data points belong to one single cluster, and at each iteration, the cluster is divided. Agglomerative clustering is far more common to use than divisive clustering since divisive clustering is much more computational.

29. What is regularization, and how do L1 and L2 differ?

Regularization adds a penalty term to a model’s loss function to discourage large coefficient values, which reduces overfitting and improves generalization to unseen data.

RegularizationPenalty termEffect
L1 (Lasso)Sum of absolute coefficient valuesCan shrink coefficients to exactly zero, performing feature selection
L2 (Ridge)Sum of squared coefficient valuesShrinks coefficients toward zero but rarely to exactly zero
Elastic NetCombination of L1 and L2Balances feature selection with coefficient stability, useful when features are correlated

L1 regularization is preferred when a dataset contains many irrelevant features and feature selection is a goal. L2 regularization is preferred when most features contribute some predictive value and coefficient stability matters more than sparsity.

Deep Learning, NLP, and GenAI Questions

30. What is a convolutional neural network (CNN), and what is it used for?

Convolutional neural network is an architecture for deep learning that works on grid-like structured data such as images using the convolutional layers to detect spatial attributes like edges and shapes.

The architecture of CNN has four kinds of layers as follows:

  1. Convolutional layers apply filters to the input to get feature maps.
  2. Pooling layers downsample the feature maps either by max pooling or average pooling.
  3. Activation layers apply a non-linear function, most commonly ReLU, after each convolution.
  4. Fully-connected layers aggregate the features and generate the classification or regression output.

31. What is a recurrent neural network (RNN)?

Recurrent neural networks refer to the class of neural networks whose design is suited for handling sequential data through maintaining a hidden state where information is carried forward from one step to another.

An RNN receives the elements in a sequence in batches of one element at a time, and updates the hidden state depending on the input element and the previous hidden state. Thus, an RNN is able to handle dependency between elements in the input sequence which are at different times (for example, in a sentence). Normal RNN networks are not suitable for sequences with many elements due to the vanishing gradient problem. LSTMs have been proposed for solving this problem through gated cells which control what to remember or forget at each step (Hochreiter & Schmidhuber, 1997).

32. What is the vanishing gradient problem?

Vanishing gradients occur due to very small gradients during backpropagation through layers in a neural network that results in slow or completely stopped updates in the early layers of the network.

Vanishing gradients are mainly due to the nature of the activation functions, including Sigmoid and Tanh activation functions, which squish the values over a wide range into a narrow output range. Vanishing gradients can be resolved by three ways; changing the activation function sigmoid or Tanh to ReLU, implementing batch normalization technique to ensure stability of the distribution of layer inputs (Ioffe & Szegedy, 2015), and implementing residual connections that let gradients pass through intermediate layers.

33. What is dropout, and how does it prevent overfitting?

Dropout refers to a form of regularization, whereby neurons are deactivated randomly at each step during the training process, thus allowing the network to learn from multiple representations rather than relying on a particular neuron (Srivastava et al., 2014).

It is common practice to use a dropout rate of 0.2 to 0.5 for hidden layers. Dropout does not apply when making predictions, but the rest of the weights are adjusted accordingly.

34. What is the difference between stemming and lemmatization?

Stemming is a process that strips off the suffix of a word following pre-defined rules in order to get the root form of the word. Lemmatization strips off the suffix of the word based on its dictionary form.

MethodExample inputOutputAccuracy
Stemming“running”“run”Lower — can produce non-words, such as “studi” from “studies”
Lemmatization“running”“run”Higher — always produces a valid dictionary word
Stemming“better”“better” (no rule matches)Fails to normalize irregular forms
Lemmatization“better”“good”Correctly identifies the base form using grammatical context

Stemming is faster and is applied whenever speed is more important than accuracy, for example during the process of indexing on a large scale. Lemmatization is applied whenever meaning is more important than speed, for example sentiment analysis.

35. What is tokenization?

Tokenization involves breaking up text into smaller tokens, which the model then takes as input for its processing, using either whole words, subwords, or individual characters as the token.

Subword tokenization, employed in almost all current large language models, is a technique in which the rare and unknown words are broken down into smaller known parts. This helps the model to process those words which it hasn’t even seen before. The two most common forms of subword tokenization are BPE and WordPiece.

36. What is a transformer architecture?

The transformer model is a type of neural network architecture which relies on self-attention rather than recurrence to process sequences, where attention is calculated for all the positions within a sequence to all other positions simultaneously (Vaswani et al., 2017).

Self-attention involves calculating a weighted representation of each token based on how relevant it is compared to all other tokens within the sequence, enabling transformers to detect long-distance dependencies better than RNNs. BERT (Devlin et al., 2019) uses a transformer encoder trained with a masked-language-modeling objective, which enables bidirectional context understanding.

37. What is retrieval-augmented generation (RAG), and when is it preferred over fine-tuning?

The process of retrieval-augmented generation consists of retrieving relevant documents from the external source of knowledge and making them available as context to the language model during inference without having to fine-tune the model’s parameters (Lewis et al., 2020).

AttributeRAGFine-tuning
Knowledge update methodUpdate the retrieval indexRetrain model weights
Update speedImmediateRequires a new training run
Best fitFrequently changing or proprietary knowledgeStable domain-specific style, tone, or task format
Hallucination riskLower, when retrieval quality is highHigher, if training data is insufficient
Compute costLower at deploymentHigher at deployment

It is better to use RAG when there is frequent change in the base of knowledge or when the model has to access proprietary information which should not be permanently integrated into the model weights. Fine tuning is recommended if the task needs a standardized output format or tone or particular pattern of reasoning.

38. What is an LLM context window, and how are tasks handled that exceed it?

The context window is the largest number of tokens that the large language model can handle in an input, which includes both the prompt and the output produced by it.

In a situation where the task at hand needs more context than is allowed by the model’s context window, there are three ways in which it can be addressed: summarizing the previous inputs to ensure that only the most critical parts are captured in a few tokens, retrieval-augmented generation whereby only the most critical parts of a long document are retrieved, or breaking the task into smaller steps.

39. What causes hallucination in large language models, and how is it mitigated?

A hallucination is the situation where a language model produces fluent but erroneous content without any factual basis, mainly due to the language model predicting statistically probable text rather than factual information.

Four possible ways of mitigating:

  1. Retrieval-augmented generation technique relies on retrieving content from the source documents.
  2. Low sampling temperature leads to less randomness, thus, the probability of producing low-probable but unfounded text decreases.
  3. The prompt or system design can have the requirement of citing a particular source for each piece of content.
  4. Human or automated fact-checking can be used to validate high-risk outputs before reaching the end-user.

MLOps and Production Questions

40. What is model drift, and how is it detected?

The definition of model drift implies a drop in model accuracy due to changes in either the distribution of incoming data or the relation between input variables and the target.

Two kinds of drift need different ways of identification:

  • In case of data drift, the distribution of input features has changed. Data drift is identified by analyzing feature distributions of the training dataset and production data in comparison using statistical tests like Kolmogorov-Smirnov test or population stability index.
  • Concept drift means that the relation between input and output features has changed, even if the distribution of input features remains constant. Concept drift can be detected by observing the prediction accuracy on the ground-truth labeled samples.

An example of concept drift is a spam detector which understands what spam is but spammers have changed their behavior and the distribution of input data has not significantly changed.

41. What is A/B testing in a machine learning context?

A/B testing is a method of comparing two versions of models or systems using random assignment of users to the different versions and evaluating the difference in a certain metric to see if it is statistically significant.

The A/B testing process of ML systems needs the definition of a primary metric that needs to be evaluated, a sample size sufficient to identify any effect size, and a predetermined testing period. Some of the mistakes made during such a testing procedure include peaking when the number of sample sizes required has not been attained and novelty effects that affect users’ performance because the system is new to them.

42. What is a feature store, and why is it used?

The feature store is a centralized system where features used by the machine learning models are stored, managed, and served both during training and inference stages while having the same feature computation logic for both cases.

In the absence of the feature store, organizations tend to compute the features in different ways when training and when serving them to production, a problem known as training-serving skew which negatively impacts the model quality in an unexplainable way.

43. What is the cold-start problem, and how is it addressed?

The cold-start problem arises in situations where the recommendation system does not have enough interaction information about the new user or new item to recommend to the user.

Cold-start typeSolution approach
New userUse onboarding questions, demographic data, or popularity-based defaults until interaction history accumulates
New itemUse content-based filtering, which recommends based on item attributes rather than interaction history
New platformCombine content-based filtering with manually curated recommendations until sufficient data accumulates

44. What triggers a model retraining pipeline?

A retraining pipeline is triggered by one of three signals: a scheduled interval, a performance-based threshold, or a detected drift signal.

Trigger typeDescriptionExample
ScheduledRetraining runs on a fixed calendar interval regardless of performanceWeekly retraining for a fast-moving recommendation system
Performance-basedRetraining runs when a live metric drops below a defined thresholdRetraining when click-through rate falls more than 10% below baseline
Drift-basedRetraining runs when a statistical drift test flags a significant distribution shiftRetraining when population stability index exceeds 0.25 on a key feature

Re-training pipelines normally incorporate all three types of triggers by having a schedule that determines the periodicity of re-training while incorporating a layer of performance and drift monitoring to help initiate a retrain when required. Re-training pipelines must also keep the old version of the model as well as provide for rollback of the new model when it performs poorly.

Professional Certificate

Machine Learning Course

Learn supervised, unsupervised and ensemble ML techniques with Python — from model building to real-world deployment.

4.7 (5,874 ratings) • 13,510 already enrolled • Beginner level

Class Starts on 20 Sep, 2026 — SAT & SUN (Weekend Batch)

Average time: 5 month(s)

Skills you’ll build: Python, Scikit-learn, Supervised & Unsupervised Learning, Feature Engineering, Model Deployment, and more..

ML Coding Questions

Machine learning coding rounds test three abilities: building a clean preprocessing pipeline, implementing a core algorithm from a specification, and evaluating a trained model correctly.

45. How is a dataset preprocessed for a machine learning task?

A preprocessing pipeline handles missing values, encodes categorical features, and scales numerical features before the train-test split.

import pandas as pd

from sklearn.impute import SimpleImputer

from sklearn.preprocessing import LabelEncoder, StandardScaler

from sklearn.model_selection import train_test_split

data = pd.read_csv("data.csv")

# Impute missing numerical values with the column mean

imputer = SimpleImputer(strategy="mean")

numerical_cols = data.select_dtypes(include="number").columns

data[numerical_cols] = imputer.fit_transform(data[numerical_cols])

# Encode categorical columns

categorical_cols = data.select_dtypes(include="object").columns

encoder = LabelEncoder()

for col in categorical_cols:

    data[col] = encoder.fit_transform(data[col])

# Scale numerical features

scaler = StandardScaler()

data[numerical_cols] = scaler.fit_transform(data[numerical_cols])

X = data.drop("target", axis=1)

y = data["target"]

X_train, X_test, y_train, y_test = train_test_split(

    X, y, test_size=0.2, random_state=42

)

46. How is a classification model evaluated on a held-out test set?

from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score

from sklearn.linear_model import LogisticRegression

model = LogisticRegression()

model.fit(X_train, y_train)

predictions = model.predict(X_test)

print("Accuracy:", accuracy_score(y_test, predictions))

print("Precision:", precision_score(y_test, predictions))

print("Recall:", recall_score(y_test, predictions))

print("F1 score:", f1_score(y_test, predictions))

47. How is K-means clustering implemented from scratch?

import numpy as np

class KMeans:

    def __init__(self, n_clusters, n_features):

        self.centroids = np.random.randn(n_clusters, n_features)

    def _distance(self, a, b):

        return np.sqrt(np.sum((a - b) ** 2))

    def fit(self, X, n_iterations=100):

        for _ in range(n_iterations):

            clusters = [[] for _ in self.centroids]

            for point in X:

                distances = [self._distance(point, c) for c in self.centroids]

                closest = np.argmin(distances)

                clusters[closest].append(point)

            for i, cluster in enumerate(clusters):

                if cluster:

                    self.centroids[i] = np.mean(cluster, axis=0)

    def predict(self, point):

        distances = [self._distance(point, c) for c in self.centroids]

        return np.argmin(distances)

ML System Design Questions

ML system design interviews require the candidate to design a full-fledged machine learning product including the collection of data, selection of models, training infrastructure, serving infrastructure, and monitoring in comparison to the coding interview where the candidate is required to write an implementation of a specific algorithm.

The following are the steps that should be taken while answering any ML system design problem:

  1. State the requirements. Mention the functional requirements and non-functional requirements (latency, scalability, availability) prior to providing the design solution.
  2. Identify the entities. List down the main entities the system will operate on, for example, User, Item, and Interaction in the case of a recommendation system.
  3. Provide the baseline and iterate. Propose a baseline solution using rule-based or heuristic solutions and provide the learned solution after that.
  4. Define evaluation metrics. State the offline and online metrics and discuss the relation between the two.

48. How would a recommendation system be designed?

Designing a solution for the recommendation system begins with several key questions: what product or service needs to be recommended, to whom it should be recommended, and the business goal behind that. Generally, the design starts with the creation of the popularity or rule-based recommendation algorithm to collect the necessary data and only after that moves on to the collaborative or hybrid recommendation model when enough data is available. The key metric (watch time or CTR), as well as secondary metrics (retention and diversity), are determined at this point.

49. How would an inference batching system be designed for a single GPU?

The inference batching architecture allows grouping individual requests from users into a single batch in order to achieve efficient utilization of parallel processing capabilities of GPUs with per request waiting time being in reasonable bounds. This architecture defines such parameters as maximum batch size, maximum waiting time prior to processing of incomplete batch, and mechanism of delivering individual responses to respective users after completion of the batch processing.

Behavioral Questions for Machine Learning Roles

The behavioral interview for machine learning positions is aimed at evaluating the candidate’s communication skills, experience of owning results of previous projects, and ability to explain technical decisions to people without technical background.

The answer to a behavioral question follows a structure consisting of three parts: situational context, actions, and result. 

Examples of typical questions on behavioral interviews for ML positions are questions asking you to tell you about a project with a very tight schedule, about a case when your model failed in production and how you found out about it, and about a situation when you had a disagreement with a stakeholder regarding the modeling technique. In each case, your answer needs to contain a concrete metric and a concrete decision.

50. What Changed in Machine Learning Interviews for 2026

There are three main ways in which machine learning interviews in 2026 differ structurally from previous years’ interviews. 

Integration of GenAI questions into interviews of classic ML engineers. Interviews of classic ML engineers not only include questions about supervised and unsupervised learning but also about the behavior of large language models, retrieval augmented generation, and LLM evaluation.

Reasoning about the cause of a problem over knowledge of an algorithm. Interviewers do not ask candidates to simply explain what an algorithm is anymore; instead, they may ask candidates to explain why some model stopped working in production, e.g., why a click-through rate model failed after a change in the behavior of users caused by seasons.

Questions about safety and evaluation in frontier AI labs. Some frontier labs have included technical interviews that contain not only debugging questions but also questions about misuse and alignment of the model as well as output evaluation where there is no single right answer. 

Frequently Asked Questions

Q1. What is a machine learning interview like?

Ans. A machine learning interview consists of a coding round, a conceptual round consisting of algorithms and statistics, and sometimes a system design round, along with several behavioral interviews.

Q2. Do machine learning interviews require coding?

Ans. Almost all machine learning engineering and research positions consist of at least one coding round, which includes testing one’s skills in Python, data wrangling, and implementation of a basic algorithm based on an algorithm described in words.

Q3. Is advanced mathematics required for a machine learning interview?

Ans. A machine learning interview usually includes practical mathematics, not proofing mathematics, such as probability, basic linear algebra, and knowledge of gradients and loss functions.

Q4. How is an ML system design interview different from an ML coding interview?

Ans. While in an ML system design interview a candidate has to design a full-fledged product, in an ML coding interview a candidate has to implement one specific algorithm/preprocessing task.

Q5. How should a candidate explain a past ML project during an interview?

Ans. The candidate needs to give a brief description of the problem statement, the dataset, the machine learning model chosen, the evaluation metric, the outcome, and the main issue faced in that order.

Q6. What is the difference between an ML engineer interview and a data scientist interview?

Ans. An ML engineer interview weighs coding and system design more heavily. A data scientist interview weighs statistics, experimentation design, and business communication more heavily. Both interview types share a common core of algorithm and evaluation-metric questions.

Conclusion

Machine learning interview preparation succeeds when study time maps to the actual round structure of the target role, not to an undifferentiated list of topics. A new-grad ML engineer candidate should prioritize fundamentals, data handling, core algorithms, and coding. A senior candidate should prioritize system design, MLOps, and the GenAI questions now appearing inside classic ML loops. Return to the track table above before each study session to confirm the current section matches the target role and level.

Gyansetu offers top professional training certification courses designed to enhance your skills and advance your career, providing industry-relevant knowledge and practical expertise.