DoorDash Mid-Level AI Engineer Interview Preparation Guide
DoorDash's AI Engineer interview process for mid-level candidates involves a multi-stage evaluation spanning approximately 4-6 weeks. The process emphasizes practical problem-solving, real-world ML/AI system design, and cross-functional collaboration. Candidates progress through initial recruiter screening, two phone-based technical rounds (coding and ML systems design), and five onsite rounds covering system architecture, technical depth in AI/deep learning, and behavioral assessment. DoorDash evaluates candidates on their ability to design scalable AI systems, translate business requirements into technical solutions, and demonstrate proficiency with modern AI frameworks and techniques relevant to logistics optimization, fraud detection, and ranking systems.
Interview Rounds
Recruiter Screening
What to Expect
Initial conversation with a recruiter to assess background, career trajectory, and interest in the AI Engineer role. This round evaluates cultural fit, communication skills, and alignment with DoorDash's mission. The recruiter will discuss your experience with AI/ML systems, career goals, and why you're interested in DoorDash specifically. This is your opportunity to make a strong first impression and clarify any questions about the role or company.
Tips & Advice
Research DoorDash's business model, recent AI/ML initiatives, and how the company uses AI for delivery optimization. Prepare a concise 2-minute summary of your background, focusing on AI/ML projects with quantifiable impact. Articulate why you're excited about working on DoorDash's logistics and ranking challenges. Be authentic and show genuine interest in the company's mission. Have thoughtful questions ready about the role, team structure, and engineering culture. Avoid generic answers; use specific examples of how DoorDash's problems align with your interests.
Focus Topics
Cultural Fit and Learning Mindset
Show openness to feedback, willingness to learn new tools/techniques, and ability to adapt to fast-paced environments. Discuss how you stay current with AI research and trends.
Practice Interview
Study Questions
Communication and Collaboration Skills
Demonstrate your ability to communicate technical concepts clearly and work effectively with cross-functional teams (product, data engineering, operations).
Practice Interview
Study Questions
Career Background and AI/ML Experience
Clearly articulate your experience with machine learning, deep learning, NLP, or generative AI. Emphasize projects with business impact and technical growth.
Practice Interview
Study Questions
Motivation for DoorDash
Explain why DoorDash specifically appeals to you and how your interests align with the company's AI challenges (logistics, fraud detection, personalization).
Practice Interview
Study Questions
Technical Coding Phone Screen
What to Expect
A 60-minute live coding interview assessing your algorithmic problem-solving, data structure knowledge, and Python proficiency. You'll solve 1-2 coding problems on a shared editor (typically LeetCode-style or custom platform). The interviewer evaluates your approach to problem-solving, code quality, debugging ability, and communication during the problem-solving process. This round establishes that you have solid foundational CS skills required for implementing AI systems.
Tips & Advice
Practice 30-40 LeetCode problems at medium difficulty, focusing on arrays, strings, graphs, dynamic programming, and linked lists. Solve problems on an actual coding editor (not just on paper) to simulate the real interview. For each problem, verbalize your thought process, explain your approach before coding, and discuss time/space complexity. Write clean, readable code with proper variable names. Test your code with edge cases (empty inputs, single elements, duplicates). If you get stuck, ask clarifying questions and think aloud. For DoorDash-specific context, be prepared for problems involving sorting, searching, or optimizing delivery-related scenarios. Time management is critical—aim to solve the first problem in 15-20 minutes, leaving buffer for the second problem.
Focus Topics
Code Quality and Debugging
Write clean code with meaningful variable names, handle edge cases, test your solution, and debug effectively when issues arise.
Practice Interview
Study Questions
Problem-Solving Communication
Think aloud during the interview, explain your approach, and walk through examples before implementing. Ask clarifying questions and discuss trade-offs.
Practice Interview
Study Questions
Algorithm Design and Complexity Analysis
Design efficient algorithms and analyze time/space complexity. Understand Big-O notation and trade-offs between different approaches.
Practice Interview
Study Questions
Python Coding Proficiency
Write Python code that is clean, readable, and efficient. Demonstrate familiarity with Python standard libraries, list comprehensions, and Pythonic idioms.
Practice Interview
Study Questions
Data Structures Mastery
Proficiency with arrays, linked lists, trees, graphs, hash tables, stacks, and queues. Know when to use each data structure for optimal performance.
Practice Interview
Study Questions
Machine Learning Systems Design Phone Screen
What to Expect
A 60-minute phone-based technical interview assessing your ability to design end-to-end ML pipelines and systems. You'll be presented with a real-world business problem (e.g., predicting delivery times, identifying fraudulent orders, or optimizing driver routing) and asked to design an ML solution from scratch. The interviewer evaluates your understanding of ML fundamentals, data pipeline architecture, model evaluation, and practical trade-offs. You'll discuss feature engineering, model selection, evaluation metrics, and how to productionize the solution.
Tips & Advice
Structure your answer using a clear framework: 1) Clarify the problem and success metrics, 2) Define data sources and feature engineering approach, 3) Select and justify a model architecture, 4) Discuss evaluation metrics and validation strategy, 5) Address production considerations (latency, scalability, monitoring). Use real examples from your projects, but don't get bogged down in implementation details. Discuss trade-offs explicitly (e.g., model complexity vs. inference latency, accuracy vs. fairness). Be ready to pivot based on interviewer feedback—if they ask about constraints, adjust your solution accordingly. Prepare for follow-up questions about handling data quality issues, class imbalance, model degradation, and real-world complexities. Practice sketching system diagrams on paper or virtual whiteboard to visualize your pipeline. Reference DoorDash's known challenges (delivery time prediction, fraud detection, ranking) if relevant.
Focus Topics
Production and Deployment Considerations
Discuss model serving (batch vs. real-time), latency constraints, scalability, model versioning, A/B testing, and monitoring for model degradation in production.
Practice Interview
Study Questions
Feature Engineering and Data Quality
Identify relevant features, handle missing values, normalize data, create derived features, and ensure data quality. Discuss feature selection and dimensionality reduction.
Practice Interview
Study Questions
ML Pipeline Architecture
Design end-to-end pipelines: data ingestion → preprocessing → feature engineering → model training → inference → monitoring. Understand batch vs. real-time processing.
Practice Interview
Study Questions
Model Evaluation Metrics and Validation
Select appropriate metrics (precision, recall, F1, AUC-ROC, RMSE) based on business objectives. Understand cross-validation, train/test splits, and avoiding data leakage.
Practice Interview
Study Questions
Handling Overfitting, Regularization, and Model Selection
Recognize overfitting, apply regularization techniques (L1/L2, dropout), cross-validate, and select models that generalize well. Discuss trade-offs between model complexity and interpretability.
Practice Interview
Study Questions
System Design Onsite Interview
What to Expect
A 60-minute in-person or video interview focused on designing scalable AI/ML systems to solve DoorDash-specific problems. You'll be asked to architect a system like 'Design DoorDash's Delivery Time Estimation System' or 'Design a Real-Time Fraud Detection System.' The interviewer probes your understanding of distributed systems, scalability, reliability, and how to integrate ML models into production systems. You should discuss data flow, infrastructure choices (cloud services, databases, message queues), and trade-offs between consistency, availability, and latency.
Tips & Advice
For mid-level engineers, focus on practical system design: clarify requirements and constraints, propose a high-level architecture with clear components, discuss data flow, address scalability and fault tolerance, and consider realistic production challenges. Use AWS services as reference points (S3, DynamoDB, SageMaker, EC2, Lambda). Draw architecture diagrams showing data pipelines, ML model serving, caching layers, and monitoring. Discuss trade-offs: strong consistency vs. eventual consistency, batch processing vs. real-time, on-device vs. server-side inference. For delivery time estimation, discuss how you'd handle feature updates, model retraining, and A/B testing new models. For fraud detection, address latency constraints (decisions needed in milliseconds), false positive rates, and feedback loops. Be prepared to discuss infrastructure costs, monitoring strategies, and failure scenarios. Mid-level engineers should demonstrate thoughtful architectural decisions, not just depth on one component.
Focus Topics
Real-Time vs. Batch Processing Trade-offs
Design decisions for real-time inference (for immediate decisions like fraud flags) vs. batch processing (for model training or bulk predictions). Discuss latency, throughput, and consistency implications.
Practice Interview
Study Questions
Monitoring, Reliability, and Failure Handling
Discuss monitoring ML systems for data drift, model degradation, infrastructure failures. Design for fault tolerance, graceful degradation, and rollback strategies.
Practice Interview
Study Questions
Distributed Systems and Infrastructure Concepts
Understand principles of distributed computing, databases (SQL vs. NoSQL), caching, load balancing, message queues, and cloud services (AWS, GCP). Know when to use each.
Practice Interview
Study Questions
ML Model Serving and Inference Infrastructure
Design strategies for serving ML models in production: online inference (synchronous), batch inference, edge inference, model versioning, canary deployments, and monitoring.
Practice Interview
Study Questions
Scalable AI System Architecture
Design architectures that handle high-volume data, support millions of daily predictions, and maintain low latency. Include data ingestion, processing, ML inference, and result serving layers.
Practice Interview
Study Questions
Machine Learning Technical Deep Dive Onsite Interview
What to Expect
A 60-minute in-person interview diving deep into ML theory and practical techniques. The interviewer presents scenarios or datasets and asks you to discuss model selection, feature engineering strategies, evaluation approaches, and optimization techniques. You might be given a real-world problem (e.g., building an ETA model or detecting anomalous orders) and asked to work through feature engineering, model architecture decisions, and evaluation metrics. The round assesses your depth of understanding in ML fundamentals and your ability to make principled technical decisions.
Tips & Advice
Review ML fundamentals thoroughly: supervised vs. unsupervised learning, regression vs. classification, loss functions, optimization algorithms, and hyperparameter tuning. Prepare to discuss specific techniques like regularization (L1/L2, dropout, early stopping), cross-validation strategies, and handling class imbalance. Study ensemble methods (random forests, gradient boosting) and know when each is appropriate. Be ready to perform or discuss exploratory data analysis (EDA) on a dataset. Prepare examples from your past projects where you made specific modeling choices and justified them with metrics or business outcomes. Practice explaining complex concepts simply—interviewers often ask you to 'teach' them about a technique. Expect questions about trade-offs: bias vs. variance, model complexity vs. interpretability, training time vs. model quality. Come prepared with 2-3 deep-dive stories about ML projects where you owned the modeling decisions and achieved measurable results.
Focus Topics
Ensemble Methods and Advanced Algorithms
Understand random forests, gradient boosting (XGBoost, LightGBM), and bagging/boosting. Know when each is appropriate and their computational trade-offs.
Practice Interview
Study Questions
Model Evaluation, Metrics, and Validation Strategies
Choose appropriate metrics for business objectives (precision vs. recall for imbalanced data, AUC for ranking, RMSE for regression). Design robust validation: cross-validation, temporal splits for time-series, stratification.
Practice Interview
Study Questions
Regularization, Overfitting Prevention, and Hyperparameter Tuning
Apply regularization (L1/L2, dropout, early stopping). Use techniques like grid search, random search, or Bayesian optimization for hyperparameter tuning. Validate on held-out data.
Practice Interview
Study Questions
Feature Engineering and Exploratory Data Analysis (EDA)
Conduct EDA to understand data distributions, correlations, and anomalies. Engineer features thoughtfully: scaling, normalization, encoding, interaction terms, temporal features.
Practice Interview
Study Questions
Supervised Learning Fundamentals
Master regression and classification tasks, loss functions, optimization algorithms (SGD, Adam), and hyperparameter tuning. Understand bias-variance trade-off and underfitting vs. overfitting.
Practice Interview
Study Questions
Advanced AI and Neural Networks Onsite Interview
What to Expect
A 60-minute technical interview focused on advanced AI topics: deep learning, neural network architectures, natural language processing, and/or generative AI. Given the job description's emphasis on neural networks, deep learning, NLP, and generative AI, this round assesses your expertise in these areas. You might discuss CNN architectures, sequence models (RNNs, Transformers), attention mechanisms, transfer learning, fine-tuning pre-trained models, or generative models. You'll need to explain complex concepts clearly and discuss practical applications at DoorDash (e.g., using NLP for customer service, vision for image-based fraud detection, or generative AI for optimization).
Tips & Advice
Study deep learning fundamentals: neural network architecture, activation functions, backpropagation, gradient descent variants (SGD, Adam, RMSprop). Review CNN architectures (ResNet, VGG, Inception) for computer vision and RNN/LSTM/GRU for sequences. Understand attention mechanisms and Transformers (the foundation of modern NLP and generative AI). For NLP, review word embeddings (Word2Vec, GloVe), sequence-to-sequence models, BERT, GPT, and their applications. For generative models, understand diffusion models, VAEs, and GANs at a conceptual level. Study transfer learning and fine-tuning strategies—these are crucial for practical AI development. Be prepared to discuss trade-offs: model size vs. accuracy, training time vs. inference latency, using pre-trained models vs. training from scratch. Prepare 2-3 stories about neural network projects where you made principled architectural choices and optimized for specific constraints. Discuss how you'd apply these techniques to DoorDash-specific problems.
Focus Topics
Optimization and Practical Deep Learning Techniques
Discuss training strategies: batch normalization, dropout, learning rate scheduling, mixed precision training. Address computational efficiency: model compression, quantization, pruning, knowledge distillation.
Practice Interview
Study Questions
Natural Language Processing and Language Models
Understand NLP tasks: tokenization, embeddings, sequence modeling, attention, and Transformer-based models (BERT, GPT). Discuss applications like text classification, sentiment analysis, and information extraction.
Practice Interview
Study Questions
Transfer Learning and Fine-Tuning Pre-trained Models
Leverage pre-trained models (BERT, GPT, vision transformers) and fine-tune for specific tasks. Understand when to fine-tune vs. feature extraction. Manage domain shift and data efficiency.
Practice Interview
Study Questions
Generative AI and Emerging Models
Understand generative models: diffusion models, VAEs, GANs, and large language models (LLMs). Discuss applications and limitations. Stay current with recent advances (as the job description emphasizes).
Practice Interview
Study Questions
Deep Learning Fundamentals and Neural Network Architectures
Master neural network basics: layers, activation functions, backpropagation, loss functions, and optimization. Understand common architectures: CNNs, RNNs, LSTMs, Transformers, and their applications.
Practice Interview
Study Questions
Behavioral and Experience Interview Onsite
What to Expect
A 60-minute in-person interview assessing your past experience, problem-solving approach, cross-functional collaboration, and cultural fit with DoorDash. Using the STAR (Situation, Task, Action, Result) format, you'll discuss real projects where you owned outcomes, handled ambiguity, navigated conflicts, or learned from failures. The interviewer evaluates your ability to communicate clearly, take ownership, and work effectively in a team. Expect questions about your biggest technical challenges, how you've grown as an engineer, and how you handle fast-paced, high-pressure environments.
Tips & Advice
Prepare 4-5 compelling stories using STAR format: 1) A complex ML project where you owned results, 2) A time you failed and what you learned, 3) A situation requiring cross-functional collaboration to solve a problem, 4) A time you showed initiative or leadership, 5) A challenge involving tight deadlines or resource constraints. For each story, be specific with metrics and outcomes—'improved model accuracy by 8%' is better than 'improved performance.' Emphasize your role and personal decisions, not just your team's work. Show self-awareness: discuss what you'd do differently and how you've grown. Prepare for follow-up questions that probe deeper ('What would you do differently now?' 'How did you measure success?'). Research DoorDash's values and company culture; demonstrate alignment in your answers. Be authentic and conversational—avoid scripted responses. Ask thoughtful questions about the team and role to show genuine interest. Practice explaining technical details to non-technical audiences.
Focus Topics
Initiative and Continuous Learning
Show examples of going beyond your job description, proposing improvements, or learning new technologies to solve problems. Discuss how you stay current with AI advancements.
Practice Interview
Study Questions
Handling Ambiguity and Pragmatic Trade-offs
Describe situations with ambiguous requirements, tight deadlines, or limited resources. Show how you prioritized, made pragmatic trade-offs, and delivered under constraints.
Practice Interview
Study Questions
Learning from Failure and Growth Mindset
Share a specific failure or setback (e.g., model that didn't meet expectations, missed deadline, wrong architectural choice) and what you learned. Show how you applied those lessons.
Practice Interview
Study Questions
Cross-Functional Collaboration and Communication
Discuss times you worked with product, data engineering, operations, or analytics teams. Show how you translated ML concepts for non-technical stakeholders and aligned on goals.
Practice Interview
Study Questions
Ownership and Results-Oriented Mindset
Share examples where you owned a project end-to-end, made key decisions, and drove measurable business or technical impact. Emphasize quantified outcomes.
Practice Interview
Study Questions
Hiring Manager or Senior Engineer Interview Onsite
What to Expect
A 45-60 minute conversation with the hiring manager or senior engineer responsible for the AI team. This round assesses team fit, long-term potential, and your alignment with the team's mission and technical direction. You'll discuss your career goals, how you see the role evolving, what kind of environment you thrive in, and what excites you about working on DoorDash's AI challenges. The interviewer may touch on technical topics but focuses primarily on assessing whether you're someone they'd want to mentor or collaborate with long-term.
Tips & Advice
Research the hiring manager or team lead on LinkedIn and understand their background if possible. Prepare thoughtful questions about the team's roadmap, current challenges, culture, and opportunities for growth. Be ready to discuss your career vision: where do you want to be in 3-5 years? What kind of problems excite you? Show genuine interest in DoorDash's logistics and AI challenges. Be authentic about your working style and what environment brings out your best work. If asked about weaknesses, be honest but show self-awareness and improvement. Listen carefully to what the interviewer is passionate about—reflect that back in your conversation. This is your chance to ask about team dynamics, mentorship, work-life balance, and growth opportunities. Remember, hiring managers are not just evaluating you; you're also evaluating whether this role and team are right for you.
Focus Topics
Collaboration and Mentorship Potential
Discuss how you've learned from mentors, how you approach mentoring others, and your philosophy on team growth. Show willingness to contribute to team success.
Practice Interview
Study Questions
Team and Culture Fit
Discuss the type of environment where you do your best work: collaborative vs. independent, fast-paced vs. deliberate, etc. Show alignment with DoorDash's culture and values.
Practice Interview
Study Questions
Technical Interest in DoorDash's AI Challenges
Demonstrate genuine interest in solving DoorDash's specific problems: delivery optimization, fraud detection, personalization, autonomous decision-making. Show you've thought about these challenges.
Practice Interview
Study Questions
Long-term Career Goals and Growth Mindset
Articulate where you want to be in 3-5 years (e.g., senior AI engineer, tech lead, expert in specific domain). Show how this role at DoorDash aligns with that trajectory.
Practice Interview
Study Questions
Frequently Asked AI Engineer Interview Questions
You have k sorted lists (or k sorted streams/iterators) totaling n elements, and need to merge them into one sorted output. Compare the heap-based approach (O(n log k) time, O(k) extra space) against pairwise merging, and explain why the heap approach's log k factor is what makes it scale better as k grows.
Sample Answer
Approach: Use a min-heap seeded with the first element of each of the k lists/streams. Repeatedly pop the minimum, append it to the output, and push the next element from whichever list that minimum came from - this yields O(n log k) total time using O(k) extra space, versus O(nk) for naive pairwise scanning or O(n log n) for concatenate-then-sort (which also ignores that the inputs are already individually sorted).
import heapq
def merge_k_sorted(lists):
heap = []
for i, lst in enumerate(lists):
if lst:
heapq.heappush(heap, (lst[0], i, 0)) # (value, list_idx, elem_idx)
result = []
while heap:
val, li, ei = heapq.heappop(heap)
result.append(val)
if ei + 1 < len(lists[li]):
heapq.heappush(heap, (lists[li][ei + 1], li, ei + 1))
return result
Key points: The heap always holds at most k elements (one "frontier" element per still-active list), so each push/pop is O(log k). Every one of the n total elements across all lists is pushed and popped exactly once, giving O(n log k) total. The (value, list_idx, elem_idx) tuple breaks value ties deterministically by list index, avoiding a comparison error if two lists' current elements happen to be equal (Python would otherwise try to compare list contents on a tie, which can error or behave unexpectedly).
Complexity: O(n log k) time, O(k) extra space for the heap (plus O(n) for the output, which is unavoidable since you must produce all n elements).
Edge cases: empty input lists are skipped when seeding the heap (never pushed, so never popped); a completely empty lists argument (k=0) returns an empty result with no heap operations; lists of very uneven length are handled naturally since exhausted lists simply stop contributing new pushes.
Worked example / execution verification
lists = [[1, 4, 9], [2, 5], [0, 3, 6, 7]]
result = merge_k_sorted(lists)
print(result)
print(result == sorted(sum(lists, [])))
Executed: result is [0, 1, 2, 3, 4, 5, 6, 7, 9], and result == sorted(sum(lists, [])) evaluates to True, confirming correctness against a brute-force reference (flatten and sort).
Why the log k factor matters: for k=2 (merging just two sorted lists, the base case of mergesort's merge step), this reduces to the familiar O(n) two-pointer merge, since log(2)=1 is a constant. As k grows large relative to n (many small lists), the log k factor becomes the meaningful cost - a naive pairwise-merge approach (merge list 1 and 2, then merge that with list 3, etc.) would cost O(nk) in the worst case (each of the k-1 pairwise merges touches up to n elements), which is asymptotically worse than O(n log k) once k grows large.
Trade-offs & pitfalls
- If k is very large (comparable to n) and the individual lists are very short, the O(n log k) bound approaches O(n log n) - at that point, simply concatenating and sorting is competitive and much simpler to implement correctly.
- For STREAMS/ITERATORS rather than materialized lists (as the question's k-sorted-log-files variant poses), the same heap-based approach applies, but each "push the next element" step means pulling from the iterator rather than indexing into an array - the complexity analysis (O(n log k) time, O(k) space) is identical.
- A tuple-comparison tie on equal values across different source lists needs an explicit tie-breaker (like the list index used above) to avoid comparing non-comparable payload values if the payload itself isn't orderable.
Why do neural networks require non-linear activation functions? Show with a short argument why stacking only linear layers collapses to a single linear transform, and give a concrete task (e.g. XOR) that a purely linear network cannot solve.
Sample Answer
Direct answer
Neural networks need non-linear activations because any stack of purely linear layers is mathematically equivalent to one single linear layer, no matter how deep; without non-linearity, depth buys you nothing extra in representational power.
Structured elaboration
For two linear layers, y=W2(W1x+b1)+b2=(W2W1)x+(W2b1+b2), which has exactly the same FORM as a single linear layer y=Weffx+beff with Weff=W2W1 and beff=W2b1+b2. This generalizes to any number of stacked linear layers: the composition of L linear maps is always itself one linear map. So a linear-only network, regardless of depth, can only ever represent affine functions, meaning it can only draw a single straight decision boundary (a hyperplane) between classes.
Worked example
XOR is the standard concrete counterexample: for inputs x1,x2∈{0,1}, XOR outputs 1 for (0,1) and (1,0), and 0 for (0,0) and (1,1). Plotting these four points, the two positive-label points sit on one diagonal and the two negative-label points sit on the other; no single straight line can separate them, so no purely linear model, of any depth, can represent XOR exactly. Adding a non-linear activation (even a single ReLU or sigmoid layer of hidden units) lets the network carve the input space into multiple linear regions that, combined, DO implement XOR. Concretely, a 2-unit hidden layer with ReLU activations can implement XOR as XOR(x1,x2)=ReLU(x1+x2)−2⋅ReLU(x1+x2−1), which evaluates to 0 at (0,0), 1 at both (0,1) and (1,0), and 0 at (1,1), exactly matching XOR.
Trade-offs & pitfalls
The consequence for expressivity is total, not partial: this is not a case of linear networks being "a bit worse" at non-linear tasks, they are mathematically INCAPABLE of representing them exactly, regardless of how many linear layers or how many units per layer you add. Non-linearity is precisely what allows a deep network to build a genuine hierarchy of increasingly abstract features rather than just re-parameterizing the same single affine transform.
As the AI/engineering lead for a significant new downstream domain, decide whether to retrain a foundation model from scratch, continue pretraining, fine-tune adapters on top of a frozen base, or instead keep the model frozen and rely on retrieval-augmented prompting. Propose a decision framework weighing data volume, domain distance, cost, risk of forgetting, latency, maintainability, regulatory constraints, user experience, and time-to-market.
Sample Answer
Direct answer: Deciding whether to retrain a foundation model from scratch, continue pretraining, or only fine-tune adapters (or stay frozen and use retrieval-augmented prompting instead) should be driven by a structured cost-benefit framework, quantifying the actual domain gap and available data, estimating benefit against compute cost, and weighing forgetting risk and time-to-market, rather than defaulting to whichever option sounds most thorough.
Structured elaboration:
- Quantify the domain gap and data sufficiency first: measure how far the target domain's data actually is from the source distribution (an embedding-shift statistic, or a task-level performance delta on a few-shot evaluation), and count how much labeled and unlabeled target data is actually available, since the right answer depends heavily on both numbers, not on intuition about how "different" the domain feels.
- Estimate benefit versus cost explicitly: expected performance gain tends to scale with both the domain gap and the (diminishing-returns) log of available data volume, while compute cost scales very differently across the three options, retraining from scratch costs roughly the full model's original pretraining compute, continued pretraining costs a fraction of that, and adapters cost comparatively little; putting a real GPU-hour and dollar estimate against each option turns "which is best" into a concrete comparison.
- Weigh risk and operational factors: the likelihood of catastrophic forgetting scales with how orthogonal the new task or domain is to the base model's original capabilities (and is mitigated by replay or multi-task fine-tuning); adapters reach production fastest, continued pretraining next, full retraining slowest; and a full retrain may trigger a costly re-certification or revalidation process in a regulated setting that adapters would not.
- Decision guidelines: prefer staying frozen and relying on retrieval-augmented prompting when the gap is mainly about missing or fast-changing FACTUAL knowledge rather than a behavioral or stylistic shift, when the underlying corpus changes faster than any retraining cadence could track, or when auditability (being able to cite the exact source behind an answer) matters more than baking the knowledge into the weights, since RAG avoids fine-tuning cost and forgetting risk entirely at the price of retrieval-time latency and dependence on a well-maintained index; prefer fine-tuning adapters when the domain gap is small to moderate, data is limited, time pressure is high, and risk tolerance is low; prefer continued pretraining when the gap is moderate, unlabeled data is abundant, and you need broad improvement across many downstream tasks while still preserving base capabilities; reserve retraining from scratch for a very large domain shift (a genuinely new modality or language), a massive high-quality dataset, or a required architectural change, since anything short of that rarely justifies its cost.
- Validate cheaply before committing: run a linear-probe or few-shot evaluation, a short (one to two epoch) continued-pretraining trial, and a quick adapter prototype against your core success metrics before committing to the full-scale version of whichever option the framework points to, these cheap probes catch a wrong framework-based call before it becomes an expensive mistake.
Worked example: For a moderate domain shift (say, adapting a general assistant to a specialized professional vertical) with a large pool of unlabeled in-domain text but only a modest labeled set, the framework points toward continued pretraining on the unlabeled corpus followed by adapters or LoRA fine-tuning on the labeled data, rather than either a frozen-plus-RAG approach (which would under-use the abundant unlabeled data) or a full retrain (which the domain gap and available compute do not justify). Running a cheap 1-2 epoch continued-pretraining probe first and measuring the delta on a held-out task-relevant evaluation confirms whether that recommendation is actually earning its cost before committing the full compute budget to it.
Trade-offs and pitfalls: The most common mistake is skipping the cheap validation probes and committing straight to the framework's recommended option at full scale, if the domain-gap estimate was wrong, that mistake is expensive to discover only after a full-scale continued-pretraining or retraining run has already consumed most of its budget. A second pitfall specific to regulated or safety-critical deployments is underestimating the re-certification cost a full retrain can trigger, which can dominate the total cost comparison even when the raw compute cost looks similar to continued pretraining.
You inherit a production generative model that occasionally outputs biased or harmful content. The original team left minimal documentation and only anecdotal reports. Create a triage and remediation plan: immediate mitigations to reduce harm, a root cause investigation checklist, stakeholder communication (legal/PR/product), testing plan, and long-term fixes including CI checks and monitoring.
Sample Answer
Immediate mitigations (hours-to-1 day)
- Disable risky channels/features: throttle or turn off public-facing generation endpoints; switch to read-only or queued mode.
- Apply fast-response filters: deploy a conservative post-generation safety filter (blacklist + regex + toxicity classifier) and high-recall heuristics to block or mark outputs for human review.
- Lower model capabilities temporarily: reduce temperature/top-p, shorten max tokens, remove creative prompts/templates.
- Rate-limit and add logging: capture full prompts, metadata, model versions, user IDs for rapid forensics.
- Notify stakeholders (brief): product, legal, security, and support that mitigation is active and investigation started.
Root-cause investigation checklist (days)
- Reproduce incidents: collect representative prompts and outputs; try to trigger with variations.
- Data provenance: inspect training/fine-tune datasets, filtering steps, instruction/data sources, and augmentation scripts.
- Model lineage: identify base model, fine-tune checkpoints, hyperparameters, and deployment artifacts.
- Prompting layer: check system prompts, templates, prompt injection possibilities, and dynamic context injection.
- Safety components: review safety classifier models, thresholds, and post-processing codepaths.
- Access controls: audit who pushed code/weights, CI/CD history, infra changes, and dependency updates.
- Metrics/logs: analyze historical logs for trend spikes and correlated deploys/releases.
- Third-party: verify any external APIs or datasets used.
Stakeholder communication
- Legal/PR: give a factual timeline, known impact, immediate mitigations, and planned remediation. Avoid speculation; provide regular updates (e.g., 24/72-hour cadence).
- Product: prioritize user-facing scope, rollback plan, & acceptance criteria for fixes.
- Support/Trust & Safety: provide guidance scripts for responders and monitoring dashboards.
- Executives: concise risk summary, potential regulatory exposure, mitigation status, and next steps.
Testing plan
- Unit/regression tests: safety unit tests for blacklisted phrases and policy rules.
- Adversarial test suite: curated prompts (edge cases, prompt injections, roleplay, hallucination triggers) and automated fuzzing to surface failure modes.
- Evaluation metrics: toxicity, bias (demographic parity, false-positive/negative rates), and hallucination rates; measure across demographic slices.
- Human-in-the-loop review: annotation rounds with diverse raters and inter-rater agreement checks.
- Staging A/B: deploy fixes behind feature flags with canary users and monitor metrics before full rollout.
Long-term fixes / CI and monitoring
- Safety gating in CI: require passing safety test suite and model-card checks before deployment; automate dataset validation (PII, toxic content, class balance).
- Model cards & metadata: enforce mandatory lineage, training data summaries, known limitations, and intended use in repo.
- Continuous monitoring: real-time dashboards for safety metrics, alerting on threshold breaches, and automated rollback triggers.
- Governance: establish review board (ML, legal, product, ethics) for risky changes; require sign-offs for new data/model additions.
- Red-team program: ongoing adversarial testing, periodic audits, and external audits where appropriate.
- Feedback loop: user reporting channel integrated into incident pipeline and retraining data pipeline for safe remediation.
- Safer architecture: consider ensemble safety layer (detector + smaller constraint model), retrieval-augmented response validation, and prompt sanitization.
This plan balances immediate harm reduction, systematic root-cause analysis, stakeholder alignment, rigorous testing, and engineering controls to prevent recurrence while enabling measured restorations of functionality.
Implement beam search decoding with length normalization in Python. Accept a scoring function score(prefix_tokens) -> log_probs and parameters beam_width and length_penalty, and return the top hypothesis. Explain how length_penalty changes ranking and how you would manage memory for large beams.
Sample Answer
Direct answer
Beam search keeps the top-k highest cumulative-log-probability partial sequences alive at every decoding step (instead of committing to one token at a time like greedy decoding), which lets it recover from a locally suboptimal choice that greedy would be permanently stuck with; length normalization then corrects the length bias that raw cumulative log-probability introduces against longer sequences.
Structured elaboration
Why raw cumulative log-probability is length-biased. Every additional generated token multiplies the sequence's probability by another factor less than 1 (log-probabilities are always ≤0 and keep decreasing as you add tokens), so a raw score comparison systematically favors shorter sequences regardless of quality. Length normalization corrects this by dividing the raw score by a length-dependent penalty term, most commonly the GNMT-style form lp(Y)=(5+1)α(5+∣Y∣)α, where α (the length_penalty parameter) controls how strongly longer sequences are favored: α=0 removes normalization entirely (raw score wins), and larger α increasingly favors longer completions.
Algorithm. At each step, expand every live beam by its top candidate next tokens, score each resulting candidate sequence by its length-normalized cumulative log-probability, then keep only the global top beam_width candidates across ALL beams (not top-beam_width per beam), pruning the rest. Finished sequences (those that produced an end-of-sequence token) are carried forward as-is rather than expanded further, so they can still be beaten by an unfinished beam that later produces a better completion.
def beam_search(score_fn, beam_width, max_len, length_penalty=1.0, start_token=0):
"""score_fn(prefix_tokens) -> list of log-probs for the next token, one per vocab id.
Returns (best_sequence, normalized_score)."""
beams = [([start_token], 0.0, False)] # (sequence, raw cumulative log-prob, finished)
def length_norm(raw_score, length):
lp = ((5 + length) / 6) ** length_penalty
return raw_score / lp
for _ in range(max_len):
if all(finished for _, _, finished in beams):
break
candidates = []
for seq, raw_score, finished in beams:
if finished:
candidates.append((seq, raw_score, True))
continue
next_logprobs = score_fn(seq)
top_ids = sorted(range(len(next_logprobs)), key=lambda i: -next_logprobs[i])[:beam_width]
for tid in top_ids:
candidates.append((seq + [tid], raw_score + next_logprobs[tid], tid == EOS))
candidates.sort(key=lambda c: -length_norm(c[1], len(c[0])))
beams = candidates[:beam_width]
beams.sort(key=lambda c: -length_norm(c[1], len(c[0])))
best_seq, best_raw, _ = beams[0]
return best_seq, length_norm(best_raw, len(best_seq))
Memory for large beams. Memory grows linearly with beam_width (you're keeping that many full candidate sequences and their scores alive simultaneously) and, per step, you generate beam_width x branching_factor candidates before pruning back down, so very large beams on very large vocabularies can become the actual memory bottleneck; production systems bound this by only considering the top few next-token candidates per beam (as the implementation above does) rather than the full vocabulary, and by capping max_len to avoid runaway generation.
Worked example
I verified the escape-the-local-optimum behavior in a sandbox with a small constructed toy language model where the correct global optimum requires NOT taking the locally best first token. After token 0, the toy model scores token 1 at log-prob −0.1 (locally best) and token 2 at −1.0 (locally worse), but token 1's only continuation is forced into a low-probability end-of-sequence (−3.0), giving total −0.1+−3.0=−3.1, while token 2 opens a much better continuation ending at total −1.0+−0.05+−0.05=−1.1.
- Greedy (
beam_width=1) can only ever keep the single locally-best token alive, so it is permanently stuck on the −3.1 path:[0, 1, EOS]. - Beam search (
beam_width=2,length_penalty=0) keeps both token 1 and token 2 alive after the first step, discovers token 2's branch has a better TOTAL score once fully expanded, and correctly returns[0, 2, 1, EOS]with score −1.1, strictly better than greedy's −3.1.
Both scores were confirmed by running the implementation and comparing against the hand-computed totals above; they matched exactly.
Trade-offs & pitfalls
A high length-penalty α can overcorrect and start favoring longer, more rambling completions purely because they're longer, not because they're actually better, so α needs to be tuned (typically in the 0.6 to 1.0 range in practice) rather than left at its default. Beam search is also strictly more expensive than greedy (roughly beam_width times the compute and memory per step) for a gain that matters most on tasks with a genuinely correct target sequence (translation, code generation from spec); for open-ended generation, beam search's tendency to find the single highest-probability sequence often produces blander, more repetitive text than sampling-based decoding would, which is why it's rarely used for chat.
What's your framework for deciding when a stalled cross-team dependency needs to go to leadership versus continuing to work it peer-to-peer?
Sample Answer
Direct answer
Keep a stalled dependency peer-to-peer as long as direct conversation is still making progress. Escalate when you hit a concrete trigger: a scope change that neither side can unilaterally absorb, genuinely conflicting priorities that only someone with visibility into both roadmaps can arbitrate, or a hard deadline-driven blocker where peer-to-peer conversation has already stalled.
Framework
Default: work it peer-to-peer. Most stalls are under-communication or unclear ownership, and a direct conversation or a short written proposal usually unsticks them without anyone else getting involved.
Concrete triggers to escalate.
- Scope change: the fix now requires work neither team budgeted for, and only a manager can reprioritize that.
- Conflicting priorities: both sides are acting rationally from their own team's goals, and the trade-off needs someone with visibility into both roadmaps to arbitrate.
- Hard blocker with a deadline: a fixed external date is genuinely at risk, and peer-to-peer conversation has already stalled past a reasonable window, for example no movement after two direct attempts over several days.
- Repeated pattern: the same kind of stall keeps recurring with the same team, which means the real issue is the working relationship or process, not this one dependency.
What to bring when you escalate. A short brief: what's blocked, what you've already tried peer-to-peer, the realistic options and their trade-offs, and the specific decision you need.
Worked example (applying the criteria)
Situation: your team's deliverable needs a schema change from another team that they've deprioritized for two weeks despite two direct requests.
Applying the criteria: this isn't just a communication gap, direct conversation was already tried twice with no movement. It's a conflicting-priorities case, the other team's roadmap has no room for this without reprioritizing something else, combined with a hard blocker, a fixed external deadline in three weeks that this schema change sits on the critical path for (meaning if this dependency slips, the final deadline slips by the same amount, unlike a dependency with buffer to absorb delay).
Action: escalated to the shared manager with a one-page brief covering what's blocked, the two peer-to-peer attempts and their outcome, and two options: the other team reprioritizes one sprint of work, or your team ships a temporary workaround with known limitations, along with the deadline risk if neither happens within the week.
Result: the shared manager reprioritized one sprint item, unblocking the schema change with two weeks to spare before the deadline. Both teams also agreed to flag scope-affecting asks earlier next time, so the same dependency doesn't reach this point again.
Trade-offs and pitfalls
- Escalating too early over normal friction burns trust and reads as an inability to work horizontally.
- Escalating too late, repeatedly trying peer-to-peer past the point it's actually working, puts the deadline at real risk and looks like poor judgment in hindsight.
- A vague escalation with no options and no specific ask wastes the leader's time compared with a brief that names the decision needed.
Implement fairness monitoring for a loan-approval model in production. Choose at least two fairness metrics and justify your choice, explain how you'd compute them online with partial or delayed labels, how to handle missing or noisy sensitive-attribute data under privacy constraints, and how you'd act on a detected regression while limiting false alarms.
Sample Answer
Direct answer
Fairness monitoring for a loan-approval model needs at least two complementary metrics computed online despite delayed or partial labels, careful handling of missing sensitive-attribute data under privacy constraints, and an action path that doesn't page anyone on every noisy fluctuation.
Structured elaboration
- Choosing metrics: disparate impact ratio (the approval rate for a protected group relative to the reference group: a simple, interpretable outcome-based check) and equalized odds difference (comparing true-positive and false-positive rates across groups: a more nuanced check that catches a model treating groups differently in HOW it errs, not just how often it approves). Using both matters because they can disagree: a model can have near-identical approval rates across groups (passing disparate impact) while still having very different error PATTERNS by group (failing equalized odds).
- Computing online with partial labels: disparate impact needs no labels at all (it's computed purely from the approval decisions themselves), so it can run in near-real-time; equalized odds needs eventual ground truth (did the loan actually default or not), so it necessarily lags: run it on the most recent FULLY-labeled cohort, the same maturation-buffer discipline used for any delayed-label metric.
- Handling missing or noisy sensitive-attribute data: under privacy constraints, self-reported demographic data is often incomplete; use proxy-based estimation methods (like Bayesian Improved Surname Geocoding for estimating race/ethnicity from name and location) WHERE LEGALLY AND ETHICALLY APPROPRIATE for fairness monitoring specifically, clearly distinguished from using such proxies for any actual DECISION-making, which is a different and much higher-stakes use.
- Surfacing regressions without over-alerting: apply the same statistical discipline as any other monitoring metric: require a fairness-metric shift to be both meaningfully large AND sustained across multiple evaluation windows before escalating to a human review, rather than paging on every day's natural small fluctuation in group-level approval rates (which, especially for a smaller protected-group population, can be genuinely noisy at a daily granularity purely from sample-size effects).
- Acting on a detected issue: a confirmed fairness regression should trigger a defined response: human review of the affected decisions FIRST, with model rollback or retraining as the response only once the cause is understood, mirroring the same diagnose-before-act discipline as any other quality regression.
Worked example
Concretely: if disparate impact ratio for a protected group drops from a stable historical baseline of 0.85 to 0.65 (a meaningful, business-relevant drop under common regulatory guidance, which often treats ratios below 0.80 as requiring scrutiny) and stays there for 3 consecutive daily evaluations (not a single noisy day), that combination: large magnitude AND sustained: triggers escalation to compliance and a human review of a sample of the affected decisions, rather than an automatic model action, since a fairness finding needs human judgment about root cause before any automated remediation is appropriate.
Trade-offs & pitfalls
The tension between metric sensitivity and sample-size noise is sharper here than for most monitoring metrics: a small protected-group population can produce a genuinely noisy daily ratio purely from limited sample size, and an alerting scheme too sensitive to that noise trains reviewers to distrust fairness alerts specifically, which is a worse outcome than under-alerting given how consequential a REAL fairness regression is; the sustained-window requirement exists specifically to manage this trade-off responsibly.
You inherit a legacy ML codebase with no tests, and models that are not reproducible. Produce a plan to restore confidence for safe deployments: the first tests you would add, the CI changes you would make, the data-validation gates you would introduce, and a safe deployment strategy you would put in place before trusting this codebase with production traffic again. Distinguish what you would prioritize in the first sprint from what you would spread across the following quarter.
Sample Answer
Direct answer
Do not start by writing a large test suite. Start by making the pipeline reproducible, because an untested pipeline that also is not reproducible means any test you write next cannot be trusted either, a failure could be the bug or could just be run-to-run noise. The order is: pin reproducibility first, add a thin layer of the highest-value tests, wire those into continuous integration (CI, the system that automatically runs checks on every code change) as a hard merge gate, add data-validation gates at the pipeline's entry points, and only then trust the result enough to deploy, starting from a shadow deployment rather than jumping straight back to full production traffic. The first sprint buys just enough of each of those to stop active bleeding; the rest of the quarter builds out the depth.
Structured elaboration
The first tests to add, in priority order.
- A reproducibility test. Train (or run inference on) a fixed, pinned data snapshot twice with the same explicit seed and assert the two runs produce identical or near-identical output. This has to come before every other test, because a test suite layered on top of a non-reproducible pipeline produces flaky results that look exactly like real bugs, and nobody can tell the difference without this check existing first.
- An end-to-end smoke test. Run the full training pipeline against a tiny fixture dataset (a few dozen rows, not the real data) and assert it completes without crashing, within a bounded resource budget. This catches the most common inherited-codebase failure mode, that the pipeline simply cannot run cleanly end to end anymore, before investing in anything more detailed.
- A golden-file regression test. Freeze the current model's predictions on a fixed validation set as a recorded baseline, and assert that any future change stays within a small tolerance of that baseline unless the change is an intentional retrain. This is what actually catches an accidental behavior change introduced by a refactor, which is the single most common way a legacy codebase silently breaks itself further.
- Unit tests on the highest-risk transformations. Given a known input, assert a known expected output, targeted specifically at label computation, join-key logic, and any feature with an obvious opportunity for leakage (a feature that could see information from after the label's outcome time). These are cheap, fast, and catch a large fraction of real defects for the effort involved.
CI changes. Every one of the tests above becomes a required, blocking check on every pull request, not an optional or manually-run script. Alongside that: pin every dependency version in a lockfile and pin the exact container or environment image the pipeline runs in, so "it works on my machine" stops being able to explain a discrepancy. Add a separate, scheduled (for example nightly) full-pipeline run against a larger held-out dataset than the fast per-change checks use, since some defects only show up at realistic data scale or after enough wall-clock drift in upstream systems. Every CI training run should automatically log its code commit, data version, and resulting metrics to a shared experiment-tracking store, so there is a trustworthy record of what actually ran, rather than relying on someone's memory or a spreadsheet.
Data-validation gates. Schema validation at ingestion (types, required fields, allowed value ranges) rejects a malformed batch before it ever reaches training. A distribution check compares each incoming batch's key feature distributions against a stored reference and flags anything that has drifted past a threshold, catching an upstream pipeline change before it silently degrades the model. A primary-key uniqueness and duplicate-row check on the training set catches the common bug where a join fans out and silently duplicates rows, inflating the apparent size and skewing the trained model toward the duplicated segment. A leakage-audit checklist, applied to every new or changed feature, requires writing down the exact timestamp each feature becomes known and confirming it is strictly before the prediction time, run as a required gate rather than an optional code-review suggestion.
Safe deployment strategy. Because none of the above exists yet at the start, do not go back to serving full production traffic once the code technically runs again. Start with a shadow deployment: the "repaired" pipeline scores real production traffic in parallel with whatever is currently serving, its predictions are logged and compared, but never returned to a user. Once the shadow comparison shows agreement with the current production behavior on the metrics that matter (or, if the goal is to fix a known regression, shows the expected improvement without new failure modes), move to a small-percentage canary with an explicit, automated rollback trigger tied to the same golden-file and data-validation checks used in CI, then ramp progressively. Skipping straight to canary or full traffic on a codebase with zero prior trust in its own outputs defeats the entire point of doing this work.
Sprint versus quarter.
| first sprint (stop the bleeding) | rest of the quarter (build the depth) | |
|---|---|---|
| reproducibility | pin seeds, pin data snapshot, pin environment/dependency versions | extend pinning to every pipeline stage, including any distributed or multi-worker paths |
| tests | reproducibility test, smoke test, one golden-file regression test | full unit-test coverage of feature transforms, integration tests across pipeline stages |
| CI | wire the sprint-1 tests in as blocking gates | add the scheduled full-scale nightly run, automatic experiment-tracking logging |
| data validation | schema validation at ingestion | distribution-drift checks, leakage-audit checklist as a required gate, duplicate/key checks |
| deployment | stand up the shadow deployment against current production | automate canary ramp-up with rollback tied to the golden-file and validation checks |
Worked example
The reproducibility test from priority item 1, run against the actual inherited pattern versus the fix, on a pinned four-value input array [1.0, 2.0, 3.0, 4.0]:
import numpy as np
# The global seed is pinned here ONLY so this demonstration reproduces for a
# reader. It does not fix the bug: legacy_train still draws from the shared
# global state, so two consecutive calls advance that state and disagree.
np.random.seed(1)
def legacy_train(data):
# BUG: draws from whatever the global numpy RNG state happens to be, no local seed
weights_init = np.random.randn(4)
return float((weights_init * data).sum())
def fixed_train(data, seed):
rng = np.random.default_rng(seed)
weights_init = rng.standard_normal(4)
return float((weights_init * data).sum())
def reproducibility_test(train_fn, **kwargs):
data = np.array([1.0, 2.0, 3.0, 4.0])
a = train_fn(data, **kwargs)
b = train_fn(data, **kwargs)
print(f" run A = {a:.6f}, run B = {b:.6f}")
return bool(np.isclose(a, b, atol=1e-12))
print("legacy_train (unseeded, shared global RNG):")
print(" reproducibility test passes:", reproducibility_test(legacy_train))
print("fixed_train (local generator, seed=84):")
print(" reproducibility test passes:", reproducibility_test(fixed_train, seed=84))
Output:
legacy_train (unseeded, shared global RNG):
run A = -5.475557, run B = -1.548062
reproducibility test passes: False
fixed_train (local generator, seed=84):
run A = -5.201353, run B = -5.201353
reproducibility test passes: True
Against legacy_train the two runs are -5.475557 and -1.548062, not identical, so the test correctly FAILS against the actual defect. The identical test against fixed_train(data, seed=84) gives -5.201353 twice, so it correctly PASSES once the fix (a locally-seeded generator, no dependence on global state) is applied. Note what pinning the global seed at the top does and does not buy: it makes this demonstration reproducible across processes, and legacy_train STILL fails, because two consecutive calls advance the shared global state and the second one therefore sees different numbers than the first. A global seed is not a substitute for a local generator. That the same test fails on the real bug and passes on the real fix is what makes it trustworthy as the first gate; a reproducibility test that would pass either way would give false confidence.
Trade-offs and pitfalls
- Writing broad test coverage before reproducibility is a common wrong turn. A large test suite bolted onto a non-reproducible pipeline just produces a large number of flaky tests, which trains the team to ignore CI failures, the opposite of the goal.
- The golden-file tolerance has to be chosen deliberately. Too tight, and every legitimate retrain trips the check and gets ignored; too loose, and it stops catching real regressions. Tie the tolerance to the same significance reasoning used for any other model-comparison decision, not an arbitrary round number.
- Schema and drift gates need an escape hatch. A hard block on every ingestion anomaly will eventually block a legitimate business change (a genuinely new customer segment, a new product line); pair automatic gating with a fast, logged manual override path rather than a check nobody can bypass under real time pressure.
- Shadow deployment takes real calendar time before any canary traffic can start, and stakeholders under pressure to "just ship the fix" will push to skip it; the cost of skipping it is exactly the risk this whole plan exists to remove, so it is worth naming explicitly rather than quietly dropping under pressure.
- Trying to do all of this in the first sprint instead of triaging is the other common wrong turn. A senior answer explicitly sequences the work (reproducibility and the cheapest high-value tests first, breadth and automation across the quarter) rather than treating the whole list as one undifferentiated backlog.
You have thousands to millions of candidate features (for example automatically generated crosses, n-grams, or embeddings) and a strict compute budget. Design a scalable feature-selection pipeline that gets you from that candidate pool down to a production-worthy set, addressing how you'd preserve interpretability and reproducibility of the final selected set. Also cover the specific case where the goal is to reduce feature computation cost and latency while holding an accuracy SLA - what would you try first, and why?
Sample Answer
Direct answer: Selecting from a huge candidate pool under a compute budget is a staged-filtering problem, not a single-algorithm problem: cheap, fast filters eliminate the bulk of obviously-useless candidates first, and progressively more expensive methods are only applied to the much smaller survivor set, so you never pay wrapper-level cost on the full candidate pool.
Structured elaboration:
A practical staged pipeline:
- Free/near-free filters first: drop near-zero-variance or quasi-constant columns (a column where one value dominates almost every row carries almost no signal), and drop anything failing a basic missingness or schema sanity check. This alone often eliminates a large fraction of a huge automatically-generated candidate pool at negligible cost.
- Cheap univariate scoring (mutual information, correlation, a fast statistical test) on what remains, run in parallel/distributed since it's embarrassingly parallel per feature.
- Redundancy removal: cluster features by pairwise correlation and keep one representative per cluster, since two near-duplicate features waste selection budget without adding signal.
- Sampled or lightweight model-based importance on the reduced set (a fast model on a data sample, not the full expensive model on full data) to get a final ranked shortlist.
- Only at this much-reduced scale would a genuinely expensive wrapper search (or the production model itself) be used to make the final cut.
Preserving interpretability and reproducibility means logging which stage eliminated each candidate and why, so the final set can be explained and the pipeline re-run deterministically, not just treated as a black box that spits out a list.
Worked example: Consider a specific cost-constrained variant of the same problem: a model already meets its accuracy SLA (service-level agreement) but feature computation is too expensive. The search here is inverted: instead of maximizing accuracy under a feature-count budget, you're minimizing feature-computation cost subject to NOT breaking the accuracy SLA, using greedy ablation (drop the least-important feature, retrain, check the SLA still holds, repeat) or importance-based pruning from the bottom up, with a held-out set to make sure you're not overfitting the pruning search itself to one data split.
Trade-offs and pitfalls: The variance-threshold-style fast filters have a real failure mode worth knowing: a rare-but-highly-predictive one-hot column (present in only 0.1% of rows but perfectly separating a rare, high-value class) looks like "near-zero variance" to a naive threshold and gets dropped, even though it may be the single most valuable feature in the set. A blind variance cutoff should always be checked against target-correlation, not applied in isolation.
Explain the difference between liveness and readiness probes in Kubernetes and give a concrete example of how you would configure each for an ML inference container that takes significant time to load a model at startup and serves requests afterwards. Describe what happens if these probes are misconfigured in a production cluster.
Sample Answer
Liveness vs Readiness (brief):
- Liveness probe: answers “Is the container alive or should Kubernetes restart it?” Use to detect deadlocked or crashed processes.
- Readiness probe: answers “Is this pod ready to serve traffic?” Used by Service/Endpoints to add/remove pod from load balancing.
Concrete example for an ML inference container that loads a large model at startup:
- Readiness: should be false until model fully loaded (so traffic isn’t sent while warm-up happens).
- Liveness: should allow longer startup time to avoid killing the pod while it’s loading; once running, ensure the process hasn’t hung.
Example YAML snippets:
# readiness: check model-loaded endpoint
readinessProbe:
httpGet:
path: /health/ready # returns 200 only after model loaded
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
failureThreshold: 1
timeoutSeconds: 2
# liveness: simpler, less aggressive, allow long startup
livenessProbe:
httpGet:
path: /health/live # returns 200 if process responsive
port: 8080
initialDelaySeconds: 120 # allow model load time
periodSeconds: 30
failureThreshold: 3
timeoutSeconds: 2
What happens if misconfigured:
- Readiness too quick/incorrect: pod receives traffic before model ready → request failures, high latency, user errors.
- Readiness too strict: pod never becomes ready → traffic never reaches it, reduced capacity.
- Liveness too aggressive (short initialDelay): kubelet restarts pod during model load → crash loop, degraded availability.
- Liveness too lax: dead process not detected → stale/failed pods remain serving bad responses.
Best practices: expose explicit endpoints for ready vs live, tune initialDelaySeconds to realistic model load times, implement a small warm-up health check that confirms model inference works (e.g., a cheap dummy prediction).
Search Results
DoorDash Machine Learning Engineer Interview - Datainterview.com
3.4 Behavioral Questions · Why do you want to work at DoorDash? · Tell me about a recent program you worked on. · Tell me about your biggest failure. · Tell me ...
DoorDash ML Engineer Interview Guide & Salary Overview
Expect questions that simulate building an ML pipeline from scratch—covering ingestion, model training, real-time inference, and monitoring. You ...
Top DoorDash Interview Questions for Software Engineers
What would you like to improve about an app that you use regularly? · How do you stay up-to-date on the latest trends in the industry? · What is ...
ML Engineer Secrets: Your toughest problem at Doordash?
Other interview questions for the Doordash Machine Learning. How do you handle conflict resolution in a high-stress work environment? 226.1K views.
Top 30 Most Common DoorDash LeetCode Interview Questions You ...
Top 30 Most Common DoorDash LeetCode Interview Questions You Should Prepare For · 1. How do you find the shortest distance from gates to empty cells in a grid?
Interviewing at DoorDash (2025) - Exponent
Interview Questions · What's your favorite product and why? · Design a system to track reviews abuse on Amazon.com. · You're a PM for Spotify. How would you ...
Doordash AI Engineer Interview Questions - Refer Me
This interview focuses on the candidate's ability to drive impact, make data-driven decisions, and execute tasks quickly in a high-velocity environment. AI ...
This interview preparation guide was generated using AI-powered research from the sources listed above. While we strive for accuracy, we recommend verifying critical information from official company sources.
Want to create your own tailored preparation guide using our deep research?
Get Started for FreeInterview-Ready Courses
Visual-first, interactive, structured learning paths