Design comment ranking for a news feed
I was asked this
No reports yet. Sign in to say where you were asked it.
An AI/ML design interview question asked in Meta's AI/ML design round, last asked Dec 2025. It tests ranking, feed and comments.
Design the ML system that decides which comments to show under a post in a news feed, and in what order. A popular post can have thousands of comments; most people see only the first two or three in the feed and a few more if they open the post. The ranking should be personal to the viewer, favour comments that start meaningful conversations, and push down low-quality or harmful ones.
Requirements
- Functional: for a (viewer, post) pair, return the comments to preview in the feed and the order of comments on the post page, including replies in threads.
- Functional: new comments on fast-moving posts appear quickly; comments that break policy never surface at the top.
- Non-functional: ranking within tens of milliseconds as part of the feed request; billions of feed views a day; robust to manipulation such as like rings and spam.
Clarifying questions
- What does the product want from comments: engagement, meaningful conversations, or perceived quality?
- How personal should it be: does a friend's comment rank above a stranger's highly liked one?
- Which signals exist: likes, replies, reports, hides, time spent reading, dwell after expanding?
- Is there a separate integrity system that labels harmful content?
- Do public pages and private friend posts need different policies?
What a strong answer covers
- The objective: a weighted combination of predicted outcomes, for example the viewer liking or replying, the comment author getting replies, and negative outcomes (hide, report), with the weights tied to the product goal.
- Labels: positive and negative interactions from impressions, with corrections for position bias (comments shown first get more likes) and delayed signals.
- Features: comment text and its embedding, comment age and current engagement, the author's history and relationship to the viewer and the post author, the viewer's own history, and thread features.
- Integrity: a quality and policy classifier whose output demotes or filters comments, and resistance to coordinated likes.
- The model and stages: candidate selection per post (recent, top, friends' comments), a ranking model, then rules for diversity and for keeping threads together.
- Freshness: real-time engagement counters so new comments on a fast-moving post can rise, and exploration slots for new comments.
- Serving: precomputed per-post candidate lists and features, refreshed by streaming updates; a latency budget inside the feed request.
- Evaluation: offline ranking metrics per objective, online A/B tests on comment engagement, conversation depth and reports, with care for effects on comment authors.
Follow-ups
- A comment with many likes turns out to be misinformation. How does your system respond?
- How do you rank comments on a post that just went viral with thousands of comments a minute?
- Friends' comments always win and the top comments become boring. What do you change?
- How would you measure whether a comment started a "meaningful conversation"?
Where it's asked
- Meta · AI/ML design · Last asked Dec 2025ML system design
What it tests
ranking · feed · comments
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
