KatInterview

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

Machine Learning Interview Problems

Practice 5980 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.

5980
Problems
2215
Auto-graded
15
Topics
272
Added today

Showing 301–330 of 511 results

  • Machine LearningHardModel answer
    Build a production spam filter for email

    Design a complete ML system to classify incoming email as spam or legitimate, covering labeling, features, models, serving, metrics, and adversarial defenses.

    Machine Learningml-system-designclassificationproduction-mlanti-abuse
  • Machine LearningHardModel answer
    Real-Time Transaction Risk Scoring System Design

    Design an end-to-end ML system that scores payment transactions in real time and decides whether to approve, block, challenge, or escalate them.

    Machine Learningfraud detectionfeature engineeringimbalanced learningonline serving
  • Machine LearningHardModel answer
    Build Causal Attention, a KV Cache, and Grouped-Query Attention

    Implement causal multi-head attention from scratch, add a KV cache for step-by-step decoding, then extend it to grouped-query attention where query heads share KV heads.

    Machine Learningtransformersattentiondeep-learning
  • Machine LearningMediumModel answer
    Building a Pipeline to Surface Coordinated Duplicate Content

    Design and compare algorithms for detecting near-duplicate content at scale, then layer on signals that distinguish organic sharing from coordinated inauthentic behavior.

    Machine Learningnear-duplicate detectionsimilarity hashingembeddingsclustering
  • Machine LearningMediumModel answer
    OLS on Market Data: Reading Betas and Testing Added Features

    Fit an OLS model on financial panel data, interpret each coefficient in economic terms, and test whether each extra feature adds explanatory power.

    Machine Learninglinear-regressionstatistical-inferencefeature-selectiontime-series
  • Machine LearningMediumModel answer
    Design a Large-Scale Batch Inference Pipeline

    Design a production-grade batch inference system that runs a language model over millions of daily documents with exactly-once semantics, versioning, and operational reliability.

    Machine Learningbatch inferenceMLOpssystem designfault tolerance
  • Machine LearningMediumModel answer
    Multimodal RAG for Financial Documents and Charts

    Design a provenance-tracked hybrid retrieval system over text PDFs and chart images, with reranking, ACL/PII controls, calibrated abstention, and staged evaluation.

    Machine Learningragmultimodalretrievalhybrid-search
  • Machine LearningHardModel answer
    Ranking Property Listings When There Is No Search Query

    Design an ML ranking system for a short-term rental platform where candidates are pre-filtered and there is no free-text query to match against.

    Machine Learningrankingrecommendationpersonalizationbias
  • Machine LearningHardModel answer
    Build a PII Detection System for Large-Scale Databases

    Design an ML-powered pipeline to automatically discover and classify personal information across billions of records in structured tables and unstructured text.

    Machine Learningml-system-designprivacydata-pipelinellm
  • Machine LearningHardModel answer
    ML System Design: Intersection Maneuver Intent Prediction

    Design an ML pipeline that classifies each vehicle at an intersection as turning left, going straight, or turning right, given a short trajectory history and optional map context.

    Machine Learningautonomous-drivingsequence-modelingsystem-design
  • Machine LearningMediumModel answer
    Build and Compare Credit Risk Models: Logistic vs Tree Ensemble

    Develop both a linear baseline and a tree-based classifier for predicting loan defaults, covering feature engineering, validation, calibration, and deployment.

    Machine Learningclassificationimbalanced-datamodel-calibrationscikit-learn
  • Machine LearningHardModel answer
    Build a Real-Time ML Prediction Service

    Design an ML inference API that serves predictions in milliseconds, handling multitenancy, model rollouts, monitoring, and graceful degradation.

    Machine Learningml-systemsinferencelatencyproduction-ml
  • Machine LearningHardModel answer
    KL Divergence: From Definition to LLM Training

    Define KL divergence, explain its asymmetry and support requirements, and walk through how it appears in language model training and alignment.

    Machine Learningkl-divergencelanguage-modelsrlhfinformation-theory
  • Machine LearningMediumModel answer
    Binary Classification Loss: Derivation and Gradient Computation

    Derive the cross-entropy objective for binary logistic regression from first principles and compute its gradients with respect to parameters.

    Machine Learninglogistic-regressionmaximum-likelihoodgradientsregularization
  • Machine LearningHardModel answer
    Transformer Attention: Math, Caching, Precision, and Masking Trade-offs

    Walk through scaled dot-product attention, KV-cache memory and complexity, mixed-precision training with loss scaling vs BF16, and masked vs cross-attention design choices.

    Machine Learningtransformersattentionkv-cachemixed-precision
  • Machine LearningMediumModel answer
    Build a Click-Through Rate Model for a News Feed

    Design an end-to-end CTR prediction pipeline covering temporal feature engineering, leakage prevention, high-cardinality encoding, and offline-to-online metric gaps.

    Machine Learningfeature-engineeringdata-leakagehigh-cardinalitymodel-evaluation
  • Machine LearningHardModel answer
    Fix Bugs in a Transformer and Build a KV Cache from Scratch

    Systematically locate and repair common implementation errors in a decoder-only Transformer, then add per-layer key-value caching to make autoregressive generation efficient.

    Machine Learningtransformersattentionkv-cachedebugging
  • Machine LearningHardModel answer
    Build a Product Taxonomy Classifier Across Inconsistent Labels

    Design a production ML system that assigns products to a noisy, multi-path category tree with consistent predictions, calibrated confidence, and sub-100ms latency.

    Machine Learninghierarchical classificationmulti-labeltaxonomyloss functions
  • Machine LearningMediumModel answer
    Why Did Our Model Get Worse After Launch?

    Explain the gap between offline validation and live model performance to a non-technical PM, covering causes, a diagnostic plan, and mitigations with trade-offs.

    Machine Learningmodel degradationdata driftproduction MLstakeholder communication
  • Machine LearningHardModel answer
    Build an N-Gram Language Model: Smoothing, Generation, and Tuning N

    Implement a trainable n-gram language model with smoothing and sampling, then reason through how to pick the right n for your data.

    Machine Learningnlplanguage-modelsmoothingperplexity
  • Machine LearningHardModel answer
    End-to-End GenAI System Design: Architecture Deep-Dive

    Design and defend a complete GenAI system from data ingestion to production serving, covering model choice, evaluation, safety, and a scaling plan under hard latency and cost constraints.

    Machine LearningLLMRAGfine-tuningserving
  • Machine LearningEasyModel answer
    K-Nearest Neighbors: Mechanics, Tuning, and Pitfalls

    Explain how KNN works for classification and regression, walk through its key design choices, and identify where it breaks down in practice.

    Machine Learningknndistance-metricshyperparameter-tuningcurse-of-dimensionality
  • Machine LearningMediumModel answer
    Design a Query Router Between a Local Assistant and a Cloud LLM

    Design an end-to-end ML system that decides whether a natural-language query should go to a lightweight local assistant or a powerful cloud LLM.

    Machine Learningsystem-designnlpclassificationexperimentation
  • Machine LearningHardModel answer
    Outliers, Leverage, and Influence in OLS Regression

    Derive Cook's distance from first principles, build a diagnostic workflow, show how one point can flip a coefficient's sign, and compare robust regression alternatives.

    Machine Learningregressiondiagnosticsrobust-statisticscook-distance
  • Machine LearningMediumModel answer
    Real-Time Perception Pipeline for Autonomous Driving

    Design an ML pipeline that fuses camera, LiDAR, and radar data to detect obstacles with sub-100ms latency on edge hardware.

    Machine Learningml-systemscomputer-visionsensor-fusionedge-ml
  • Machine LearningHardModel answer
    Predict Which Free-Tier Merchants Will Upgrade to a Paid Plan

    Design a production-ready ML pipeline to identify free-tier merchants likely to convert to a paid subscription within 60 days, covering labeling, leakage, features, modeling, evaluation, and monitoring.

    Machine Learningsupervised-learningfeature-engineeringtime-series-leakagemodel-calibration
  • Machine LearningMediumModel answer
    Designing a Safe Patient-Facing Medical QA Assistant

    Design the data pipeline, grounding architecture, hallucination and safety evaluation, and fairness controls for a clinical Q&A assistant that must never diagnose.

    Machine Learningragllm-safetyevaluationhealthcare
  • Machine LearningMediumModel answer
    Designing an Agent That Writes and Tunes GPU Kernels

    Design an agent that generates and optimizes GPU kernels and compiler passes, covering validation strategy, correctness checks, numerical tolerances, and performance evaluation.

    Machine Learningml-systemscompilersgpuagents
  • Machine LearningHardModel answer
    Nearby Venue Feed: Real-Time Top-K Ranking as You Explore a Map

    Design a low-latency system that surfaces the most relevant K venues within a moving map viewport, covering spatial indexing, candidate retrieval, personalized re-ranking, and caching.

    Machine Learningml-system-designgeospatialretrievalranking
  • Machine LearningHardModel answer
    Dynamic Retrieval Depth Selection in a Recommender Pipeline

    Design a system that decides, per request, how many candidates to pass from the recall stage to the heavy ranker in a recommender system.

    Machine Learningrecommender systemsretrieval-rankingcompute optimizationML system design