Recommendation, Ranking, and Personalization Questions
Systems that select and order items for users. Covers candidate generation and ranking, personalization signals, collaborative and content-based approaches, learning-to-rank, multi-armed bandits, and online experimentation for model validation. Focuses on the modeling and evaluation patterns specific to recommendation and ranking at scale.
A product team asks: should we treat the recommendation problem as supervised learning (predict clicks), or cast it as a reinforcement learning / bandit problem to maximize long-term engagement? Compare the approaches, their data requirements, evaluation methods, and production risks.
Implement a brute-force k-NN retrieval in Python (NumPy) that takes a matrix of item embeddings (n_items x d) and a single user embedding (d,) and returns top-k item indices by cosine similarity. Signature: def knn_bruteforce(item_embs, user_emb, k). Ensure numerical stability and describe complexity.
Explain inverse propensity scoring (IPS) and how it's used to evaluate ranking policies offline from logged bandit feedback. Discuss its assumptions, variance issues, and common practical adjustments (e.g., clipping, self-normalized IPS).
You detect heterogeneous treatment effects (HTE) across user segments in an experiment. Propose a path from the A/B test to personalized assignment: include steps to build and validate an uplift model or contextual bandit, offline policy evaluation methods to estimate expected gains, and production rollout considerations (exploration budget, safety constraints).
Implement a simple contextual bandit using Thompson Sampling with Bernoulli rewards in Python. Provide pseudocode for selecting an arm (sample Beta(alpha_i, beta_i) per arm) and updating posteriors on an observed binary reward. Discuss complexity and state per arm.
Unlock Full Question Bank
Get access to all Recommendation, Ranking, and Personalization interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.