KatInterview

practice a little every day — you've got this ♡

Machine Learning Interview Problems

Practice 5965 original coding, SQL, system design, machine learning and behavioral problems across 15 topics. Coding and SQL problems run against hidden test cases right in your browser; every problem has hints and a worked solution, free.

5965
Problems
2208
Auto-graded
15
Topics
271
Added today

Showing 1–30 of 510 results

  • Machine LearningHardModel answer
    On-Device Face Unlock for a Mobile Banking App at Scale

    Design a privacy-preserving, on-device face authentication system for a mobile app with tens of millions of users, covering models, evaluation, spoofing defenses, fairness, offline use and rollout.

    Machine Learningface-recognitionon-device-mlbiometricsanti-spoofing
  • Machine LearningEasyModel answer
    Evaluating a Text Classifier and Retriever: Metrics and Reporting

    Work through agreement, classification and ranking metrics, TF-IDF, reproducibility and model comparison for a document classification and search system, showing the arithmetic.

    Machine Learningevaluation-metricsnlprankingcohens-kappa
  • Machine LearningHardModel answer
    Designing an End-to-End Time-Series Forecasting Architecture

    Architect an end-to-end time-series forecasting solution covering data preparation, baseline and advanced models, multi-step strategies, non-leaky validation, and drift management.

    Machine Learningtime-seriesforecastingsystem-designmachine-learning
  • Machine LearningMediumModel answer
    Regional Weather Data: Metrics, Forward Selection, Online Slope

    Analyze multi-town daily temperature data: define volatility and similarity metrics, fit and validate a regression, run greedy town selection, and derive batch and streaming no-intercept slopes.

    Machine Learningregressiontime-seriesfeature-selectiononline-learning
  • Machine LearningMediumModel answer
    Tokenizer Trade-Offs and Reference-Regularized Fine-Tuning

    Analyze structural trade-offs in LLM subword tokenization and explain the mathematical role of KL constraints during model alignment.

    Machine LearningLLMTokenizationNLPFine-Tuning
  • Machine LearningMediumModel answer
    Design a Real-Time Sequential Music Slate Recommender

    Design an end-to-end sequential music recommendation engine that adapts dynamically to real-time user actions while delivering 10-track slates within 200ms P99 latency.

    Machine Learningrecommendation-systemssequential-recommendationreal-time-mlsystem-design
  • Machine LearningEasyModel answer
    Setting a Score Cutoff: Weighing Missed Positives Against False Alarms

    Explain how precision and recall shift as a classifier's score cutoff moves, and justify a production threshold given unequal error costs, limited capacity, and rare positives.

    Machine Learningprecision-recallclassification-thresholdimbalanced-datacalibration
  • Machine LearningHardModel answer
    Leak-Proof Preprocessing and Training Pipeline Design

    Design an end-to-end workflow that validates, cleans, splits, fits, and serves a model so that no statistic from held-out or future data influences training.

    Machine Learningdata-leakagepreprocessingpipelinesvalidation
  • Machine LearningMediumModel answer
    Production Pipeline for Predicting Subscriber Cancellation Within a Week

    Design, evaluate, monitor and roll out a weekly-horizon churn model on a shaky data foundation, covering leakage, time-aware validation, drift detection, retraining rules and fairness.

    Machine Learningml-pipelinechurn-predictiondata-leakagedrift-detection
  • Machine LearningMediumModel answer
    Tenant-Safe Next-File Suggestions with Live Permission Checks

    Design a low-latency recommender that proposes the next file a user will open while keeping each company's data isolated and respecting constantly changing file permissions.

    Machine Learningrecommender-systemsmulti-tenancyaccess-controlcold-start
  • Machine LearningEasyModel answer
    Trading Off Precision and Recall in Production Classifiers

    Decide when a product classifier should favor precision or recall, and explain how to set its decision threshold using error costs, capacity limits, class imbalance, and post-launch monitoring.

    Machine Learningprecision-recallthreshold-selectioncost-sensitive-learningclass-imbalance
  • Machine LearningMediumModel answer
    Mitigating Overfitting and Analyzing Mean Squared Error Loss

    A deep dive into diagnosing and fixing model overfitting alongside a statistical breakdown of Mean Squared Error loss and its alternative objectives.

    Machine Learningoverfittingregularizationloss-functionsregression
  • Machine LearningHardModel answer
    Debugging Custom Transformer Encoders and Classification Pipelines

    Diagnose subtle implementation errors in PyTorch multi-head attention blocks and build an end-to-end data analysis and model evaluation workflow.

    Machine Learningtransformersdeep-learningnlppytorch
  • Machine LearningMediumModel answer
    Build Multi-Head Attention in PyTorch Without Library Helpers

    Write a multi-head attention module from raw tensor ops: projections, head reshaping, scaled scores, masking, softmax, and output merge, plus cost and testing discussion.

    Machine Learningattentiontransformerspytorchmasking
  • Machine LearningMediumModel answer
    Data Quality Audit for Flight Delay Prediction Models

    Perform a comprehensive data quality audit, leakage check, and data contract design for an aviation dataset intended for delay prediction.

    Machine Learningdata-qualityfeature-engineeringdata-pipelinesmachine-learning
  • Machine LearningMediumModel answer
    Build a Linear Layer and Stable Softmax in NumPy

    Write a fully connected layer and a numerically stable row-wise softmax as Python classes in NumPy, paying attention to shapes, broadcasting and overflow.

    Machine Learningnumpyneural-networkssoftmaxbroadcasting
  • Machine LearningHardModel answer
    Designing Query, Key, and Value Vectors for Recommender Cross-Attention

    Explain and contrast Query-Key-Value representations for cross-attention mechanisms in candidate-aware recommendation systems.

    Machine Learningtransformersattentionrecommendation-systemsdeep-learning
  • Machine LearningHardModel answer
    Rapid-Fire ML Fundamentals Check for a Product Recommender

    Answer a set of short core machine-learning questions covering models, regularization, evaluation, optimization and ranking, framed around building a product recommendation system.

    Machine Learningmachine-learningfundamentalsregularizationevaluation
  • Machine LearningMediumModel answer
    Joint Image-Text Embeddings: Training, Losses, and Retrieval Pitfalls

    Explain how a dual-encoder image-text model is trained and used, compare contrastive losses, and discuss embedding retrieval weaknesses, alternatives, and popularity bias.

    Machine Learningmultimodalcontrastive-learningdense-retrievalpopularity-bias
  • Machine LearningMediumModel answer
    Building Dependable Tool-Using LLM Agents End to End

    Explain how an LLM agent invokes tools, keeps calls well-formed, recovers from bad calls, and stops runaway tool loops, with concrete engineering trade-offs.

    Machine Learningllm-agentstool-callingstructured-decodingreliability
  • Machine LearningHardModel answer
    Build and Validate a Multi-Step Sequence Forecaster in PyTorch

    Design an end-to-end forecasting pipeline for a noisy time series: frame the target, avoid leakage, choose a model, write a PyTorch training loop, and evaluate it with time-aware validation.

    Machine Learningtime-seriesforecastingpytorchleakage
  • Machine LearningHardModel answer
    Design a Citation-Verified RAG Assistant for Litigation Review

    Design a read-only, retrieval-grounded LLM system that summarizes case files, builds timelines, flags conflicting statements, and drafts briefs with verifiable citations and strong isolation.

    Machine Learningragllm-system-designprompt-injectioncitation-verification
  • Machine LearningEasyModel answer
    Building a Home Sale Price Estimator End to End

    Design a regression pipeline that estimates residential sale prices, covering missing data, categorical encoding, feature ideas, time-aware validation, metrics, and interpretability.

    Machine Learningregressionfeature-engineeringtime-series-validationtarget-encoding
  • Machine LearningEasyModel answer
    Build a Causal Multi-Head Attention Layer from Scratch

    Write a multi-head self-attention module with Q/K/V projections, scaled scores, and a causal mask so each token sees only itself and earlier tokens, then explain how it works.

    Machine Learningtransformersattentionpytorchcausal-masking
  • Machine LearningHardModel answer
    Designing an ML-Driven Workload Allocator for Delivery Drivers

    Design a system that forecasts stop service times with ML and feeds them to a constrained optimizer to split a shift's deliveries across drivers, balancing punctuality and fairness.

    Machine Learningoptimizationgradient-boostingcold-startdistribution-shift
  • Machine LearningMediumModel answer
    Two ML Cases: Predicting Flight Lateness and Screening Faces Against a Watchlist

    Design two ML systems end to end: a regression model forecasting flight departure lateness two hours out, and an open-set face-matching pipeline that flags watchlist individuals at a bank entrance.

    Machine Learningregressionlabel-leakagetime-series-validationimbalanced-classification
  • Machine LearningMediumModel answer
    Assess and Launch an Edge AI Predictive Maintenance Model

    Define evaluation criteria, data sampling plans, and rollout gates for introducing a machine learning feature on edge devices.

    Machine Learningproduct-metricsevaluationedge-computingmodel-launch
  • Machine LearningMediumModel answer
    Real-Time Harmful Content Screening for an Image-Sharing Platform

    Design an ML pipeline that screens uploaded images, captions and links for spam, phishing and unsafe imagery within a tight latency budget while keeping false positives low.

    Machine Learningml-system-designcontent-moderationclassificationclass-imbalance
  • Machine LearningHardModel answer
    Taming Gradient Decay in a 40-Layer Net and a 100-Step RNN

    Explain why gradients shrink or blow up with depth and time, and design a combined fix using activations, initialization, skip connections, normalization, and gated or attention-based sequence models.

    Machine Learningvanishing-gradientsinitializationresidual-connectionsnormalization
  • Machine LearningMediumModel answer
    Greedy vs. Beam Search over a Next-Token Probability Table

    Decode a sequence from a bigram-style probability table using greedy search and beam search, and justify choices on ties, dead-ends, cycles, and length normalization.

    Machine Learningbeam-searchgreedy-decodingsequence-modelslog-probability