Design trending queries for an AI search engine
PremiumData pipelineMedium
- Trend detection
- Stream processing
- Query clustering
Quick answer
This data pipeline interview question asks you to design trending queries for an AI search engine. Aim for a design that moves data from sources to consumers reliably and on time, then explain ingestion, processing, storage and trade-offs. Interviewers want to see how you handle volume, late or bad data and failures along the way.
The problem
Trending queries for an AI search engine like Perplexity is the home page list of what people in each region and language are asking about right now. The hard parts are grouping paraphrases of one topic, telling trending from merely popular within minutes, and keeping a public list private, safe and hard to game.
Every visitor sees a short list for their market, and tapping an item runs that query. The list should surface real breaking interest (a product launch, a sports final, a market drop) within minutes, not the same evergreen questions every day. This question was reported in 2026 ML system design interview loops.
Users phrase the same topic in dozens of ways, AI search queries are long, conversational and often personal, and a public list on a busy home page is a target for spammers, brand campaigns and bad actors. A rare personal query must never leak onto the home page, and nothing unsafe may be shown to millions of people.
What must the system do?
- Rank by rising interest: Order items by how unusual their current demand is for that market, not by raw volume.
- Group paraphrases: Different phrasings of the same topic must count toward one trending item.
How well must it do it?
- Freshness: A new trend that needs no human review appears within 10 minutes of its rise, and each market's list is rebuilt at least every 5 minutes.
- Privacy: An item is shown only if at least 50 distinct users in that market searched it in the last hour; raw query events are deleted after 3 days and only thresholded aggregates are kept longer.
What scale should you design for?
Use these numbers in your estimates.
The scale numbers unlock with this questionUnlock
Key concepts
- Trend detection
- Stream processing
- Query clustering
- Embeddings
- HyperLogLog
- Count min sketch
How you’ll practise
- Requirements
- Data volume
- Ingestion
- Storage and processing
- Serving and freshness
- Wrap-up
Lala, personalized to you, gives a hint when you ask and reviews your design when you are ready.
What do interviewers look for?
In any data pipeline design round.
- Clarifies sources, consumers and freshness needs
- Chooses batch, streaming or both with reasons
- Handles late, duplicate and malformed records
- Makes each stage safe to retry
- Explains storage formats and partitioning
- Plans monitoring, backfills and data quality checks
Questions people ask about this interview question
- Which design type is this question?
- It is a data pipeline question. You design trending queries for an AI search engine and explain your choices the way you would in an interview.
- Is this question asked at entry level?
- It is marked Medium. Entry-level engineers can practise it, but it expects you to reason about requirements and trade-offs, not only list components.
- What should I cover first?
- Start with the data sources, the consumers and how fresh the data must be. Agree on scope with the interviewer before you design anything.
- Can I practise it for free?
- It is a premium question. Sign up and unlock it once for 10 credits; it then stays unlocked. When you finish, Lala, your personalized AI mentor, can review your design for 30 credits.
Related questions
Updated · Written by the SevyDevy team