KatInterview

Two-Stage Embedding Retrieval for a Rental Marketplace

Machine LearningModel answer
MediumModel answerMachine Learningrecsystwo-towersemantic-search

Last updated

Design a two-tower embedding retrieval plus ranking system for vacation rentals, covering representations, labels, bias correction, and evaluation.

A vacation-rental marketplace wants search results — a ranked list of roughly 20–50 bookable homes — that maximize completed bookings without degrading long-term guest satisfaction. Inventory is large (order 10M active listings), traffic is heavy (hundreds of millions of searches per day), and latency must stay interactive (p99 well under 200 ms).

Design the retrieval-and-ranking system whose core is learned vector representations of users and listings. Your answer should cover:

  1. The end-to-end architecture, from query to final ranked page, including where hard constraints (dates, guests, area, price filters) are enforced.
  2. How you construct user representations, including both in-session intent and durable preferences, and how you handle users with little or no history.
  3. How you construct listing representations for both well-engaged and brand-new listings.
  4. Training objectives and the label hierarchy for retrieval and ranking, plus leakage hazards.
  5. How relevance, revenue/business goals, and fairness constraints are blended into the final ordering.
  6. How interaction-log biases — especially position bias — are corrected.
  7. Evaluation, A/B testing philosophy, and production monitoring.

State your assumptions about scale, then justify each design choice and name the trade-offs.

Hints

Hint 1

Separate the retrieval probe (query + user + trip context) from the listing index, and think hard filters first: geography, availability, and capacity cut the candidate pool more than any model can.

Hint 2

One embedding per user is too crude — split into a recency-weighted session vector and a slow-moving preference vector learned from bookings, with a bucketed 'user type' fallback for cold start.

Hint 3

Treat position bias explicitly: either restrict training to bookings (rarer but less position-dependent), or add position as a feature at serving time and drop it at inference (PAL-style), or apply inverse-propensity weighting.