Interview Prep — AI/ML Track

AI / ML Interview Questions

25+ AI/ML questions — transformers, backprop, loss functions, bias-variance, attention, and LLMs. Tagged for FAANG and ML-first companies.

ML BasicsDeep LearningNLP & LLMsMath & Theory
25+Total
8ML Basics
7Deep Learning
6NLP & LLMs
4Math
Progress saved locally. Check off questions — saves to your browser. No account needed.
0
/ 25 Done
01 Why is data visualization important before building AI models? Data
Visualization helps identify:
  • Patterns & trends — Understand how data behaves over time
  • Correlations — Find relationships between features
  • Outliers — Detect anomalies that could skew model training
  • Data distribution — Check for skewness, normality, class imbalance
Key insight: Even the best AI engineers always visualize data before training. It answers: What does the data look like? Are there missing patterns? Which features matter most? Is the dataset balanced?
02 What are the essential Matplotlib plots for AI/ML and when do you use them? Data
Essential plots:
  • Line plots — Show trends over time (e.g., loss curves during training)
  • Bar charts — Compare categorical data (e.g., class distribution)
  • Scatter plots — Analyze relationships between two variables
  • Histograms — Check data distribution, detect skewness
python
import matplotlib.pyplot as plt
x = [1,2,3,4]
y = [10,20,25,30]
plt.plot(x,y)
plt.show()
Why important for AI: Understand trends, analyze variable relationships, check data distribution before model selection.
03 What is Seaborn used for and how does it differ from Matplotlib? Data
Seaborn is built on top of Matplotlib for statistical visualizations with simpler syntax and better defaults.

Key Seaborn plots for AI:
  • Heatmaps — Correlation analysis between features
  • Boxplots — Outlier detection, distribution visualization
  • Pairplots — Scatter matrix for all feature combinations
  • Distribution plots — KDE plots, histograms with curves
python
import seaborn as sns
sns.heatmap(data.corr())
Why important for AI: Detect feature relationships, identify strong predictors, understand dataset patterns quickly.
04 What are the essential NumPy operations for AI/ML? Data
NumPy is the foundation for numerical computing in Python. Essential operations:
  • Arrays — 1D, 2D, 3D arrays for storing data
  • Shape & dimensions — Understand data structure (arr.shape, arr.ndim)
  • Indexing & slicing — Access subsets of data
  • Vectorized operations — Fast element-wise operations without loops
  • Matrix multiplication — Core of neural network computations
python
import numpy as np
arr = np.array([1,2,3])
print(arr * 2)  # [2 4 6] — vectorized
05 What are the essential Pandas operations for data manipulation? Data
Pandas is the primary tool for data manipulation in Python.

Essential operations:
  • Series & DataFrame — 1D and 2D data structures
  • Reading CSV filespd.read_csv("data.csv")
  • Filtering data — Select rows/columns based on conditions
  • GroupBy — Aggregate data by categories
  • Handling missing valuesdropna(), fillna()
  • Dropping duplicatesdf.drop_duplicates()
python
import pandas as pd
df = pd.read_csv("data.csv")
df = df.dropna()  # Remove missing values
Reality check: 70% of an AI engineer's time goes into data cleaning and preprocessing, not model building.
06 What does data cleaning involve and why is it critical for AI? Data
Data cleaning prepares raw data for model training. AI models are sensitive to noisy data and incorrect formats.

Key tasks:
  • Missing value handling — Impute or remove incomplete records
  • Outlier detection — Identify and handle extreme values
  • Data type correction — Ensure correct types (numeric, categorical, datetime)
  • Removing duplicates — Eliminate redundant records
Garbage in, garbage out: Even the best algorithms fail with dirty data. Cleaning is more important than model selection.
07 What is feature engineering and why is it called the "hidden superpower" of ML? Data
Feature engineering is creating new useful features from existing raw data.

Examples:
  • Convert date → year, month, day, day_of_week
  • Extract text length, word count from strings
  • Create interaction features (price × quantity = total)
  • Binning continuous variables into categories
Why it matters: Well-engineered features often improve model performance more than switching algorithms. Domain knowledge + creativity = better features.
08 What are the key data preprocessing steps before training ML models? Data
Preprocessing transforms cleaned data into model-ready format. ML models need numerical inputs and scaling improves performance.

Key steps:
  • Feature Scaling — Bring all features to similar ranges
  • Normalization — Scale to [0, 1] range (MinMaxScaler)
  • Standardization — Scale to mean=0, std=1 (StandardScaler)
  • Encoding — Convert categories to numbers (Label Encoding, One-Hot Encoding)
  • Train-Test Split — Separate data for training and evaluation
Rule: Always fit scalers on training data only, then transform test data — prevents data leakage.
01 Tell me about yourself (AI Engineer role) Behavioral
Sample Answer: "I have 3+ years building AI systems with Python, TensorFlow, and LLMs. Core skills: Deep learning, NLP, MLOps, and model deployment. Recently deployed RAG chatbots reducing support tickets by 40%. Passionate about production-ready AI solutions."
Tip: Keep it concise. Highlight: years of experience, key technologies, recent impactful project, and what drives you.
02 What is the difference between supervised, unsupervised, and reinforcement learning? AI/ML
  • Supervised Learning: Labelled data. Model learns input→output mapping. Examples: regression, classification (Linear Regression, SVM, Neural Networks).
  • Unsupervised Learning: Unlabelled data. Model finds patterns/structure. Examples: clustering (K-Means), dimensionality reduction (PCA), anomaly detection.
  • Reinforcement Learning: Agent learns by interacting with environment, receiving rewards/penalties. Examples: game playing (AlphaGo), robotics, recommendation systems.
  • Semi-supervised: Mix of labelled and unlabelled data.
  • Self-supervised: Model generates its own labels (e.g., GPT predicting next token).
03 What is the difference between Artificial Narrow Intelligence (ANI) and Artificial General Intelligence (AGI)? AI/ML
  • ANI (Narrow AI): Specialized systems designed for specific tasks. Examples: ChatGPT (text only), Siri, image classifiers, chess engines. Excels in one domain but cannot generalize.
  • AGI (General AI): Hypothetical human-level intelligence across all cognitive tasks. Can learn, reason, and apply knowledge to any domain. Does not exist yet.
Example: Siri (ANI) can set reminders but cannot learn to play a new game like a human could. AGI would adapt to any intellectual task.
04 What is overfitting and underfitting? How do you prevent them? AI/ML
Overfitting: Model memorises training data, performs poorly on unseen data (high variance).
Underfitting: Model too simple, fails to capture patterns (high bias).

Preventing overfitting:
  • Regularisation (L1/Lasso, L2/Ridge) — penalise large weights
  • Dropout (neural networks)
  • More training data / data augmentation
  • Early stopping
  • Cross-validation (k-fold)
  • Reduce model complexity (fewer layers/features)
Bias-Variance tradeoff: Increasing model complexity reduces bias but increases variance. Optimal is the sweet spot.
05 Explain gradient descent and its variants. AI/ML
Gradient Descent minimises a loss function by iteratively moving in the direction of steepest descent (negative gradient).
θ = θ − α × ∇L(θ) where α is the learning rate.
  • Batch GD: Uses entire dataset per update. Stable but slow for large data.
  • Stochastic GD (SGD): One sample per update. Fast, noisy convergence.
  • Mini-batch GD: Small batches (32-256). Best of both — most commonly used.
  • Adam: Adaptive learning rates + momentum. Most popular optimizer for deep learning.
  • RMSProp: Adapts learning rate per parameter. Good for RNNs.
06 What is the difference between precision, recall, F1 score, and accuracy? AI/ML
  • Accuracy: (TP+TN)/(Total). Misleading for imbalanced datasets.
  • Precision: TP/(TP+FP). Of all predicted positives, how many were correct? (Minimise false positives)
  • Recall (Sensitivity): TP/(TP+FN). Of all actual positives, how many did we catch? (Minimise false negatives)
  • F1 Score: 2 × (Precision × Recall)/(Precision + Recall). Harmonic mean — balanced metric when both matter.
When to use what: Medical diagnosis → prioritise Recall. Spam filter → prioritise Precision. General → use F1. Balanced data → Accuracy is fine.
07 Explain how a neural network works and what backpropagation is. AI/ML
A neural network is a sequence of layers: input → hidden layers → output. Each layer computes: output = activation(W × input + b) .

Forward pass: Data flows through the network, producing a prediction and computing loss.
Backpropagation: Compute gradients of loss w.r.t. every weight using the chain rule (calculus), propagating from output back to input.
Weight update: Gradient descent adjusts weights to reduce loss.
Common activations: ReLU (hidden layers), Sigmoid (binary output), Softmax (multi-class output), Tanh (normalised output).
08 What is a Convolutional Neural Network (CNN) and what is it used for? AI/ML
A CNN uses convolutional layers to automatically learn spatial features (edges, textures, patterns) from images without manual feature engineering.
  • Convolutional layer: Applies filters/kernels to detect features
  • Pooling layer: Reduces spatial dimensions (max pooling, average pooling)
  • Fully connected layer: Final classification/regression
Uses: Image classification, object detection, facial recognition, medical imaging.
09 What is the vanishing gradient problem and how do you fix it? AI/ML
In deep networks, gradients can become exponentially small during backpropagation, preventing early layers from learning.

Causes: Sigmoid/tanh activations, deep architectures, small learning rates.

Solutions:
  • Use ReLU activation (doesn't saturate for positive values)
  • Batch Normalization (normalizes inputs to each layer)
  • Residual connections (skip connections in ResNet)
  • Proper weight initialization (He/Xavier initialization)
  • Gradient clipping (for RNNs)
10 What is the difference between Batch Normalization and Layer Normalization? AI/ML
Aspect Batch Norm Layer Norm
Normalizes Across batch dimension Across feature dimension
Batch size Needs large batch Works with any batch
Use case CNNs RNNs, Transformers
Training vs Inference Different (uses running stats) Same
11 What are Transformers and why are they important? AI/ML
Transformers are a neural architecture using self-attention mechanisms for parallel sequence processing.
  • Key innovation: Self-attention allows each token to attend to all other tokens simultaneously.
  • Handles long-range dependencies better than RNNs/LSTMs — no gradient decay over distance.
  • Parallelizable — processes entire sequence at once, not sequentially.
Impact: Powers GPT, BERT, and all modern LLMs. Enabled the generative AI revolution.
12 What are word embeddings? Explain Word2Vec and GloVe. AI/ML
Word embeddings are dense vector representations of words that capture semantic meaning.

Word2Vec: Neural network-based. Two approaches:
  • CBOW — predicts word from context
  • Skip-gram — predicts context from word
GloVe: Global Vectors — uses matrix factorization on word co-occurrence statistics.
Key insight: "king" - "man" + "woman" ≈ "queen" — embeddings capture relationships.
13 Explain the Transformer architecture and why it's better than RNNs. AI/ML
Transformer uses self-attention mechanisms instead of recurrence.

Key components:
  • Self-attention — weighs importance of all words simultaneously
  • Multi-head attention — multiple attention subspaces
  • Position encoding — adds sequence order information
  • Feed-forward layers — per-position processing
Advantages over RNNs:
  • Parallelization (process all tokens at once)
  • Better long-range dependencies
  • Faster training
14 What is self-attention and how does it work? AI/ML
Self-attention computes weighted relationships between all words in a sequence.

Process:
  1. Create Query (Q), Key (K), Value (V) vectors for each word
  2. Compute attention scores: Q × K^T / √d_k
  3. Apply softmax to get weights
  4. Weighted sum: attention × V
python
# Scaled dot-product attention
attention = softmax(Q @ K.T / sqrt(d_k)) @ V
√d_k scaling prevents dot products from growing too large.
15 What is tokenization? Why does it matter? AI/ML
Tokenization is splitting text into tokens (words, subwords, or characters) before feeding to a model.
  • Impacts: Model input size, vocabulary size, context window efficiency.
  • BPE (Byte Pair Encoding): Used in GPT models — balances vocabulary size with OOV (out-of-vocabulary) handling.
  • WordPiece: Used in BERT — similar subword approach.
Example: "unhappy" → ["un", "happy"] — model can handle rare words by composing known subwords.
16 What is the difference between BERT and GPT? AI/ML
Aspect BERT GPT
Architecture Encoder-only Decoder-only
Attention Bidirectional Causal (masked)
Training Masked LM + NSP Next token prediction
Best for Classification, QA, NER Text generation
Company Google OpenAI
17 What is fine-tuning? Explain transfer learning in NLP. AI/ML
Transfer learning uses a pre-trained model and adapts it to a specific task.

Fine-tuning process:
  1. Start with pre-trained model (e.g., BERT, GPT)
  2. Add task-specific head (classification layer)
  3. Train on task-specific data with lower learning rate
Benefits:
  • Works with small datasets
  • Faster training than from scratch
  • Better performance on most tasks
18 What is RAG (Retrieval-Augmented Generation)? AI/ML
RAG combines a retrieval system with a generative LLM. Instead of relying solely on what the LLM memorised during training, it retrieves relevant documents at inference time and uses them as context.

Pipeline:
  • User query → embed → vector similarity search over document store
  • Top-k relevant chunks retrieved
  • Chunks + query → LLM → grounded answer
Benefits: Reduces hallucination, enables knowledge updates without retraining, cites sources. Used in enterprise Q&A, chatbots, search systems.
19 What is cross-validation and why is it important? AI/ML
Cross-validation evaluates model performance by training and testing on different data splits.

K-Fold Cross-Validation:
  1. Split data into K equal folds
  2. For each fold: train on K-1 folds, test on 1 fold
  3. Average results across all K iterations
Benefits:
  • More reliable performance estimate
  • Uses all data for both training and testing
  • Reduces variance in evaluation
Common choice: K=5 or K=10
20 What is the difference between fine-tuning and prompt engineering? AI/ML
  • Fine-tuning: Updates model weights with domain-specific data. Requires compute, training infrastructure, and labeled examples. Produces a new model variant.
  • Prompt Engineering: Crafts better inputs/instructions without any training. Zero cost, instant iteration. Works with frozen models.
When to use: Prompt engineering first (fast, cheap). Fine-tune when you need consistent domain behavior and have 1000s of examples.
21 How do you evaluate LLM performance? AI/ML
Metrics:
  • BLEU/ROUGE: Text similarity against reference outputs (translation, summarization).
  • BERTScore: Semantic similarity using embeddings, not exact match.
  • Human Evaluation: Rate helpfulness, accuracy, coherence (gold standard).
For RAG systems:
  • Answer relevance (does it address the query?)
  • Faithfulness (is it grounded in retrieved docs?)
  • Context precision (did retrieval find relevant docs?)
22 Walk through an AI project you've built Behavioral
Strong Answer: "Built RAG-based enterprise chatbot using LangChain + Pinecone. Indexed 10k+ docs, fine-tuned Llama2-7B, deployed on AWS SageMaker. Achieved 92% answer accuracy, reduced support costs 35%."
Structure: Problem → Tech Stack → Your Role → Measurable Impact. Keep it under 2 minutes.
23 What is quantization and why use it? AI/ML
Quantization reduces model precision (FP32 → INT8 or FP16) for faster inference and lower memory usage.
  • Benefits: 4x smaller model, 2-4x faster inference, runs on edge devices.
  • Tradeoff: Slight accuracy drop (typically 1-3%).
  • Types: Post-training quantization (easy), Quantization-aware training (better accuracy).
Use case: Essential for mobile/edge deployment and high-throughput serving.
24 What tools and frameworks have you used? AI/ML
Sample Answer:
  • Languages: Python, SQL
  • DL Frameworks: PyTorch, TensorFlow, Keras
  • NLP/LLMs: Hugging Face Transformers, LangChain, LlamaIndex
  • Vector DBs: Pinecone, FAISS, Chroma, Weaviate
  • Deployment: Docker, Kubernetes, AWS SageMaker, GCP Vertex AI
  • MLOps: MLflow, Weights & Biases, DVC
Tip: Mention 2-3 tools you've used deeply, not just names. Be ready for follow-ups.
25 How do you handle AI bias and fairness? AI/ML
Approaches:
  • Monitor metrics by demographic groups (age, gender, ethnicity)
  • Fairness constraints during model training
  • Diverse training data — audit dataset representation
  • Debiasing techniques — reweighting, adversarial debiasing
  • Regular audits in production — drift detection
Important: Fairness is not just technical — involves stakeholder input, domain experts, and continuous monitoring.
26 Tell me about a production AI challenge you solved Behavioral
Strong Answer: "LLM response latency >5s was unacceptable. Implemented model distillation (7B→3B) + quantization + caching. Reduced p95 latency from 5.2s to 800ms while maintaining 95% accuracy."
Structure: Problem (with metric) → Solution (specific techniques) → Result (quantified improvement). Shows you ship production AI.
Use this as a self-assessment guide — check off topic areas you can confidently explain before your interview.
AI FUNDAMENTALS
  • Difference between AI, ML, and DL
  • Rule-based vs learning-based systems
  • Symbolic AI vs Statistical AI
  • Turing Test, AI ethics & explainability
  • Weak AI vs Strong AI
DEEP LEARNING
  • Artificial Neural Networks
  • CNNs, RNNs, LSTMs
  • Activation functions (ReLU, Sigmoid, Softmax)
  • Backpropagation & gradient flow
  • Transfer Learning
  • Attention mechanisms & Transformers
NLP CONCEPTS
  • Tokenization, lemmatization, stopwords
  • Bag of Words, TF-IDF
  • Word embeddings (Word2Vec, GloVe, BERT)
  • Sequence-to-sequence models
  • Named Entity Recognition (NER)
COMPUTER VISION
  • Image classification & object detection
  • Convolutional layers & filters
  • YOLO, RCNN, OpenCV basics
REINFORCEMENT LEARNING
  • Agent, Environment, Reward
  • Markov Decision Processes
  • Q-learning vs Policy Gradient
MODEL OPTIMIZATION
  • Loss functions (MSE, Cross-Entropy)
  • Learning rate & schedulers
  • Overfitting in deep networks
  • Dropout, Batch Normalization
26 What is the difference between AI, Machine Learning, and Deep Learning? AI/ML
AI (Artificial Intelligence) is the broad field of making machines perform tasks that require human intelligence — reasoning, planning, language, perception.

Machine Learning (ML) is a subset of AI where machines learn from data rather than following explicit rules. Instead of programming every rule, you feed data and let the model find patterns.

Deep Learning (DL) is a subset of ML that uses neural networks with many layers to learn hierarchical representations. It excels at unstructured data — images, audio, text.
Analogy: AI is the goal (make machines smart). ML is a method to achieve it (learn from data). Deep Learning is a specific powerful technique within ML (layered neural nets).
Interview tip: Always follow up by explaining when to use each:
  • Rule-based AI → small, well-defined problems
  • Traditional ML → structured tabular data
  • Deep Learning → images, audio, text, sequences
27 What is the Turing Test and what are its limitations as a measure of AI intelligence? AI/ML
The Turing Test (Alan Turing, 1950) proposes that a machine is "intelligent" if a human evaluator cannot reliably distinguish its responses from a human's through natural language conversation.

How it works: A human judge chats with both a human and a machine. If the judge can't tell which is which more than 70% of the time, the machine passes.

Limitations:
  • Measures deception, not understanding — a machine can fool humans without any real comprehension
  • Language-centric — ignores vision, physical reasoning, emotional intelligence
  • Judge-dependent — naive evaluators are easier to fool
  • LLMs already pass it — yet nobody claims GPT-4 is "truly intelligent"
  • Chinese Room argument (Searle) — symbol manipulation ≠ understanding
Modern view: The AI community has moved beyond the Turing Test. Better benchmarks: MMLU, HumanEval, BIG-Bench — they test specific capabilities rather than human mimicry.
28 What is Weak AI vs Strong AI? Do any current systems qualify as Strong AI? AI/ML
Weak AI (Narrow AI) — systems designed and trained for a specific task. They cannot transfer knowledge outside their domain.
  • Examples: Chess engines, image classifiers, recommendation systems, ChatGPT
  • Current reality: All deployed AI is Weak AI
Strong AI (AGI — Artificial General Intelligence) — hypothetical systems with human-level reasoning across all domains. Can transfer knowledge, reason abstractly, learn new tasks without retraining.
  • No system today qualifies as Strong AI
  • LLMs seem general but fail at consistent reasoning, grounding, and self-directed learning
Interview angle: Interviewers often ask this to probe AI literacy. Key answer — all current AI is narrow, even GPT-4. AGI is still an open research problem, with no consensus on timeline or definition.