Correcting Popularity Bias in Two-Tower Retrieval With In-Batch Negatives
Last updated: November 29, 2026
Quick Overview
A two-tower retrieval model trained with in-batch negatives keeps retrieving the same popular videos. Explain why and how to correct it.
TikTok
November 29, 20260
0
0 solved
A two-tower retrieval model trained with in-batch negatives keeps retrieving the same popular videos. Explain why and how to correct it.
Candidate retrieval for TikTok's feed narrows a huge video corpus to thousands of candidates, usually with two-tower models. Onsite interviewers probe sampling bias in in-batch softmax training and the logQ correction, plus how to add hard negatives.
What the Interviewer Expects
- Describe the two-tower architecture and softmax training
- Explain why in-batch negatives oversample popular items
- Derive or state the logQ correction
- Discuss mixed negative sampling and hard negatives
- Evaluate with recall@K by item popularity bucket
Key Topics to Cover
How to Approach This
- Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
- Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
- Feature engineering is often more impactful than model selection.
- Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
- Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
- How would you estimate item sampling probability in a stream?
- Why are hard negatives risky?
- How do you set the softmax temperature?
- How does retrieval differ in objective from ranking?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Explore ML Interview PrepSample Answer
Clarify
The model encodes users and videos into embeddings and and scores with . Positives are engaged impressions. In-batch training uses the other positives in the batch a...
Approach
In a batch drawn from engagement logs, popular videos appear often, so they show up as negatives far more often than in a uniform sample. The in-batch softmax is therefore a biased estimate of the ful...