KatInterview

Real-Time Location-Based Recommendation System

Machine LearningModel answer
HardModel answerMachine Learningrecommender-systemsgeospatialreal-time-ml

Last updated

Design a machine learning system that delivers personalized, geographically relevant place recommendations with sub-200ms latency at scale.

You're building a recommendation engine that surfaces relevant nearby locations—restaurants, shops, parks, entertainment venues—to users based on their current position and preferences.

Your system should handle hundreds of millions of daily active users, each making several requests per session. The entire pipeline must complete within 200 milliseconds at the 99th percentile.

Address the following components in your design:

  1. Business objectives and measurement: What outcomes define success? How do you measure whether recommendations are actually useful?

  2. Data foundations: What information feeds the system? Consider both static attributes and dynamic signals.

  3. Candidate retrieval: How do you quickly narrow down millions of locations to a manageable set worth scoring?

  4. Feature design: What signals help predict relevance? Consider user preferences, venue characteristics, temporal patterns, and spatial relationships.

  5. Scoring and ranking: How do you order candidates? What modeling approach balances accuracy and speed?

  6. New user and new venue problems: How does the system perform when historical data is absent?

  7. Balancing familiarity and discovery: How do you prevent showing users only what they already know?

  8. Quality and safety: How do you prevent manipulation, spam, and low-quality recommendations?

  9. Privacy constraints: What location data can you use, and how do you protect sensitive information?

  10. Performance and evaluation: How do you deploy changes safely and monitor system health?

You may make reasonable assumptions about scale, but state them explicitly.

Hints

Hint 1

Start with a two-stage funnel: fast geographical filtering to get candidates, then a slower scoring model for final ranking

Hint 2

Think about what features are naturally sparse versus dense, and which ones need real-time computation versus batch preprocessing

Hint 3

Cold-start scenarios need content-based fallbacks—what can you infer about a brand-new venue from its category, photos, or description alone?