KatInterview

Topic

Machine Learning interview problems

Modeling, evaluation, ML systems and LLM engineering. 511 original problems, each with a worked model answer.

Problems511

27 easy274 medium210 hard

Showing 301–330 of 511 results

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

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

    Model answerfraud detectionfeature engineeringimbalanced learningonline serving
  • 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.

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

    Model answernear-duplicate detectionsimilarity hashingembeddingsclustering
  • Fit an OLS model on financial panel data, interpret each coefficient in economic terms, and test whether each extra feature adds explanatory power.

    Model answerlinear-regressionstatistical-inferencefeature-selectiontime-series
  • 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.

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

    Model answerragmultimodalretrievalhybrid-search
  • 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.

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

    Model answerml-system-designprivacydata-pipelinellm
  • 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.

    Model answerautonomous-drivingsequence-modelingsystem-design
  • Develop both a linear baseline and a tree-based classifier for predicting loan defaults, covering feature engineering, validation, calibration, and deployment.

    Model answerclassificationimbalanced-datamodel-calibrationscikit-learn
  • Design an ML inference API that serves predictions in milliseconds, handling multitenancy, model rollouts, monitoring, and graceful degradation.

    Model answerml-systemsinferencelatencyproduction-ml
  • Define KL divergence, explain its asymmetry and support requirements, and walk through how it appears in language model training and alignment.

    Model answerkl-divergencelanguage-modelsrlhfinformation-theory
  • Derive the cross-entropy objective for binary logistic regression from first principles and compute its gradients with respect to parameters.

    Model answerlogistic-regressionmaximum-likelihoodgradientsregularization
  • 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.

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

    Model answerfeature-engineeringdata-leakagehigh-cardinalitymodel-evaluation
  • Systematically locate and repair common implementation errors in a decoder-only Transformer, then add per-layer key-value caching to make autoregressive generation efficient.

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

    Model answerhierarchical classificationmulti-labeltaxonomyloss functions
  • 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.

    Model answermodel degradationdata driftproduction MLstakeholder communication
  • Implement a trainable n-gram language model with smoothing and sampling, then reason through how to pick the right n for your data.

    Model answernlplanguage-modelsmoothingperplexity
  • 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.

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

    Model answerknndistance-metricshyperparameter-tuningcurse-of-dimensionality
  • 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.

    Model answersystem-designnlpclassificationexperimentation
  • 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.

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

    Model answerml-systemscomputer-visionsensor-fusionedge-ml
  • 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.

    Model answersupervised-learningfeature-engineeringtime-series-leakagemodel-calibration
  • Design the data pipeline, grounding architecture, hallucination and safety evaluation, and fairness controls for a clinical Q&A assistant that must never diagnose.

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

    Model answerml-systemscompilersgpuagents
  • 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.

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

    Model answerrecommender systemsretrieval-rankingcompute optimizationML system design

More topics