Machine Learning Engineer · interview questions
Machine Learning Engineer interview questions
From the role's core and recommended topics, most asked first. Filter by the kind of answer the question wants.
Machine Learning Fundamentals Core 26
- Most asked What is the difference between supervised, unsupervised and reinforcement learning?
- Most asked Explain the bias-variance trade-off.
- Most asked What is overfitting, and how do you prevent it?
- Most asked How do you split data for training, validation and testing, and what is cross-validation?
- Most asked Which metrics would you use for a classification model, and when is accuracy misleading?
- Most asked Compare decision trees, random forests and gradient boosting.
- Most asked Your model scored well offline but performs badly in production. What do you check?
- Most asked Design a system that serves predictions from a trained model to a web application.
- Most asked Write scikit-learn code that trains and evaluates a classifier without leaking preprocessing.
- What is data leakage, and how do you detect it?
- How do you handle imbalanced classes?
- Explain gradient descent and the role of the learning rate.
- What is regularisation, and how do L1 and L2 differ?
- How do you approach feature engineering for a tabular model?
- What is the difference between parameters and hyperparameters, and how do you tune hyperparameters?
- What are data drift and concept drift, and how do you monitor for them?
- What is the difference between bagging and boosting?
- How does k-means clustering work, and how do you choose k?
- What is dimensionality reduction, and when would you use PCA?
- Explain how a neural network learns with backpropagation.
- When would you choose a simple model over a deep learning model?
- How do you explain a model's predictions to stakeholders?
- How would you design an A/B test to decide whether a new model should replace the old one?
- What is MLOps, and what does a production ML pipeline include?
- How do you check a model for unfair bias?
- What is the difference between online and batch inference, and how do you choose?
scikit-learn Core 5
- Most asked How do scikit-learn Pipelines and ColumnTransformer work, and why use them?
- What do fit, transform, fit_transform and predict do in scikit-learn?
- How do you tune hyperparameters with GridSearchCV or RandomizedSearchCV?
- How do you handle categorical features in scikit-learn?
- Your scikit-learn model's cross-validation score varies a lot between folds. What does it mean, and what do you do?
pandas Core 6
- What is the difference between loc and iloc in pandas, and what is the SettingWithCopyWarning?
- How do you handle missing data in pandas?
- Explain groupby in pandas: split-apply-combine, agg, transform and filter.
- A pandas script runs out of memory or takes too long on a large file. How do you fix it?
- Write pandas code that finds each customer's latest order and their 30-day rolling spend.
- When would you use merge, join or concat in pandas?
Fine-tuning Core 22
- Most asked Fine-tuning leaf: Fine-tune vs RAG vs prompts-decision framework?
- Most asked Fine-tuning leaf: What is LoRA?
- Most asked Fine-tuning leaf: When does fine-tuning fail to add knowledge?
- Most asked Fine-tuning leaf: SFT vs DPO/RLHF briefly?
- Fine-tuning leaf: How do you build a fine-tune dataset?
- Fine-tuning leaf: How do you evaluate a fine-tuned model?
- Fine-tuning leaf: How do you prevent training data leakage of secrets?
- Fine-tuning leaf: What is QLoRA?
- Fine-tuning leaf: Catastrophic forgetting-how to mitigate?
- Fine-tuning leaf: Serving multiple LoRA adapters?
- Fine-tuning leaf: Full fine-tune vs PEFT cost tradeoffs?
- Fine-tuning leaf: Domain adaptation for code assistants?
- Fine-tuning leaf: What is overfitting in instruction tuning?
- Fine-tuning leaf: License/compliance checks before FT?
- Fine-tuning leaf: How do you roll back a bad adapter?
- Fine-tuning leaf: Distillation use case?
- Fine-tuning leaf: Hyperparameters that matter most?
- Fine-tuning leaf: Continual fine-tuning strategy?
- Fine-tuning leaf: Hardware considerations?
- Fine-tuning leaf: Synthetic data-pros/cons?
- When should you fine-tune a model versus using RAG or prompt engineering?
- What is LoRA/PEFT and why is it popular for adapting LLMs?
Evaluation Core 40
- Most asked Evaluation leaf: What is a golden dataset?
- Most asked Evaluation leaf: Pros/cons of LLM-as-judge?
- Most asked Evaluation leaf: What is faithfulness/groundedness?
- Most asked How do you build an evaluation set for an LLM feature?
- Most asked When do you use code graders, model graders or human graders?
- Most asked How do you decide whether a prompt change is an improvement?
- Most asked What guardrails would you put around an LLM feature?
- Most asked How would you build an evaluation pipeline for an LLM feature before and after each prompt or model change?
- Most asked Evaluation leaf: Offline vs online evaluation tradeoffs?
- Evaluation leaf: Why separate retrieval metrics from generation metrics?
- Evaluation leaf: Online metrics that matter?
- Evaluation leaf: Red teaming for LLM apps?
- Evaluation leaf: How do you detect regressions after a prompt change?
- Evaluation leaf: How do you evaluate agents?
- Evaluation leaf: How do you sample production traffic for review?
- Evaluation leaf: What is answer relevance?
- Evaluation leaf: How do you evaluate citation quality?
- Evaluation leaf: How do toxicity/safety classifiers fit?
- Evaluation leaf: What is calibration of confidence?
- Evaluation leaf: CI gate example for RAG PRs?
- What biases do LLM judges have, and how do you mitigate them?
- How do you monitor LLM quality in production?
- How do you roll out a prompt or model change safely?
- Why is model output untrusted input, and what does that mean in practice?
- How do you handle personal data in LLM features?
- How would you red-team an LLM feature?
- Evaluation leaf: Inter-annotator agreement-why care?
- Evaluation leaf: Statistical significance in A/B for LLM features?
- Evaluation leaf: Synthetic eval data-when OK?
- Evaluation leaf: Tracking eval debt?
- Evaluation leaf: Multimodal eval challenges?
- How do you balance safety filtering against over-refusal?
- How do you handle non-determinism in LLM evaluations?
- What is faithfulness, and how is it different from correctness?
- How do you write a good rubric for a model grader?
- A safety eval passes at 99%. Is the feature safe to launch?
- What metrics would you track for an LLM support assistant?
- How do you evaluate an LLM feature before you have real traffic?
- How would you evaluate a production RAG or agent system beyond 'it looks good'?
- What guardrails would you put around an LLM-powered customer-facing feature?
Python Developer Recommended 104
- Most asked Explain mutable vs immutable in Python.
- Most asked Explain is vs == in Python.
- Most asked Explain generators in Python.
- Most asked Explain decorators in Python.
- Most asked Explain context managers in Python.
- Most asked Explain GIL in Python.
- Most asked Explain threading vs multiprocessing vs asyncio in Python.
- Most asked Backend Python interview: explain N+1 queries.
- Most asked Backend Python interview: explain authN vs authZ.
- Most asked Backend Python interview: explain SQL injection prevention.
- Most asked What is the late-binding closure gotcha in Python?
- Most asked Explain LEGB scoping in Python.
- Most asked Explain *args and **kwargs in Python.
- Most asked Explain list/dict/set comprehensions in Python.
- Most asked Explain dataclasses in Python.
- Most asked Explain dunder methods in Python.
- Most asked Explain deepcopy vs copy in Python.
- Most asked Explain structural pattern matching (`match`/`case`).
- Most asked What do EAFP and LBYL mean, and which is more Pythonic?
- Most asked Walk through the request/response lifecycle in Django, and explain why middleware order matters.
- Most asked Explain MRO / C3 in Python.
- Explain __name__ == '__main__' in Python.
- When do you use the `asyncio` module/package?
- When do you use the `logging` module/package?
- When do you use the `unittest / pytest` module/package?
- When do you use the `venv` module/package?
- Python packaging: virtualenv why?
- Backend Python interview: explain REST API design.
- Backend Python interview: explain migrations.
- How does asyncio work internally: event loop, coroutines, tasks and futures?
- Which pytest features do you use most?
- Explain typing / type hints in Python.
- Explain exceptions hierarchy in Python.
- When do you use the `pathlib` module/package?
- When do you use the `collections` module/package?
- When do you use the `itertools` module/package?
- When do you use the `functools` module/package?
- When do you use the `json` module/package?
- When do you use the `concurrent.futures` module/package?
- When do you use the `secrets` module/package?
- Python packaging: requirements.txt vs pyproject.toml?
- Python packaging: dependency pinning?
- Backend Python interview: explain FastAPI / Starlette.
- Backend Python interview: explain Django ORM vs SQLAlchemy.
- Backend Python interview: explain connection pooling.
- Backend Python interview: explain caching strategies.
- Backend Python interview: explain JWT pitfalls.
- Backend Python interview: explain idempotent APIs.
- Backend Python interview: explain background jobs.
- Backend Python interview: explain observability.
- Backend Python interview: explain 12-factor config.
- What is free-threaded Python (PEP 703) and how does it change the GIL story?
- How do cancellation and timeouts work in asyncio?
- What are exception groups and `except*` (Python 3.11)?
- What does the Python 3.12 generic syntax (PEP 695) look like, and how do `TypeVar`, `ParamSpec` and `Self` fit in?
- When do you use `TypedDict`, `Literal`, `Protocol` and `@overload`?
- Compare dataclasses, attrs and Pydantic models.
- Explain the iterator protocol and the difference between iterables and iterators.
- What are metaclasses, and when is `__init_subclass__` a simpler alternative?
- What's the difference between `__new__` and `__init__`?
- How does CPython manage memory?
- How do you profile and optimize Python code?
- What does a modern Python toolchain look like?
- What's the difference between `str` and `bytes`, and how do you handle encodings?
- Why is `pickle` dangerous, and what should you use instead?
- What is the walrus operator (`:=`) and when is it useful?
- What is the difference between WSGI and ASGI, and how does it affect how a Python web app handles concurrent requests?
- Explain slots in Python.
- Explain ABC / Protocol in Python.
- Explain property / descriptor in Python.
- When do you use the `argparse` module/package?
- When do you use the `dataclasses.asdict` module/package?
- When do you use the `enum` module/package?
- When do you use the `hashlib` module/package?
- Python packaging: semantic versioning?
- Python packaging: wheels vs sdist?
- Python packaging: editable installs?
- Python packaging: entry points / scripts?
- Backend Python interview: explain rate limiting.
- How do you mock correctly in Python tests?
- How do you handle dates and time zones correctly in Python?
- Why can floating-point math surprise you, and when should you use `Decimal` or `Fraction`?
- How do `functools.cache`, `lru_cache` and `cached_property` work, and what are the pitfalls?
- How do you run external commands safely with `subprocess`?
- What notable improvements came in Python 3.11 through 3.14?
- What are template strings (t-strings) in Python 3.14?
- How did annotation evaluation change in Python 3.14?
- How do sorting, `heapq` and `bisect` help with common algorithmic tasks?
- What are weak references in Python and when do you use them?
- Which `contextlib` utilities are worth knowing?
- How do classic design patterns look in idiomatic Python?
- What are the pitfalls of `multiprocessing`?
- How do descriptors power properties, methods and ORMs?
- How do you implement structured logging in Python services?
- What are common security pitfalls in Python applications?
- What do `send()`, `throw()`, `close()` and `yield from` do with generators?
- Compare f-strings, `str.format` and `%` formatting.
- Which built-ins make Python loops cleaner?
- What goes into a modern `pyproject.toml`?
- How do Django, Flask and FastAPI compare for a new backend project?
- What are subinterpreters in Python 3.14?
- Python packaging: namespace packages?
- What is the difference between a list and a tuple in Python?
- How does Python's garbage collection work?
Data Structures Recommended 99
- Most asked Explain a list and its typical time complexities.
- Most asked Explain a dict and its typical time complexities.
- Most asked Explain a set and its typical time complexities.
- Most asked Explain a hash table and its typical time complexities.
- Most asked Describe BFS and when you would use it.
- Most asked Describe DFS and when you would use it.
- Most asked Describe binary search and when you would use it.
- Most asked Describe two pointers and when you would use it.
- Most asked Describe sliding window and when you would use it.
- Most asked Describe dynamic programming and when you would use it.
- Most asked Describe LRU cache design and when you would use it.
- Most asked Explain a deque and its typical time complexities.
- Most asked Explain a heapq / priority queue and its typical time complexities.
- Most asked How would you approach the classic problem 'two-sum'?
- Most asked How would you approach the classic problem 'merge intervals'?
- Most asked How would you approach the classic problem 'group anagrams'?
- Most asked How would you approach the classic problem 'valid parentheses'?
- Most asked How would you approach the classic problem 'binary tree level order'?
- Most asked How would you approach the classic problem 'longest substring without repeating'?
- Most asked How would you approach the classic problem 'number of islands'?
- Most asked How would you approach the classic problem 'kth largest element'?
- Most asked How would you approach the classic problem 'top k frequent'?
- Explain a tuple and its typical time complexities.
- Explain a BST and its typical time complexities.
- Explain a graph (adjacency list) and its typical time complexities.
- What is Big-O?
- Why is dict get O(1) average?
- In Python DSA interviews, explain: list vs deque for queue.
- Explain a stack and its typical time complexities.
- Explain a queue and its typical time complexities.
- Explain a linked list and its typical time complexities.
- Explain a binary tree and its typical time complexities.
- Explain a trie and its typical time complexities.
- Explain a union-find (DSU) and its typical time complexities.
- Describe prefix sums and when you would use it.
- Describe sorting: quicksort and when you would use it.
- Describe sorting: mergesort and when you would use it.
- Describe Dijkstra and when you would use it.
- Describe topological sort and when you would use it.
- Describe greedy algorithms and when you would use it.
- Describe backtracking and when you would use it.
- Describe Kadane's algorithm and when you would use it.
- Describe detect cycle in linked list and when you would use it.
- Big-Ω vs Big-Θ?
- Amortized analysis?
- Time vs space tradeoff?
- Best/average/worst case?
- In Python DSA interviews, explain: __hash__ and __eq__.
- In Python DSA interviews, explain: generators and memory.
- How would you approach the classic problem 'invert binary tree'?
- How would you approach the classic problem 'course schedule'?
- How would you approach the classic problem 'coin change'?
- How would you approach the classic problem 'product except self'?
- How would you approach the classic problem 'clone graph'?
- How would you approach the classic problem 'trapping rain water'?
- How would you approach the classic problem 'serialize/deserialize tree'?
- How would you approach the classic problem 'implement trie'?
- How would you approach the classic problem 'search rotated array'?
- How would you approach the classic problem 'meeting rooms'?
- How would you approach the classic problem 'palindrome linked list'?
- How would you approach the classic problem 'spiral matrix'?
- How would you approach the classic problem 'house robber'?
- How would you approach the classic problem 'unique paths'?
- How would you approach the classic problem 'minimum window substring'?
- How would you approach the classic problem 'daily temperatures'?
- How would you approach the classic problem 'asteroid collision'?
- How would you approach the classic problem 'flatten nested list'?
- Explain a frozenset and its typical time complexities.
- Explain a AVL / red-black tree and its typical time complexities.
- Explain a graph (adjacency matrix) and its typical time complexities.
- Explain a bloom filter and its typical time complexities.
- Explain a segment tree and its typical time complexities.
- Describe sorting: heapsort and when you would use it.
- Describe Bellman-Ford and when you would use it.
- Describe KMP / string matching and when you would use it.
- Describe serialize binary tree and when you would use it.
- Stable vs unstable sort?
- In-place algorithm?
- In Python DSA interviews, explain: dict insertion order.
- In Python DSA interviews, explain: list comprehension cost.
- In Python DSA interviews, explain: bisect module.
- In Python DSA interviews, explain: array vs list.
- In Python DSA interviews, explain: setdefault / Counter.
- How would you approach the classic problem 'lowest common ancestor'?
- How would you approach the classic problem 'word break'?
- How would you approach the classic problem 'merge k sorted lists'?
- How would you approach the classic problem 'median of two sorted arrays'?
- How would you approach the classic problem 'design hit counter'?
- How would you approach the classic problem 'find peak element'?
- How would you approach the classic problem 'alien dictionary'?
- How would you approach the classic problem 'add two numbers'?
- How would you approach the classic problem 'rotate image'?
- How would you approach the classic problem 'jump game'?
- How would you approach the classic problem 'edit distance'?
- How would you approach the classic problem 'sliding window maximum'?
- How would you approach the classic problem 'next greater element'?
- How would you approach the classic problem 'decode string'?
- What is the difference between a list and a tuple in Python?
- Explain the time complexity of common dictionary operations in Python.
Algorithms Recommended 70
- Most asked What does Big-O describe in interviews?
- Most asked Explain the sliding window pattern.
- Most asked Two Sum in O(n) average time—how?
- Most asked How do you merge overlapping intervals?
- Most asked Detect a cycle in a linked list—how?
- Most asked Reverse a singly linked list iteratively.
- Most asked How do you get Top K elements efficiently?
- Most asked How do you validate a binary search tree?
- Most asked How does Dijkstra work at a high level?
- Most asked Topological sort—requirements and uses?
- Most asked What is Union-Find used for?
- Most asked What two properties justify DP?
- Most asked Memoization vs tabulation?
- Most asked Name five high-frequency coding patterns.
- Most asked LRU cache—data structures?
- Most asked BFS vs DFS on trees—when each?
- What is amortized analysis? Give an example.
- Explain average-case vs worst-case for hash tables.
- How do you report complexity of BFS/DFS?
- When does binary search apply beyond sorted arrays?
- Linked list vs array tradeoffs?
- BFS uses which structure and why?
- Min-heap operations complexity?
- Inorder traversal of a BST yields what?
- Lowest common ancestor in a binary tree (not BST)?
- Balanced BST vs skewed BST complexity?
- Adjacency list vs matrix?
- When is BFS preferred for shortest path?
- Detect a cycle in a directed graph?
- 0/1 knapsack vs unbounded knapsack difference?
- Greedy vs DP—how do you choose?
- How should you start a coding interview problem?
- Difference between Big-O, Big-Theta, and Big-Omega?
- Does recursion use extra space?
- When is O(n log n) preferable to O(n²)?
- How do prefix sums help?
- Why is list.pop(0) slow in Python?
- What is an in-place algorithm?
- Kadane's algorithm solves what?
- Why use a dummy head node?
- Find the middle of a linked list in one pass.
- Merge two sorted linked lists—approach?
- When is a stack the right tool?
- What is a monotonic stack?
- Implement a queue using two stacks—idea?
- What does a min-stack need beyond a normal stack?
- What is tree diameter?
- k-th smallest in a BST?
- Bellman-Ford vs Dijkstra?
- How do you find connected components in an undirected graph?
- What must be true of dict keys in Python?
- Merge sort vs quicksort tradeoffs?
- Binary search bug that causes infinite loops?
- Search in a rotated sorted array—key idea?
- Classic recurrence for Fibonacci and its DP cost?
- Longest common subsequence—complexity of standard DP?
- Edit distance measures what?
- When is backtracking preferred over DP?
- House Robber intuition?
- Grid unique paths DP state?
- What edge cases should you always test?
- Why narrate tradeoffs in interviews?
- What is the lower bound for comparison-based sorting?
- Serialize and deserialize a binary tree—common approach?
- What is a bipartite graph check?
- Chaining vs open addressing?
- Why resize a hash table?
- When can you sort in O(n)?
- Is Python's sorted stable?
- Name a probabilistic alternative to exact set membership.
Data Engineering Recommended 47
- Most asked What is the difference between ETL and ELT, and when would you choose each?
- Most asked Batch or streaming: how do you decide?
- Most asked How do you implement incremental extraction, and what can go wrong?
- Most asked What is change data capture (CDC), and why is log-based CDC preferred over polling?
- Most asked What does it mean for a data pipeline to be idempotent, and how do you achieve it?
- Most asked How do you deduplicate events, and what does 'exactly-once' really mean?
- Most asked What is a star schema, and why is it used in data warehouses?
- Most asked What is the grain of a table, and what is join fan-out?
- Most asked Explain slowly changing dimensions, especially Type 1 and Type 2.
- Most asked What is dbt, and what problems does it solve?
- Most asked Why use an orchestrator like Airflow or Dagster instead of cron?
- Most asked Which data quality checks would you put on a critical pipeline?
- Most asked How do you monitor data pipelines beyond job success?
- Most asked Scenario: warehouse revenue is 4% higher than the payment provider's settlements. How do you investigate?
- Most asked Design a daily pipeline that loads orders from an operational database into a warehouse for analytics.
- Most asked How do you handle late-arriving data in a daily batch pipeline?
- Most asked Data warehouse, data lake or lakehouse: what is the difference?
- Most asked How do you handle personal data (PII) in a data warehouse?
- Most asked Scenario: a nightly job ran successfully but the dashboard shows zero sales for yesterday. What happened and how do you prevent it?
- Most asked Scenario: two dashboards show different numbers for the same metric. What do you do?
- How do you run a safe backfill of two years of data?
- What is the difference between append, overwrite and merge (upsert) load strategies?
- How do partitioning and clustering improve warehouse performance and cost?
- How does a dbt incremental model work, and what are its pitfalls?
- What is an Airflow DAG, and what is the logical date (data interval)?
- What is a data contract?
- How do you handle schema changes from source systems?
- How do you make sure readers never see a half-loaded table?
- Why are columnar formats like Parquet preferred for analytics?
- How would you reduce a data platform's warehouse bill?
- Write SQL to keep only the latest version of each record in a table of change rows.
- How do you test a data pipeline before deploying changes?
- Scenario: you must move a nightly full-copy pipeline to 5-minute freshness. How do you approach it?
- Yesterday's dashboard numbers are double what they should be. How do you investigate?
- How do you handle late-arriving and out-of-order events in a streaming pipeline?
- Write SQL that calculates a 7-day rolling average of daily revenue, including days with no orders.
- What is a surrogate key, and why do dimensions use them?
- What is the small files problem, and how do you fix it?
- What is the difference between a view, a table and a materialised view in a warehouse?
- What is the medallion (bronze, silver, gold) architecture?
- How do Kafka and stream processors fit into data pipelines?
- What are watermarks and windows in stream processing?
- What is data lineage, and why does it matter?
- Scenario: a dashboard query is slow and expensive. How do you optimise it?
- Scenario: a customer asks to be deleted. How does your data platform comply?
- What is reverse ETL?
- What skills does a data engineer need compared with a backend engineer?
Behavioral & STAR Recommended 41
- Most asked Tell me about a time you worked with a difficult teammate.
- Most asked Describe a disagreement you had with a coworker and how you resolved it.
- Most asked Tell me about a time you disagreed with your manager's decision.
- Most asked Tell me about a time you failed at something important.
- Most asked Describe a mistake that had a significant impact and how you handled it.
- Most asked Tell me about a time you had to work with unclear or changing requirements.
- Most asked Tell me about a time you missed a deadline.
- Most asked Tell me about a time you received critical feedback and how you responded.
- Most asked Describe a project you owned from start to finish.
- Most asked Tell me about a time you had to juggle multiple competing deadlines.
- Tell me about a time you led a project without formal authority.
- Tell me about a time you took responsibility for a team failure.
- Describe a time you had to collaborate with someone whose working style was very different from yours.
- Tell me about a successful project you completed as part of a team.
- Tell me about a time you helped a struggling teammate.
- Describe a time you had to push back on a stakeholder's request.
- Describe a time you had to deliver unwelcome feedback to a peer.
- Describe a time you had to motivate a team through a difficult period.
- Tell me about a decision you made that was unpopular with your team.
- Tell me about a time you had to make a decision with incomplete information as a leader.
- Tell me about a project that didn't go as planned.
- Tell me about a time you went above and beyond your job description.
- Describe a time you identified a problem no one had asked you to solve.
- Describe a situation where you had to make a decision without all the information you wanted.
- Tell me about a time priorities shifted midway through a project.
- Describe how you decide what to work on when everything feels urgent.
- Tell me about a time you helped a colleague grow their skills.
- Tell me about a time you received feedback that was hard to hear.
- Describe a time you had to rely on a team member you didn't fully trust yet.
- Tell me about a conflict between two people on your team and how you handled it.
- Describe a time you delegated an important task.
- Tell me about a time you had to say no to your manager.
- Describe how you handle working on something without a clear owner.
- Tell me about a time you had to say no to a request to protect a deadline.
- Describe a time you had to deprioritize something important.
- Describe your approach to onboarding a new team member.
- Tell me about a time you gave someone feedback that changed their behavior.
- Describe a time you learned something valuable from someone more junior than you.
- Describe how you typically respond to criticism.
- Tell me about a time you gave feedback that was poorly received.
- Describe a time feedback from a peer changed how you approached your work.