Rank Accounts and Hashtags in Instagram Search Results
Last updated: November 29, 2026
Quick Overview
Design the ranking system that orders accounts and hashtags when a user types a query into Instagram search. Consider prefix matching, social relevance, popularity and abuse such as impersonation accounts.
Meta
November 29, 20260
0
0 solved
Design the ranking system that orders accounts and hashtags when a user types a query into Instagram search. Consider prefix matching, social relevance, popularity and abuse such as impersonation accounts.
Instagram search is a mixed-entity ranking problem with strong personalization: the same query 'alex' should return different accounts for different users. Interviewers look at retrieval over prefixes, social features, label design from search logs and protection against impersonators.
What the Interviewer Expects
- Retrieves candidates by prefix and fuzzy match across usernames and full names
- Uses social graph proximity as a central ranking feature
- Ranks mixed entity types with a shared or blended score
- Learns from search logs with correct click and position handling
- Demotes impersonation and spam accounts
Key Topics to Cover
How to Approach This
- Start by mapping the business objective to a concrete ML objective and metric.
- Cover the full pipeline: data collection, feature engineering, model selection, training, serving.
- Discuss online vs offline evaluation. Plan an A/B test to validate real-world impact.
- Address the serving latency budget and whether batch or real-time inference is needed.
- Think about the data flywheel: how user feedback improves the model over time.
Possible Follow-up Questions
- How would you rank a verified celebrity against a friend with the same first name?
- How do you rank hashtags against accounts in a single list?
- How would you detect impersonation accounts in search results?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice ML System Design ProblemsSample Answer
Requirements
- Query is typed character by character; results update with each keystroke.
- Entities: accounts, hashtags, places, audio. Focus on accounts and hashtags.
- Latency under 100 ms per keystroke.
- Succ...
High-Level Design
- Retrieval: prefix index over usernames and names (trie or n-gram index), plus a personalized index of accounts within 2 hops of the user, plus a typo-tolerant index for queries of 4 or more cha...