Re-Rank a Recommendation Carousel for Diversity With MMR

Last updated: November 29, 2026

Quick Overview

A homepage carousel shows ten near-identical phone cases because they all score highest. Explain how you would re-rank for diversity using maximal marginal relevance and how you would tune the trade-off.

Amazon
Machine Learning
Machine Learning Engineer
Amazon
November 29, 2026
Machine Learning Engineer
Technical Screen
Machine Learning
Medium

0

0

0 solved


A homepage carousel shows ten near-identical phone cases because they all score highest. Explain how you would re-rank for diversity using maximal marginal relevance and how you would tune the trade-off.

Amazon surfaces many recommendation carousels, and redundant lists waste scarce screen space. Interviewers use this to see whether you can add a principled post-ranking stage, implement it, and measure whether diversity actually helps customers.

What the Interviewer Expects
  • Explain why a pure relevance sort produces redundant lists
  • Define MMR with a relevance term and a redundancy penalty
  • Implement the greedy selection
  • Choose a similarity measure for items
  • Describe how to tune lambda with online metrics
Key Topics to Cover
Diversity
Maximal marginal relevance
Re-ranking
Item embeddings
Greedy selection
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
  • How would you enforce hard constraints like at most two items per brand?
  • What is the time complexity, and how would you make it cheap for 500 candidates?
  • How does a determinantal point process compare to MMR?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Explore ML Interview Prep
Sample Answer
Clarify

Confirm candidates come from an upstream ranker with scores, that we have item embeddings (or category and brand metadata), and how many slots the carousel shows. Ask whether diversity is a goal in it...

Approach

Greedy MMR picks the next item maximizing λ rel(i)−(1−λ)max⁡j∈Ssim(i,j)\lambda\,\text{rel}(i)-(1-\lambda)\max_{j\in S}\text{sim}(i,j), where SS is already selected. With λ=1\lambda=1 it reduces to the original ranking; lower $...


Submit Your Answer
Markdown supported