#71 Candidate Generation/Ranking
Hotel Recommendation System
Show each traveller the hotels they are most likely to book, in real time, out of thousands that match their search.
What is being asked
Design hotel ranking and recommendations: the order of the search results page and widgets like "you might also like". A city search can match 3,000 hotels; the user looks at maybe 20.
Requirements
Functional
- Rank search results for a user and query.
- "Similar hotels" and "recommended for your trip" widgets.
- Support business rules: sponsored listings, filters, diversity.
Non-functional
- Ranking adds no more than ~100 ms to search.
- Models retrained regularly from booking and click data.
- Measurable through A/B tests.
Design
- Candidate generation narrows thousands of hotels to a few hundred: available ones that match the filters, plus cheap signals (popularity, distance).
- Ranking scores each candidate with a model using features: price relative to the city, review score, distance to the searched landmark, the user's past bookings, conversion rate.
- Business rules apply sponsored slots, de-duplicate chains and make sure the top results aren't all the same kind of hotel.
- Every impression, click and booking is logged and feeds the next model.
Key decisions and trade-offs
- Two stages. A heavy model can't score 3,000 hotels in 100 ms; a cheap first stage and an expensive second stage can.
- Optimise for bookings, not clicks. Clicks are easy to inflate with attractive photos; bookings are the real goal but rarer, so models often combine both.
- Position bias. Hotels at the top get clicked because they are at the top; training must correct for it.
- Cold start. A new hotel has no history; give it exploration traffic or borrow signals from similar hotels.
Follow-up questions
- How do you rank for a user who isn't logged in?
- How do you keep sponsored listings from hurting conversion?
- How would you know the new model is better?
- What features would make "romantic weekend" vs "business trip" rank differently?