KatInterview

Building a Ranking System for E-Commerce Search

Machine LearningModel answer
MediumModel answerMachine Learningrankinge-commercemulti-task-learning

Last updated

Design an ML system that orders products by relevance for marketplace search, covering objective definition, training data, features, model architecture, and evaluation.

You're designing a machine learning system for an online marketplace that needs to order products by relevance when users search.

Given a search query, user information, and several hundred candidate products (already retrieved from the catalog), your system must produce a ranked list where the best matches appear at the top.

Walk through your end-to-end approach:

  • How would you frame this as an ML problem, and what objective would you optimize?
  • What training data would you collect, and how would you construct labels from user behavior?
  • What features would you extract, and how would you handle new products with no interaction history?
  • Which model architectures would you consider, and what are the trade-offs?
  • How would you train the model while avoiding common pitfalls like position bias?
  • How would you measure success both before and after deployment?

Focus on practical considerations: data quality issues, computational constraints at serving time, and connecting offline metrics to business outcomes.

Hints

Hint 1

User clicks are biased toward higher positions—how can you separate true relevance from placement effects?

Hint 2

Purchases are sparse but valuable; clicks are common but noisy. Consider combining multiple signals into your training objective.

Hint 3

New products have no click history. What other signals can predict their relevance, and how would you encourage the system to explore them?