DoorDash Applied Scientist (Mid-Level) Interview Preparation Guide
DoorDash's Applied Scientist interview process evaluates your ability to conduct applied research, develop novel ML algorithms, and implement solutions that solve real business problems at scale. The process progresses from initial screening through technical validation to comprehensive onsite assessment, with emphasis on production impact, cross-functional collaboration, and end-to-end ownership of research-to-deployment pipelines. For mid-level candidates, expect balanced evaluation across applied ML fundamentals, system design thinking, coding proficiency, and research communication skills.
Interview Rounds
Recruiter Screening
What to Expect
Initial phone conversation with DoorDash recruiter lasting approximately 30 minutes. This round assesses your background, motivation for the role, and alignment with DoorDash's mission. The recruiter will explore your experience with applied ML, the scale of systems you've worked on, and how your research background maps to DoorDash's marketplace challenges. They will probe for evidence of end-to-end ownership—not just research in notebooks, but actual deployment and monitoring of models in production. For mid-level candidates, they evaluate whether you've moved beyond purely academic work into practical applications.
Tips & Advice
Be explicit about production impact. Avoid vague statements like 'I developed an ML model'; instead say 'I developed a fraud detection model that reduced false positives by 15% and decreased fraud loss by $2M annually, then monitored its performance across 50+ merchants.' Prepare a 2-minute narrative of your strongest applied ML project emphasizing the business problem, your research contribution, implementation challenges, and measurable outcomes. Connect your experience directly to DoorDash's three-sided marketplace (dasher, consumer, restaurant/store). Show curiosity about DoorDash's technical challenges in real-time delivery, fraud prevention, and personalization. Research DoorDash's recent tech blog posts or papers to demonstrate genuine interest.
Focus Topics
Communication of Technical Work
Ability to explain complex ML/research concepts clearly to non-technical audiences. Demonstrated experience presenting findings, defending design choices, and making technical decisions transparent to stakeholders.
Practice Interview
Study Questions
Relevant Domain Experience
Background in problems adjacent to DoorDash's challenges: logistics optimization, real-time systems, fraud detection, ranking/personalization, or marketplace dynamics. Understanding of supply-demand balancing, multi-stakeholder optimization, or time-sensitive decision-making.
Practice Interview
Study Questions
Production ML Experience & End-to-End Ownership
Demonstrate experience taking ML projects from research through deployment, including model monitoring, performance tracking, and operational decision-making in production systems. Emphasize how you owned the entire lifecycle rather than only offline experimentation.
Practice Interview
Study Questions
Applied Research Impact Quantification
Ability to articulate business metrics (fraud reduction, accuracy improvement, latency decrease, cost savings) that your research enabled. Quantify changes in terms a non-technical stakeholder understands (revenue impact, customer satisfaction, operational efficiency).
Practice Interview
Study Questions
Technical Phone Screen
What to Expect
A 60-minute technical interview conducted via video call, typically on a shared coding platform. This round assesses core coding fundamentals and ML problem-solving ability. Most mid-level candidates encounter a coding-focused session with 1-2 medium-difficulty algorithmic problems that reflect real DoorDash constraints (e.g., graph traversal for routing, scheduling for batch assignment, stateful services for real-time systems). Some teams may substitute this with a deep dive into a prior ML project, discussing architecture, training pipeline, feature engineering, and production considerations. The interview evaluates whether you can write clean, efficient code under time pressure and think through edge cases relevant to production systems.
Tips & Advice
Practice 30-40 medium-difficulty LeetCode-style problems emphasizing graph algorithms, dynamic programming, sorting/searching, and heap-based data structures. Focus on problems with real-world constraints: minimum cost routing, job scheduling, batch assignment, or real-time state management. During the interview, talk through your approach before coding: clarify the problem, state assumptions, and discuss time/space complexity. After coding, discuss edge cases explicitly (empty inputs, duplicates, boundary conditions) and how your solution scales under DoorDash's real traffic (millions of users). If offered a project deep-dive instead, prepare to explain your ML system's architecture, training pipeline, feature engineering decisions, how you validated model performance, and what you learned in production that differed from offline evaluation.
Focus Topics
ML Project Deep-Dive (Alternative Track)
If offered instead of traditional coding: detailed walkthrough of a significant ML project you've built. Explaining problem formulation, data pipeline, feature engineering, model selection, validation strategy, deployment approach, and post-deployment monitoring/learnings.
Practice Interview
Study Questions
Real-World Constraint Optimization
Thinking through how algorithms behave under production constraints: latency budgets, throughput requirements, memory limitations, and real-time processing demands. Demonstrating awareness of trade-offs between accuracy, speed, and cost.
Practice Interview
Study Questions
Code Quality & Communication
Writing readable, well-structured code with clear variable names. Explaining code logic step-by-step, discussing test cases proactively, and receiving feedback gracefully. Demonstrating ability to iterate and improve under interviewer guidance.
Practice Interview
Study Questions
Algorithmic Problem-Solving (LeetCode Medium)
Proficiency solving medium-difficulty coding problems covering arrays, graphs, dynamic programming, heaps, and data structures. Ability to optimize for both time and space complexity with clear explanations of trade-offs.
Practice Interview
Study Questions
Onsite Round 1: Applied Machine Learning System Design
What to Expect
A 60-90 minute whiteboard or shared-doc interview focusing on designing an ML system that solves a real DoorDash problem. You will be presented with a business challenge (e.g., 'Design a fraud detection system for merchants,' 'Build a delivery time estimation model for real-time routing,' or 'Create a personalization system for restaurant recommendations') and asked to propose an end-to-end ML solution. The interviewer expects you to define the problem clearly, identify metrics for success, propose a feature engineering approach, discuss model selection trade-offs, address real-time inference requirements, and consider feedback loops. For mid-level candidates, depth in one area (e.g., thoughtful feature engineering or latency optimization) combined with awareness of the broader system is valued more than shallow coverage of everything.
Tips & Advice
Start by asking clarifying questions: What is the business goal? Who are the users? What are latency, throughput, and accuracy requirements? State your assumptions explicitly before proposing solutions. Structure your answer around: (1) Problem formulation and metrics, (2) Data pipeline and feature engineering, (3) Model architecture and training approach, (4) Real-time inference and serving, (5) Monitoring and feedback loops. For mid-level roles, show depth in 1-2 areas: perhaps excel at feature engineering with concrete examples, or discuss latency/cost trade-offs thoughtfully. Use sketches or pseudocode to clarify architecture. Expect trade-off questions: accuracy vs. latency, feature richness vs. computational cost, model complexity vs. maintainability. DoorDash values clear thinking about multi-stakeholder balance (dasher income, consumer experience, merchant success, platform sustainability). Prepare examples from your own projects where you made such trade-offs and explain your reasoning. Be ready to discuss how you'd validate the system: offline metrics, A/B testing strategy, guardrails, and how you'd handle failures.
Focus Topics
Monitoring, Feedback Loops & Production Iteration
Designing systems to detect model drift and performance degradation. Creating feedback mechanisms to continuously improve models. Planning how to handle model failures gracefully. Discussing A/B testing strategy to validate improvements.
Practice Interview
Study Questions
Real-Time Inference & Serving Constraints
Understanding latency budgets and how they constrain model design. Designing inference pipelines that meet strict response time requirements. Discussing batch vs. real-time processing, caching strategies, and fallback approaches when models are unavailable.
Practice Interview
Study Questions
Model Selection & Architecture Trade-offs
Choosing appropriate model types (linear, tree-based, deep learning) based on problem constraints and data characteristics. Understanding when simpler models are preferable. Discussing trade-offs: model complexity vs. interpretability, training speed vs. accuracy, serving latency vs. model sophistication.
Practice Interview
Study Questions
Feature Engineering & Data Pipeline Design
Designing efficient, scalable feature pipelines. Identifying relevant features from user behavior, transaction history, and context. Considering feature freshness requirements, computational feasibility, and data quality issues. Proposing approaches to feature computation in real-time vs. batch contexts.
Practice Interview
Study Questions
Problem Formulation & Metrics Definition
Ability to translate vague business challenges into concrete ML problems. Identifying appropriate success metrics from multiple perspectives (user, business, operational). Understanding why different stakeholders care about different metrics in marketplace contexts.
Practice Interview
Study Questions
Onsite Round 2: Applied ML & Research Implementation
What to Expect
A 60-90 minute interview typically conducted as a coding or algorithm design exercise focused on implementing an ML-related technical component. You might be asked to implement a key part of an ML system (e.g., code a feature engineering pipeline, implement a ranking algorithm, build a simple recommendation system, or debug a production ML issue). Alternatively, this could be a research problem: 'How would you design an experiment to test a new fraud detection feature?' or 'Propose an algorithm to optimize delivery batching.' The focus is on your ability to move from concept to implementation, handle real-world messy data, and think through edge cases. Mid-level candidates should demonstrate solid coding ability combined with pragmatic thinking about data quality and model validation.
Tips & Advice
If given a coding task: write clean, modular code that handles edge cases (missing data, duplicates, boundary conditions). Explain your approach before diving into implementation. Discuss time/space complexity and how your solution would scale. If given a research design problem: start by clarifying the hypothesis, then discuss experiment design (randomization, sample size, metrics, duration, guardrails). For mid-level candidates, showing one area of depth is more important than surface coverage. If implementing a recommendation system, go deep on the ranking algorithm. If designing a fraud detection feature, discuss how you'd validate it doesn't harm legitimate merchants. Expect follow-up questions: 'How would you implement this efficiently?' 'What could go wrong?' 'How would you test this?' Prepare to discuss how you've handled production data quality issues in prior work—missing values, outliers, distribution shift.
Focus Topics
Debugging & Iteration
Ability to debug ML systems systematically. When a model underperforms, knowing how to investigate: data issues, feature problems, implementation bugs, or fundamental approach limitations. Iterating on solutions based on observations.
Practice Interview
Study Questions
Data Handling & Quality Assurance
Writing robust code that handles real-world data quality issues. Implementing data validation checks, outlier detection, and handling missing data. Understanding data pipelines and debugging data issues.
Practice Interview
Study Questions
Experimental Design & Validation
Designing experiments to test research hypotheses. Planning A/B tests, choosing metrics, determining sample sizes, and thinking through confounding variables. Understanding statistical significance and practical significance. Discussing how to safely test changes in production.
Practice Interview
Study Questions
ML Algorithm Implementation
Ability to implement core ML algorithms or system components from scratch or extend existing code. Writing efficient code for feature computation, model inference, or data processing. Handling practical data issues (null values, outliers, data validation).
Practice Interview
Study Questions
Onsite Round 3: ML Fundamentals & DoorDash Domain Knowledge
What to Expect
A 60-minute interview diving into ML concepts, statistical foundations, and your understanding of DoorDash's specific challenges. Expect questions like: 'Explain how you'd approach developing a model for [specific DoorDash problem],' 'What are the assumptions of logistic regression and when do they fail?', 'How do you detect and handle class imbalance?', 'Walk me through your process for feature selection,' or 'Describe a time when your model failed in production and how you debugged it.' This round tests both ML fundamentals (understanding when methods work and when they break) and practical domain knowledge specific to real-time delivery, fraud detection, personalization, or marketplace dynamics. The interviewer also probes your learning approach: how do you stay current with research? What papers or techniques have you learned recently and applied?
Tips & Advice
Review fundamental ML concepts deeply: regularization, cross-validation, class imbalance, feature scaling, hyperparameter tuning, bias-variance trade-off, and common pitfalls. Understand these not just theoretically but through practical examples from your work. Prepare 2-3 stories about times models failed or performed unexpectedly—explain what went wrong, how you debugged, and what you learned. Familiarize yourself with DoorDash's business model: how do they make money? What are key marketplace dynamics? What would break the business? Understand the perspective of three stakeholders: Dashers (drivers) care about earning and work flexibility; consumers care about speed and value; restaurants care about order volume and operational burden. Models that optimize one stakeholder often hurt others. Prepare to discuss papers or techniques you've learned recently and how you might apply them to DoorDash problems. Stay current: mention a recent machine learning paper, conference talk, or technique you've studied (even if you haven't deployed it yet). For mid-level candidates, deep understanding of a specific domain (e.g., deep expertise in recommendation systems, fraud detection, or time-series forecasting) is valuable.
Focus Topics
Research Learning & Current Techniques
Ability to learn new techniques from papers, blogs, or conferences and assess their applicability. Understanding when to apply cutting-edge methods vs. proven techniques. Communicating what you've learned and how you'd test novel approaches.
Practice Interview
Study Questions
Feature Engineering Best Practices
Systematic approach to feature selection and engineering. Understanding feature interactions, temporal features for time-sensitive problems, handling high-cardinality features. Knowing when features might leak information or create feedback loops.
Practice Interview
Study Questions
Production Failure Analysis & Debugging
Experience with models failing in production and systematic debugging approaches. Understanding common failure modes: data drift, concept drift, distributional shift, feedback loops, feedback loop collapse. Strategies for monitoring and detecting issues.
Practice Interview
Study Questions
ML Fundamentals & Statistical Methods
Deep understanding of core ML concepts: regularization (L1/L2), cross-validation strategies, handling class imbalance, feature scaling/normalization, hyperparameter tuning, bias-variance trade-off, overfitting vs. underfitting. Understanding assumptions, limitations, and failure modes of common algorithms.
Practice Interview
Study Questions
DoorDash Marketplace Dynamics & Multi-Stakeholder Optimization
Understanding how DoorDash's three-sided marketplace works. Recognizing trade-offs: optimizing for consumer satisfaction may hurt dasher earnings; maximizing dasher utilization may increase wait times; aggressive fraud detection may reject legitimate transactions. Knowledge of logistics optimization, supply-demand balancing, and real-time decision constraints.
Practice Interview
Study Questions
Onsite Round 4: Behavioral & Ownership Culture
What to Expect
A 45-60 minute behavioral interview assessing your alignment with DoorDash's culture, ownership mindset, and collaboration style. Expect questions using the STAR format (Situation, Task, Action, Result): 'Tell me about a time you made a trade-off under pressure,' 'Describe an incident where something went wrong—what did you do?', 'Give an example of how you influenced a cross-functional decision,' 'Tell me about a time you had to learn something new quickly.' The interviewer also probes your communication style: how do you present technical findings to non-technical audiences? How do you handle disagreement or pushback? For mid-level candidates, the focus is on growing ownership (you own projects end-to-end), mentoring junior colleagues (if applicable), and collaborating across teams (engineering, product, analytics). DoorDash values bias for action, learning from failure, and transparency.
Tips & Advice
Prepare 5-6 concrete stories using STAR format, including at least one about a production failure or incident. For each story: clearly describe the situation and the challenge you faced, explain the action you took (emphasizing your ownership and decision-making), and quantify the result when possible. DoorDash values bias for action—show times you moved forward with incomplete information or took calculated risks. Prepare examples of learning from failure: a model that didn't work as expected, a misaligned cross-functional project, or a time you were wrong and adjusted. These are often your strongest stories. For mid-level roles, highlight examples where you influenced team decisions, perhaps by presenting data or research findings that changed direction. If you've mentored junior colleagues or interns, prepare an example showing how you helped them grow. Practice articulating your findings clearly to different audiences: explain a complex technical concept to a product manager in 2 minutes, then to engineers in technical depth. Show how you'd handle pushback: 'When my fraud model flagged legitimate merchants, I listened to the merchant team's concerns, re-examined the data, and adjusted the threshold to balance fraud detection with merchant experience.' Communication structure matters: lead with the decision or action, not the technical details. Answer this structure: 'Here's the situation → I made this decision → this was the impact.' Avoid long technical tangents; keep focus on your judgment and impact.
Focus Topics
Bias for Action & Decision-Making Under Uncertainty
Making forward progress with incomplete information. Willingness to test ideas quickly and iterate. Balancing perfectionism with pragmatism. Knowing when to gather more data vs. when to decide and move.
Practice Interview
Study Questions
Communication & Storytelling
Ability to explain complex research findings to different audiences (technical and non-technical). Using data and visuals to support narratives. Adapting message depth based on audience. Handling questions and pushback gracefully.
Practice Interview
Study Questions
Cross-Functional Collaboration & Influence
Evidence of working effectively with engineers, product managers, and other stakeholders. Ability to align diverse groups around a shared goal. Influencing decisions through data and clear communication rather than authority. Resolving disagreements constructively.
Practice Interview
Study Questions
Learning from Failure & Iteration
Demonstrating resilience and systematic learning when projects fail. Ability to root-cause problems (technical or organizational), implement lasting fixes, and share learnings. Showing growth from setbacks without defensiveness.
Practice Interview
Study Questions
Ownership & Accountability
Demonstrating end-to-end ownership of projects: problem identification, solution design, implementation, deployment, and ongoing operations. Taking responsibility for outcomes, not just effort. Making decisions with incomplete information and defending those choices.
Practice Interview
Study Questions
Frequently Asked Applied Scientist Interview Questions
What are interaction features and polynomial features? Give one realistic example where an interaction term (the product of two features) improved model performance, and one example where adding many high-degree polynomial features harmed generalization. Explain the mechanism behind each outcome.
Sample Answer
Direct answer: An interaction feature is the product (or another combination) of two existing features, and a polynomial feature raises a single feature to a higher power; both aim to let a model that can only represent additive, linear relationships capture a joint or curved effect it otherwise couldn't, but both can also actively hurt generalization if applied without restraint.
Structured elaboration:
An interaction term (like price times discount rate) helps when the TRUE relationship genuinely depends on the combination of two variables together, not either alone: a discount's effect on purchase likelihood might be completely different at a high price point than a low one, a relationship a purely additive model (with price and discount as separate, unrelated inputs) structurally cannot represent. A high-degree polynomial feature can similarly let a model fit a curved relationship a linear model alone would miss.
Worked example: Adding price × discount_rate as an explicit feature lets a linear model represent that a 20% discount matters very differently for a $10 item versus a $10,000 item, an effect the two features alone (fed in separately) cannot capture no matter how they're weighted individually. Conversely, adding high-degree polynomial terms (price squared, price cubed, up through a high order) on a modest dataset commonly causes overfitting: the model fits increasingly wiggly curves that chase noise in the training data rather than the true underlying relationship, and generalizes poorly to new data specifically because there wasn't enough data to reliably estimate all those additional polynomial coefficients.
Trade-offs and pitfalls: The failure mode in both cases is the same at its root: adding flexibility (whether via an interaction or a higher-degree polynomial) without enough data to support estimating the added parameters reliably trades a small chance of capturing real additional signal against a much larger risk of fitting noise; regularization, feature selection after expansion, and simply testing whether the added terms actually help on a genuine holdout (rather than assuming more flexibility is free) are the standard guardrails.
You are fusing predictions from heterogeneous models (for example a tree-based model and a neural network) used together for a downstream decision. Describe approaches to calibrate and combine their outputs (stacking versus Bayesian model averaging), how uncertainty propagates through the fusion, and how you would validate that the fused output actually improves decisions under covariate shift.
Sample Answer
Approach summary
Start by treating each model as a probabilistic scorer (calibrate if needed), represent predictions plus uncertainty, then fuse using ensemble methods chosen by downstream decision objective (expected utility).
Probabilistic calibration
- Calibrate each model separately: isotonic regression or Platt scaling for classifiers; temperature scaling or beta calibration for NN; histogram/quantile mapping for tree ensembles.
- Validate calibration with calibration curve, Brier score, and expected calibration error (ECE).
Uncertainty propagation
- Capture aleatoric + epistemic: NN: MC dropout or ensembles; trees: predictive distributions via quantile regression forests or bootstrapping.
- Convert outputs to a common probabilistic form (e.g., predictive mean and variance). Propagate through decision function via analytic formulas if linear, otherwise Monte Carlo sampling to estimate downstream expected utility and risk.
Fusion methods
- Stacking: meta-learner trained on out-of-fold predictions; include model uncertainties and features; optimize directly for decision metric (e.g., cost-weighted loss).
- Bayesian Model Averaging (BMA): weight models by posterior model probability; use marginal likelihood or variational approximation; naturally accounts for uncertainty but higher compute.
- Hybrid: use BMA priors to regularize stacking weights or Bayesian stacking (optimize weights with Dirichlet prior).
- When decision utility is asymmetric, train fusion to maximize expected utility or CVaR.
Computational trade-offs
- Stacking (deterministic) is cheap at inference; requires O(N_meta) extra features and meta-model cost.
- BMA/MC sampling gives better uncertainty but costs M times base-model inference; mitigate with distillation or low-rank approximations.
- Use adaptive evaluation: cheap model first, run expensive model only on uncertain instances (gating).
Validation under covariate shift
- Simulate shifts via importance weighting, label shift correction, or create out-of-distribution holdouts. Use importance-weighted metrics to estimate real-world performance.
- Validate decisions with counterfactual or A/B tests where possible; measure downstream KPIs (expected utility, regret, cost savings), calibration under shift, and robustness metrics (worst-case loss).
- Monitor online: drift detectors on input features and on predicted uncertainty; recalibrate or reweight models when drift detected.
Example
- Tree (quantile forest) + NN: calibrate both, extract mean/var, run Bayesian stacking with Dirichlet prior, validate via importance-weighted expected utility under simulated shifts, deploy with gating to save compute.
This pipeline balances reliable probabilities, propagated uncertainty, computational cost, and real decision improvement under shift.
Describe how knowledge distillation could be adapted to distill across modalities (e.g., a vision teacher to a multimodal student) or across tasks (transfer learning). What loss terms and training signals would you include to preserve cross-modal knowledge during compression?
Sample Answer
Start by clarifying objectives: preserve the teacher’s cross-modal representations and task behaviour in a smaller/multimodal student. You want the student to (a) match teacher outputs (task-level), (b) align intermediate cross-modal embeddings (representation-level), and (c) keep alignment between modalities (cross-modal signals).
Recommended loss terms and signals:
- Task (logit) distillation: softened cross-entropy between teacher logits zT and student logits zS with temperature T. L_task = KL(softmax(zT/T) || softmax(zS/T)).
- Feature alignment: L_feat = ||ProjT(fT) − ProjS(fS)||^2 applied at key layers. Use small projection heads to map different dims.
- Cross-modal contrastive loss: InfoNCE between teacher’s vision embeddings and student’s language (or fused) embeddings to preserve cross-modal retrieval/alignment capabilities.
- Attention/activation matching: L_att = MSE between normalized attention maps or per-head activations to convey where the teacher “looks.”
- Token-level / patch-level distillation: for vision→multimodal, match per-patch/class-token embeddings so fine-grained spatial cues transfer.
- Auxiliary reconstruction: decode student embeddings back to teacher modality (e.g., reconstruct teacher image features) to retain modality-specific info.
- Ground-truth supervision: combine with original loss L_gt so student doesn’t overfit teacher mistakes. Total loss = αL_gt + βL_task + γL_feat + δL_contrastive + εL_att + ζL_recon.
Practical notes:
- Use projection heads and temperature tuning; weight terms via validation. If teacher and student modalities differ, train cross-modal adapters that translate embeddings before matching. For transfer-across-tasks, include task-specific heads and multi-task KD: distill logits and representations for each task, or use task-agnostic contrastive signals to keep general features.
- Curriculum: start with representation/contrastive losses, add task logits later to stabilize.
- Watch for negative transfer: monitor teacher errors, allow student to rely on ground truth when teacher is wrong (e.g., label smoothing or confidence-thresholded distillation).
This combination preserves both task performance and cross-modal alignment during compression.
Given a dataset where features include categorical IDs with high cardinality (millions of distinct values) and numerical behavioral features, propose three practical encoding strategies suitable for production and discuss trade-offs in model complexity and serving latency.
Sample Answer
Three production-friendly encodings:
- Hashing trick (feature hashing): map high-cardinality IDs into a fixed-size vector (e.g., 2^20 buckets). Pros: constant memory, simple, fast to serve. Cons: collisions may reduce signal; lacks learned similarity.
- Learned embeddings (embedding table): train low-dim embeddings per ID (embedding size 32–128) used by models (FFN or MLP). Pros: captures semantics, high accuracy. Cons: large memory for millions of IDs—requires sharding, memory store (Redis/Key-Value), or parameter servers; increased serving latency unless cached.
- Target encoding / frequency encoding: replace ID with statistics (mean label, count, smoothed) computed from historical data. Pros: compact numeric features, low latency. Cons: leakage risk—must use out-of-fold encoding and smoothing; may not capture complex relations.
Trade-offs:
- Model complexity: embeddings and target encodings enable richer models (neural nets) while hashing fits linear/GBDT with less complexity.
- Serving latency: hashing and target encodings are fastest. Embeddings need an efficient store or on-device cache to meet low latency; consider quantized embeddings or approximate lookups.
- Memory and operational cost: embeddings require memory/ops to manage updates and cold-starts; hashing is low maintenance.
Choose based on accuracy vs operational constraints; hybrid patterns (hashing for rare IDs, embeddings for top-K heavy hitters, target stats for others) often work well.
Implement a function that compares a recent (production) sample against a baseline (training or historical) distribution for a list of features and reports which features have drifted. Handle both numeric features (for example a Kolmogorov-Smirnov test) and categorical features (for example a chi-square test), and report per-feature missingness change alongside the distributional test. Discuss performance considerations for many features and large row counts.
Sample Answer
Direct answer. Detecting whether a production sample has drifted from a baseline distribution requires a test matched to each feature's TYPE, a numeric distributional test like Kolmogorov-Smirnov for continuous features and a chi-square test for categorical ones, run per feature, with a correction for the fact that testing many features at once inflates the chance of a false alarm somewhere.
Structured elaboration. For numeric features, the Kolmogorov-Smirnov test compares the full empirical distributions of the baseline and the sample without assuming any particular shape, which makes it a good general-purpose choice when you don't know in advance what kind of shift (mean, spread, skew) might occur. For categorical features, a chi-square goodness-of-fit test compares the sample's category proportions against the baseline's expected proportions. Missingness should be tracked SEPARATELY from the distributional test on the non-missing values, since a feature can have a stable distribution among the values it DOES have while its missing-rate silently climbs, a distinct and equally important failure mode a bare Kolmogorov-Smirnov (KS) or chi-square test on non-null values alone would miss entirely. With many features tested at once, apply a multiple-testing correction (Bonferroni divides the significance threshold by the number of tests) so the overall false-alarm rate across the whole feature set stays controlled, rather than letting a handful of features flag purely by chance.
Worked example (executed in Python with numpy/scipy). Comparing a numeric feature (avg_order_value, baseline mean 50, sample mean 58, 5,000 baseline rows vs 1,200 sample rows) and a categorical feature (region, unchanged mix in both): the KS test on avg_order_value returns statistic 0.309, p-value effectively 0 (well under a Bonferroni-corrected threshold), correctly flagging real drift; the chi-square test on region returns p=0.072, correctly NOT flagging it even without correction, since the region mix genuinely didn't shift in this synthetic example. Missingness delta for both features came back at 0.0, confirming the drift here is purely distributional, not a completeness issue.
Trade-offs and pitfalls. KS and chi-square are both sensitive to sample size: with a very large sample, even a practically trivial shift becomes statistically significant, so pair the p-value with an effect-size measure (like the KS statistic's magnitude itself, or a simple difference-in-means relative to the baseline's spread) rather than treating statistical significance alone as evidence of a PRACTICALLY important drift. For a streaming or very-large-feature-count setting, exact KS computation can be too slow; approximate quantile sketches or chunked/streaming variants trade a small amount of precision for the ability to run continuously rather than only on demand.
You have limited labeled data to validate a new real-time fraud-detection model. Present a decision framework for choosing between shipping a quick prototype to a small percentage of live traffic (a canary) versus building toward a full production rollout, including the metrics and risks of each path.
Sample Answer
Direct answer
With limited labeled data to validate a new fraud model, a small canary rollout is almost always the safer starting point over a full production launch, since it lets you gather real production evidence before committing to broad exposure, as long as the canary's blast radius is genuinely small and monitored closely.
Structured elaboration
- Canary approach. Ship to a small percentage of live traffic, closely monitor both model-level metrics (precision, recall against whatever confirmed labels arrive) and business-level guardrails (customer complaints, transaction friction), and expand gradually as confidence grows.
- Full-rollout approach. Faster to reach full business impact if the model works, but any undetected problem (a mis-calibrated threshold, a data issue that only shows up at scale) affects the whole business at once, which is a much larger risk given how little validation data exists.
- Metrics to track during the canary. Both the model's own precision and recall as confirmed labels trickle in, and the business cost signals (false-positive complaint volume, estimated fraud losses in the canary segment versus a comparable control segment) that would catch a real problem quickly.
- Risk of each path. The canary's main risk is a slower path to full value and the extra engineering work of running two populations differently; the full rollout's main risk is a costly, hard-to-reverse mistake at scale if the model behaves unexpectedly outside of what the limited validation data could show.
Worked example
Starting the canary at a small percentage of transactions, holding a comparable control segment on the existing system, and setting explicit graduation criteria (a defined number of days with no anomalous complaint spikes and precision holding within an acceptable range against confirmed labels) turns "when do we go full rollout" from a gut call into a pre-agreed, evidence-based decision.
Trade-offs and pitfalls
The common mistake is running a canary without a real control group or explicit graduation criteria, which leaves the team unable to say confidently when it's safe to expand. The other risk is treating the canary phase as a formality and expanding on a fixed timeline regardless of what the early data shows, which defeats the purpose of testing with limited validation data in the first place.
Compare strategies for handling missing values in a dataset used for reporting or modeling: dropping rows, simple statistical imputation (mean/median/mode), model-based imputation (KNN, MICE), an explicit "missing" category, and leaving values as-is for models that support NaNs natively. For each, describe the bias it can introduce into aggregates or downstream inference, and how the right choice depends on whether missingness is completely random, random conditional on other fields, or informative in its own right.
Sample Answer
Direct answer
Dropping rows, simple statistical imputation, model-based imputation, an explicit "missing" category, and leaving values as-is each introduce a different kind and amount of bias into downstream aggregates, and the right choice depends on how much data would be lost, whether the missingness itself carries information, and whether the consuming model or report can handle an explicit missing indicator natively.
Structured elaboration
- Dropping rows: unbiased only if missingness is completely random (MCAR); if missingness correlates with anything else in the data (MAR) or with the missing value itself (MNAR), dropping rows systematically removes a non-representative subset and biases every downstream aggregate, not just the missing column's own statistics.
- Simple statistical imputation (mean/median/mode): preserves sample size but artificially shrinks variance (every imputed value is identical, collapsing the natural spread) and can distort correlations between the imputed column and everything else, since the imputed value carries no relationship to the other fields in that row.
- Model-based imputation (KNN, MICE): KNN (K-nearest-neighbors imputation) fills a missing value using the average of that same field across the most similar other rows, similar meaning close on the other, non-missing features; MICE (Multiple Imputation by Chained Equations) iteratively models each incomplete column as a function of all the other columns, cycling through columns and refitting until the imputed values stabilize. Both better preserve relationships between features than simple imputation, since the imputed value is informed by similar records, but are more expensive to compute, harder to explain to a non-technical stakeholder, and can still introduce circularity risk if not done carefully.
- Explicit "missing" category: for categorical features, adding "missing" as its own valid category rather than imputing a value preserves the actual information (that it was missing) rather than manufacturing a value; for numeric features the closest analog is a paired missing-indicator flag alongside an imputed value. The bias this introduces into aggregates is different in kind from the other strategies: instead of shifting a mean or proportion, it changes what the aggregate is computed over. A "percentage of customers in category X" computed with missing kept in as its own bucket correctly reflects the true unknown rate, while the same statistic computed after silently excluding or imputing the missing rows will read differently, so any downstream aggregate has to decide explicitly whether "missing" counts as its own segment or gets excluded from the denominator, and getting that decision wrong is itself a source of bias.
- Leaving values as-is: only viable for models that natively handle NaN (some tree-based models do); for reporting and most other modeling contexts, this simply propagates missingness downstream unresolved. The bias risk here is not inside the model itself (a tree-based model can legitimately split on "is this value missing", which is often genuinely informative under MNAR) but in any aggregate computed outside that model: a plain
AVG()orSUM()over a column with NaNs left in typically skips those rows by default in most SQL and pandas implementations, which is silently equivalent to a row-drop strategy for that one aggregate even though no row was actually removed from the dataset, so "leaving as-is" defers the bias decision to whatever tool happens to compute the next aggregate, rather than eliminating it.
Worked example
Under MCAR (missing completely at random), mean imputation on a numeric column leaves the mean of the column mathematically unchanged (since the missing values were a random subsample, imputing the mean does not shift it) but understates the true variance, since every imputed value contributes zero deviation from the mean. Under MNAR, for example high-income respondents disproportionately skip an income question, mean imputation using only the observed (systematically lower-income) values produces a biased-downward mean estimate for the full population, and no amount of more sophisticated imputation on the observed data alone can fully correct this without an external signal about the true relationship between income and the propensity to skip the question. To make this concrete with an illustrative (invented for this example, not measured) population: suppose 100 survey respondents have a true full-population mean income of $60,000, and the 20 who skip the income question happen to average $92,000 while the 80 who answer average $52,000; the underlying arithmetic is internally consistent, (80 x $52,000 + 20 x $92,000) / 100 = ($4,160,000 + $1,840,000) / 100 = $60,000. Mean imputation only ever sees the 80 observed rows, so it fills each of the 20 missing values with $52,000, the observed mean, and the reported overall mean stays at $52,000, $8,000 short of the true $60,000, with nothing in the observed data alone signaling that a gap exists.
Trade-offs and pitfalls
The critical, easy-to-skip step is diagnosing which missingness mechanism (MCAR, MAR, MNAR) is actually present before picking a strategy, since the same imputation method that is nearly harmless under MCAR can introduce serious, hard-to-detect bias under MNAR. Treating imputation as a purely mechanical, one-size-fits-all step, applied without first checking whether missingness correlates with anything else in the data, is the single most common way this class of decision goes wrong.
You have a binary classification problem where the positive class is only 1% of the data. Describe at least five strategies (both data-level and algorithm-level) you would use to train, tune, and evaluate a robust model suitable for production, and explain which production metrics you would monitor.
Sample Answer
Brief framing
With 1% positives, goal is robust recall on positives while controlling false alarms and calibration for production decisions.
Data-level strategies
- Resampling: use stratified mini-batches and combine SMOTE or ADASYN for augmentation of minority class, but validate on original distribution.
- Targeted feature engineering: create signals that separate rare events (e.g., time-windowed aggregates, anomaly scores).
- Cost-aware cross-validation: use stratified k-fold with repeated runs to ensure rare positives appear in validation.
Algorithm-level strategies
- Class-weighting / focal loss: upweight positives or use focal loss to focus training on hard positives.
- Ensemble methods: stacked ensembles or calibrated bagging (e.g., balanced random forest, XGBoost with scale_pos_weight).
- Threshold optimization & calibration: tune decision threshold on precision-recall tradeoff and calibrate probabilities (Platt/ isotonic).
Evaluation & tuning
- Use PR-AUC, recall@fixed-false-positive-rate, and F2 (or business-weighted loss) for model selection; avoid accuracy and ROC-AUC alone.
- Use time-based holdout and conduct uplift / stability tests.
Production metrics to monitor
- Real-time: precision, recall, false positive rate, and alert volume.
- Calibration drift: Brier score or reliability diagram changes.
- Data drift: feature distribution and population shifts.
- Business KPIs: cost per true positive, downstream conversion, and latency.
These combined steps ensure robust training, appropriate risk trade-offs, and operational monitoring for a reliable production model.
Implement one classic sort algorithm from scratch (your choice of quicksort with in-place partitioning, merge sort, or counting sort for small-range integers). Explain why you chose that one for the input characteristics given, and what your partition or merge step's complexity is.
Sample Answer
Direct answer
For this kind of general, range-unknown input, I would implement randomized in-place quicksort: pick a uniformly random pivot at each partition step (to defeat adversarial or already-sorted inputs), partition with Lomuto's scheme, and always continue on the smaller of the two resulting partitions while deferring the larger one, which bounds recursion/stack depth to O(log n). Quicksort is the right default here over merge sort (which needs O(n) extra space) or counting sort (which needs a small, known key range).
Structured elaboration
Why quicksort for this input: it sorts in place (O(log n) extra memory instead of merge sort's O(n)), its sequential partition scan is cache-friendly and typically fastest in practice, and it makes no assumption about the range of the keys, unlike counting sort.
Partition step (Lomuto): move the pivot to the end, then walk the range once, swapping any element smaller than the pivot into a growing "less-than" prefix; finally swap the pivot into its correct final position.
Random pivot selection removes the classic O(n^2) worst case that a fixed first/last-element pivot suffers on already-sorted or reverse-sorted input.
import random
def quicksort_inplace(a: list[int], seed: int = 0) -> None:
"""
Randomized in-place quicksort with Lomuto partitioning.
Always recurses on the smaller side and loops on the larger side
(via an explicit stack) to bound auxiliary depth at O(log n).
"""
rng = random.Random(seed)
def partition(lo: int, hi: int) -> int:
pivot_idx = rng.randint(lo, hi)
a[pivot_idx], a[hi] = a[hi], a[pivot_idx]
pivot = a[hi]
store = lo
for i in range(lo, hi):
if a[i] < pivot:
a[store], a[i] = a[i], a[store]
store += 1
a[store], a[hi] = a[hi], a[store]
return store
lo, hi = 0, len(a) - 1
stack = [(lo, hi)]
while stack:
lo, hi = stack.pop()
while lo < hi:
p = partition(lo, hi)
left_size = p - lo
right_size = hi - p
if left_size < right_size:
stack.append((p + 1, hi))
hi = p - 1
else:
stack.append((lo, p - 1))
lo = p + 1
data = [5, 2, 9, 1, 5, 6, 3, 8, 2, 0, -4, 7]
quicksort_inplace(data, seed=42)
print(data)
data2 = []
quicksort_inplace(data2, seed=42)
print(data2)
data3 = [1]
quicksort_inplace(data3, seed=42)
print(data3)
Output:
[-4, 0, 1, 2, 2, 3, 5, 5, 6, 7, 8, 9]
[]
[1]
Key points: continuing inline on the smaller partition (via the loop) while pushing only the larger one onto the explicit stack is what bounds the stack's maximum size to O(log n), since each level you push at least halves relative to its parent range.
Worked example
The input [5, 2, 9, 1, 5, 6, 3, 8, 2, 0, -4, 7] (note the repeated values 5 and 2) sorts correctly to [-4, 0, 1, 2, 2, 3, 5, 5, 6, 7, 8, 9] with seed 42, as shown in the run above; the duplicate values are handled fine by Lomuto's plain "<" comparison, since equal elements simply land in the "not less than pivot" partition without needing any special casing.
Complexity
\text{space: } O(\log n) \text{ average}$$, bounded by the smaller-first recursion rule (without it, worst-case stack depth is $$O(n)$$). The partition step itself is $$O(hi - lo)$$, linear in the size of the range being partitioned, since Lomuto's scan touches every element in that range exactly once. ### Edge cases - **Empty input** (`[]`): the initial stack holds `(0, -1)`, so `lo < hi` is false immediately and the loop body never runs; sorts to `[]`, as shown in the run above. - **Single-element input** (`[1]`): `(0, 0)`, `lo < hi` is false immediately, returns unchanged. - **All-duplicate or many-duplicate input**: Lomuto's plain "<" test sends every equal element to the "not less than pivot" side, degrading toward $$O(n^2)$$; see "Many duplicates" below for the fix. - **Already-sorted or reverse-sorted input**: random pivot selection specifically defeats the classic $$O(n^2)$$ worst case that a fixed-pivot quicksort suffers on this input shape. ## Trade-offs & pitfalls - **Worst case**: O(n^2) is astronomically unlikely with a random pivot, since it would require an adversary who can predict your random seed, not just an adversary who controls input order. - **Stack depth**: the smaller-first rule guarantees O(log n) auxiliary depth even in the worst case; without it, an adversarial input can force O(n) recursion depth. - **Many duplicates**: Lomuto's plain "<" comparison degrades toward O(n^2) when most elements are equal, since every element goes to one side of the partition; 3-way (Dutch national flag) partitioning fixes this by giving equal elements their own middle section. - **Not stable**: equal elements can be reordered relative to each other; reach for merge sort instead if stability matters. - **When to prefer the alternatives**: counting sort wins when keys are small non-negative integers in a known bounded range (O(n+k) time, no comparisons at all); merge sort wins when guaranteed worst-case O(n log n) time or stability matters and the O(n) extra memory is affordable, such as external/on-disk sorting or sorting linked lists where in-place partitioning is awkward.You ran an A/A test and observed a 7% difference in conversion between the two identical groups with p=0.04. List the possible explanations for this surprising result, such as a broken hashing or salt scheme, covariate imbalance from a logging bug, or a genuinely low-probability chance event, and outline the concrete diagnostics you would run, in order, to determine which explanation is correct and what you would do next.
Sample Answer
Direct answer
A 7% conversion gap between two arms of an A/A test with p = 0.04 is surprising but not automatically evidence of a broken pipeline: with a conventional alpha, roughly 1 in 20 A/A tests will cross p < 0.05 by chance alone even with perfect randomization, so a single significant A/A result sits right at the boundary between noise and something worth investigating. The right response is a fixed sequence of diagnostics, cheapest and most mechanical first, that can positively confirm or rule out each concrete failure mode: broken hashing or salting in the assignment logic, a covariate imbalance introduced by a logging bug, or ordinary sampling variation.
Structured elaboration
Ordered diagnostics
- Reproduce on raw logs with a fixed seed. Re-run the exact analysis against raw exposure and outcome events, not a downstream aggregated table, to rule out an analysis or pipeline bug before suspecting randomization itself.
- Check the allocation ratio. Confirm the number of users landing in each arm matches the intended split; a large deviation from the intended ratio is one of the strongest and cheapest signals that the hashing or salting scheme is broken, and it is a distinct check from the 7% conversion gap itself. An experiment can have a balanced allocation and still show a spurious metric difference, or a skewed allocation and a metric difference that is actually the real symptom.
- Audit covariate balance, not just the topline metric. Compare the two arms on pre-experiment covariates that should be identical under correct randomization: browser type, geography, device, and signup cohort. If, for example, one arm has a meaningfully different browser or region mix, that points directly at the hashing or salting scheme, perhaps it is keyed on something correlated with browser or region rather than a clean user id, rather than at chance.
- Audit instrumentation and logging for the affected population, not just in aggregate. Check whether the difference is spread evenly across all users or concentrated in a specific segment, for example a subset of power users whose events are logged differently or who hit a code path that assigns or tags them incorrectly; a difference concentrated in one segment is far more consistent with a logging bug than with chance, since chance-driven noise does not usually cluster by user type.
- Check for multiple looks and multiple metrics. Confirm this is the primary metric and the first pre-registered look at the data; if the gap emerged after peeking at several days or several metrics, the effective false-positive rate is higher than the nominal 5% used to compute that p = 0.04.
- Re-run on an independent window if steps 1 to 5 find nothing. If every mechanical check comes back clean, run a fresh A/A on a new time window, not the same data re-sliced, before concluding the original result was real noise; a second clean A/A is much stronger evidence than reasoning about a single result in isolation.
Practical thresholds for concern
A single A/A test crossing the standard p < 0.05 threshold is expected roughly 1 in 20 times under correct randomization and is not, by itself, cause for alarm. Because allocation-ratio checks tend to run on every experiment in a mature program, many teams apply a stricter threshold specifically to that check, for example requiring p < 0.001 before treating a deviation as a real problem, because running a 0.05-threshold check on every one of hundreds of experiments would itself generate frequent false alarms. This is a practitioner convention for managing check-your-own-checks noise, not a statistical property being claimed as derived; teams calibrate the exact cutoff to their own experiment volume.
Worked example
Take the power-user logging-bug scenario concretely, with stated illustrative inputs. Suppose the population is 1,000,000 users, correctly randomized 50/50 by the underlying hashing scheme. Power users are 10% of the population (100,000 users), and a logging bug causes every power user's exposure event to be recorded under the control label regardless of which arm they were actually assigned to.
Non-power users (900,000) log correctly: 450,000 recorded as control, 450,000 recorded as treatment. Power users (100,000) all log as control regardless of true assignment.
Recorded control=450,000+100,000=550,000,Recorded treatment=450,000
Recorded split=55%:45%
A 55/45 recorded split against an intended 50/50 is a large, easily detectable sample-ratio deviation, exactly the kind of signal step 2 is designed to catch, and it would also explain a spurious conversion difference: if power users convert at a different rate than the general population, mislabeling all of them into "control" pulls the control arm's average toward the power-user rate and creates a gap that has nothing to do with the treatment itself.
Trade-offs and pitfalls
- Investigating every marginal A/A result exhaustively is expensive; teams running many experiments generally accept a small, known false-alarm rate rather than deeply diagnosing every borderline case, but should still run the cheap mechanical checks (steps 1 to 3) before shipping a launch decision built on top of infrastructure that produced a suspicious A/A.
- A clean allocation ratio does not prove randomization is unbiased end to end; a hashing scheme can produce a correct overall 50/50 split while still being correlated with a covariate, for example alternating by the last digit of a sequential user id, which can correlate with signup cohort. The ratio check and the covariate-balance check are complementary, not substitutes for each other.
- Re-running on a new window is the strongest single diagnostic but takes real calendar time, so it should be the last check, not the first, when cheaper log-based checks can often localize the problem faster.
- Concluding "just noise" without running the mechanical checks at all is itself a pitfall: an unresolved instrumentation bug found only after it has already contaminated a live experiment is far more costly than the time it takes to check allocation ratio and covariate balance up front.
Want to create your own tailored preparation guide using our deep research?
Get Started for FreeInterview-Ready Courses
Visual-first, interactive, structured learning paths
Browse Applied Scientist jobs
AI-enriched listings across hundreds of company career pages
Explore Jobs