KatInterview

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

Machine Learning Interview Problems

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

5971
Problems
2211
Auto-graded
15
Topics
272
Added today

Showing 91–120 of 511 results

  • Machine LearningMediumModel answer
    Building a Fast Key-Value Cache for LLM Token Generation

    Explain and design a per-layer key/value cache for decoder-only LLM generation, covering batching, branching, long contexts, memory and kernel performance, precision, and common correctness bugs.

    Machine Learningtransformerskv-cachellm-inferenceattention
  • Machine LearningMediumModel answer
    Teaching an LLM to Flag Questions Past Its Knowledge Horizon

    Design a way for a language model to spot questions that need information newer than its training data and to tell the user clearly where its knowledge stops.

    Machine Learningllmcalibrationabstentionfine-tuning
  • Machine LearningMediumModel answer
    Choosing Metrics, Penalties, and Ablations for an NLP Model

    Compare classifier evaluation metrics, contrast L1 and L2 penalties, and plan a controlled ablation study that isolates which pipeline components drive an NLP system's quality.

    Machine Learningevaluation-metricsregularizationablation-studyroc-auc
  • Machine LearningHardModel answer
    Safely Retiring an Incumbent Ad-Ranking Model

    Plan an end-to-end migration from a legacy ad-ranking model to a new one, covering offline validation, off-policy estimates, staged online rollout, conflicting-metric decisions and production risks.

    Machine Learningads-rankingoff-policy-evaluationab-testingmodel-rollout
  • Machine LearningHardModel answer
    Designing a Leak-Free Weekly Churn Model Pipeline

    Design a weekly batch churn-prediction system for millions of subscribers, covering leakage-free features, rare positives, time-aware validation, metrics, and drift monitoring.

    Machine Learningchurn-predictiondata-leakageclass-imbalancebacktesting
  • Machine LearningMediumModel answer
    Build a Document Q&A Pipeline with Retrieval and Grounded Prompts

    Wire together a given embedder, vector store and LLM into a retrieval-augmented question-answering flow, then justify vector similarity search and when this approach beats alternatives.

    Machine Learningragembeddingsvector-searchcosine-similarity
  • Machine LearningMediumModel answer
    Bounded-Memory Online Clustering of a Numeric Stream

    Design and code a clustering routine for an endless stream of numbers that keeps only small per-cluster summaries, and discuss seeding, convergence, outliers, drift, and testing.

    Machine Learningstreamingonline-clusteringk-meansconcept-drift
  • Machine LearningMediumModel answer
    PyTorch vs JAX: Framework Design and Ecosystem Trends

    Discuss where deep learning frameworks are heading, then contrast PyTorch and JAX on execution model, compilation, and ecosystem, and say when you would choose each.

    Machine Learningpytorchjaxml-frameworkscompilers
  • Machine LearningMediumModel answer
    Choosing an LLM Alignment Recipe for a Support Assistant

    Weigh PPO-based RLHF against DPO, use AI-generated feedback when labels are scarce, and diagnose and fix a model that over-refuses harmless requests after alignment.

    Machine Learningrlhfdporlaifllm-alignment
  • Machine LearningEasyModel answer
    Deriving and Analyzing Ordinary Least Squares Linear Regression

    Explain the mathematical derivation, key theoretical assumptions, numerical considerations, and regularized extensions of ordinary least squares (OLS).

    Machine Learninglinear-regressionleast-squaresconvex-optimizationmachine-learning
  • Machine LearningMediumModel answer
    Scoring Song Impressions: A Click Model for a Music Feed

    Design a model that estimates the chance a user clicks a recommended track, covering song representation, sparse feature handling, algorithm choice, calibration, and offline and online evaluation.

    Machine Learningctr-predictionrecommendationembeddingssparse-features
  • Machine LearningMediumModel answer
    Rank Predictors by Logistic Regression Coefficient Magnitude

    Fit an unpenalized binary logistic regression with an intercept on a features-by-samples matrix, then return the three predictors with the largest absolute coefficients.

    Machine Learninglogistic-regressionfeature-importancenumpyirls
  • Machine LearningMediumModel answer
    Probabilistic Triage Model for Disputed Order Claims

    Design a calibrated probabilistic model that scores dispute cases for fraud despite informative missing data, shifting base rates, and cost-sensitive routing decisions.

    Machine Learningbayesian-inferencecalibrationmissing-datalabel-shift
  • Machine LearningMediumModel answer
    Evaluating Feature Imputation Methods for Linear Regression Models

    Analyze and contrast mean imputation, empirical sample imputation, and missingness indicator techniques in linear models across MCAR, MAR, and MNAR data mechanisms.

    Machine Learningmachine-learningstatisticsdata-preprocessingfeature-engineering
  • Machine LearningMediumModel answer
    Mechanics of Positional Encodings in Transformer Architectures

    Understand Transformer positional encodings, including self-attention permutation properties, sinusoidal vs. learned schemes, linear shift derivations, and relative methods.

    Machine Learningtransformerspositional-encodingattentiondeep-learning
  • Machine LearningEasyModel answer
    Core ML Fundamentals: Generalization, Imbalance, and Missingness

    A foundational machine learning assessment covering model capacity trade-offs, handling heavily skewed class distributions, and processing incomplete data features.

    Machine Learningbias-varianceclass-imbalancemissing-datamachine-learning
  • Machine LearningMediumModel answer
    Ranking a Design Gallery and Turning Prompts into Safe UI Snippets

    Design an ML system that ranks a creative community's feed and also converts natural-language requests into validated, safe HTML/CSS components, including evaluation and feedback loops.

    Machine Learningml-system-designrecommendationrankingllm
  • Machine LearningMediumModel answer
    Bias-Variance, Normalization Axes, and Gradient Decay in Deep Nets

    Explain the bias-variance tradeoff, compare batch and layer normalization, and describe why gradients vanish in deep networks and how architecture can prevent it.

    Machine Learningbias-variancebatch-normalizationlayer-normalizationvanishing-gradients
  • Machine LearningMediumModel answer
    Comparing RLHF with Reward Models against Direct Preference Optimization

    Analyze the architecture, loss functions, training complexity, and theoretical connections between traditional PPO-based RLHF and Direct Preference Optimization (DPO).

    Machine LearningLLMsRLHFDPOAlignment
  • Machine LearningHardModel answer
    Automated Diagnosis Coding Engine for Long Clinical Notes

    Design a service that reads long clinical notes, suggests ICD-10 codes with calibrated confidence and cited evidence, and learns from medical coder corrections over time.

    Machine Learningnlpextreme-multi-labelml-system-designlong-documents
  • Machine LearningMediumModel answer
    Building a Training Set for an OCR Error-Correction Model

    Design a scalable pipeline that scores noisy OCR pages, distills a small verified gold set from a stronger LLM, and filters out pages too degraded to repair.

    Machine Learningllm-fine-tuningdata-pipelinesynthetic-dataocr
  • Machine LearningMediumModel answer
    Conditions for Boundedness in Unconstrained Quadratic Minimization

    Analyze when an unconstrained scalar quadratic function has a finite minimum, and derive the optimal solution set and value using matrix properties.

    Machine Learningoptimizationconvexitylinear-algebraquadratic-form
  • Machine LearningMediumModel answer
    Designing a Quality Strategy for Robotic Automated Leaf Counting

    Learn how to design a comprehensive test suite for computer vision and robotics systems when absolute ground truth is difficult to determine.

    Machine Learningcomputer-visiontestingroboticsground-truth
  • Machine LearningHardModel answer
    KV Cache, RoPE, and Nucleus Sampling with Temperature

    Explain why decoder-only transformers use a KV cache and rotary embeddings, then implement a temperature-scaled nucleus (top-p) sampler over next-token logits.

    Machine Learningtransformerskv-cacheropetop-p-sampling
  • Machine LearningMediumModel answer
    From Raw Text to Tokens: Subword Tokenizers and Modern LLM Blocks

    Describe how subword tokenizers such as SentencePiece work, what a Transformer block contains, and why recent LLMs replaced parts of the original design with RMSNorm, RoPE, and MoE.

    Machine Learningtokenizationtransformerssentencepiecerope
  • Machine LearningMediumModel answer
    Why Identical Starting Weights Stall Neural Network Training

    Analyze what happens when a feed-forward network starts with every weight and bias at zero, how symmetry persists, and why random scaled initialization resolves it.

    Machine Learningweight-initializationbackpropagationsymmetry-breakingxavier-he
  • Machine LearningMediumModel answer
    Building a Grounded Document Q&A System with Retrieval

    Design a question-answering system that retrieves evidence from a versioned, access-controlled document set, cites sources, abstains when unsupported, and measures retrieval and answer quality separately.

    Machine Learningragretrievalevaluationchunking
  • Machine LearningHardModel answer
    Design a Production RAG Engine with Citations and Strict Access Control

    Design, optimize, and systematically evaluate an enterprise RAG system that processes heterogeneous documents, handles ACLs, and guarantees zero stale citations under high query throughput.

    Machine LearningRAGSystem DesignVector SearchLLM Evaluation
  • Machine LearningHardModel answer
    Ranking Currently-Live Channels Under a 100 ms Budget

    Design an end-to-end ML system that ranks live channels for viewers, covering labels, features, models, bias correction, evaluation, and low-latency serving as streams start and end.

    Machine Learningrecommender-systemstwo-towercounterfactual-learningexploration
  • Machine LearningEasyModel answer
    Selecting Classification Thresholds and Evaluating ML Pipelines

    Learn how to select decision thresholds, tune trade-offs under constraints like asymmetric costs and capacity, and design robust evaluation metrics for classification systems.

    Machine Learningclassificationthreshold-tuningmodel-evaluationprecision-recall