Senior interviewers probe performance tuning, concurrency, distributed systems, and real-world edge cases:
Q16. How does Gradient Boosting work mathematically compared to AdaBoost?
Experienced • 3-5+ Yrs
AdaBoost iteratively increases the weights of misclassified observations. Gradient Boosting formulates boosting as a numerical optimization problem: each subsequent decision tree is trained directly on the pseudo-residuals (negative gradient of the loss function, e.g., MSE or log-loss) of the previous ensemble's predictions.
Q17. What optimizations make XGBoost significantly faster and more accurate than standard GBM?
Experienced • 3-5+ Yrs
XGBoost incorporates: 1. Second-order Taylor expansion of the loss function (gradient and hessian); 2. Explicit L1/L2 regularization on leaf weights; 3. Weighted Quantile Sketch for finding optimal split candidates; 4. Sparsity-aware split finding for handling missing values; 5. Column block structure for parallel processing.
Q18. Explain the Self-Attention mechanism in Transformer architectures.
Experienced • 3-5+ Yrs
Self-attention allows the model to weigh the importance of all tokens in an input sequence relative to a target token: Attention(Q, K, V) = softmax((Q * K^T) / sqrt(d_k)) * V. Query (Q) vectors dot-product with Key (K) vectors to generate attention scores, scaled by sqrt(d_k) to prevent vanishing gradients, passed through softmax, and multiplied by Value (V) vectors.
Q19. What is the difference between Word2Vec, BERT, and GPT architectures?
Experienced • 3-5+ Yrs
Word2Vec produces static word embeddings without context. BERT (Bidirectional Encoder Representations from Transformers) is an auto-encoding model trained with Masked Language Modeling (MLM) looking bidirectionally, ideal for classification and NER. GPT (Generative Pre-trained Transformer) is an auto-regressive decoder-only model predicting the next token.
Q20. Explain the vanishing and exploding gradient problem in Deep Neural Networks.
Experienced • 3-5+ Yrs
During backpropagation, gradients are propagated backwards via the chain rule. If derivative activations are < 1 (e.g., sigmoid/tanh), gradients shrink exponentially toward 0 in early layers (vanishing gradient, preventing learning). If derivatives are > 1, gradients explode toward infinity. Solutions include ReLU activations, Batch Normalization, and Residual skip connections.
Q21. What is Batch Normalization and why does it accelerate training?
Experienced • 3-5+ Yrs
Batch Normalization normalizes the layer inputs across a mini-batch to have zero mean and unit variance, then scales and shifts via learnable parameters (gamma, beta). It mitigates internal covariate shift, stabilizes gradient propagation, acts as a mild regularizer, and enables higher learning rates.
Q22. Explain the difference between Generative Adversarial Networks (GANs) and Diffusion Models.
Experienced • 3-5+ Yrs
GANs pit two networks against each other: a Generator creating synthetic samples and a Discriminator evaluating real vs fake. Diffusion models add Gaussian noise to training data over T steps (forward process) and train a neural network (U-Net) to reverse the process step-by-step, generating higher-fidelity and more stable images without mode collapse.
Q23. How does Transfer Learning work in NLP and Computer Vision?
Experienced • 3-5+ Yrs
Transfer Learning takes a deep neural network pre-trained on massive datasets (e.g., ImageNet or Common Crawl) and adapts it to a specific downstream task by either freezing base feature extraction layers and training a new classification head, or fine-tuning the entire network with low learning rates.
Q24. Explain LoRA (Low-Rank Adaptation) for fine-tuning Large Language Models.
Experienced • 3-5+ Yrs
LoRA freezes the pre-trained model weights W_0 (d x k) and injects trainable rank decomposition matrices A (r x k) and B (d x r), where rank r << min(d, k): W = W_0 + B*A. This reduces trainable parameters by 99% and GPU VRAM requirements during LLM fine-tuning without inference latency overhead.
Q25. How do you detect and mitigate Data Drift and Concept Drift in production ML systems?
Experienced • 3-5+ Yrs
Data Drift (Covariate Shift): Input distribution P(X) changes while P(Y|X) remains constant (detected via Kolmogorov-Smirnov test or Population Stability Index PSI). Concept Drift: Relationship between inputs and targets P(Y|X) changes over time. Mitigate by setting automated retraining pipelines triggered by drift thresholds.
Q26. What is the difference between Precision-Recall AUC (PR-AUC) and ROC-AUC?
Experienced • 3-5+ Yrs
ROC-AUC evaluates True Positive Rate vs False Positive Rate; when the negative class is massive (e.g., fraud detection where 99.9% are non-fraud), FPR remains artificially tiny, giving an overly optimistic score. PR-AUC focuses exclusively on the positive class without being diluted by true negatives.
Q27. Explain Support Vector Machines (SVM) and the Kernel Trick.
Experienced • 3-5+ Yrs
SVM finds the optimal hyperplane that maximizes the geometric margin between classes. When data is non-linearly separable in original feature space, the Kernel Trick (e.g., RBF, Polynomial) computes the inner products of points in a transformed higher-dimensional space without explicitly mapping them, enabling linear separation.
Q28. How does Dropout prevent overfitting in deep neural networks?
Experienced • 3-5+ Yrs
During training, Dropout randomly deactivates a fraction (p) of neurons and their connections at each iteration. This prevents complex co-adaptations between neurons, forcing the network to learn robust, distributed representations across multiple independent feature detectors.
Q29. Explain the difference between Cosine Similarity and Euclidean Distance in vector embeddings.
Experienced • 3-5+ Yrs
Euclidean distance measures the geometric straight-line distance between two points (sensitive to vector magnitude). Cosine similarity measures the cosine of the angle between two vectors: (A Β· B) / (||A|| ||B||), ranging from -1 to 1, evaluating directional alignment regardless of vector length.
Q30. What is Retrieval-Augmented Generation (RAG) and how does it prevent LLM hallucination?
Experienced • 3-5+ Yrs
RAG supplements LLM prompts with verified external context. User queries are converted into embeddings, matched against a Vector Database (Pinecone, Milvus) using similarity search, and relevant document chunks are injected into the LLM system prompt, grounding the generation in verifiable facts.