We have billions of user–item pairs. Which negative examples should train the retriever?
Understand what an unobserved interaction means and how sampled training differs from catalog-wide evaluation.
01. Define what a negative means
A user ignoring an exposed item is different from a user never seeing it. Exposure, availability, position, and the time allowed for a response all affect interpretation. Treating every unobserved pair as a known dislike creates misleading labels.
For a book recommendation example, record the request, eligible catalog, displayed books, positions, and subsequent actions. A purchase three days later may belong to a different outcome window than a click seconds later. Choose the learning target before constructing a sample.
02. Compare sampling strategies
Uniform catalog negatives provide broad coverage but can be very easy. Popularity-based samples emphasize frequently encountered items but change the training distribution. In-batch negatives reuse other examples’ positive items, which is efficient but can include items that would also suit the current user.
Hard negatives are items the current model scores highly but that are unsuitable under a trustworthy label or constraint. They can improve discrimination, yet mislabeled hard negatives can actively suppress relevant results. Mix strategies and track where the negative evidence comes from.
03. Work through a small batch
Imagine two positive pairs: user A with book X, and user B with book Y. In-batch training can ask A to prefer X over Y and B to prefer Y over X. If both users like both books, the supposed negative comparisons are not clean expressions of preference.
Repeated items in a batch need care too: two copies of book X should not accidentally be treated as different semantic candidates. Mask known positives where feasible, define duplicate handling, and inspect whether the sampling process overrepresents a small group of popular items.
04. Evaluate beyond sampled candidates
A retrieval model that chooses correctly among ten easy sampled books may still fail among a million eligible books. Measure retrieval against a realistic candidate universe, or clearly disclose the sampled evaluation protocol and its limitations. Separate model relevance recall from approximate-index recall.
Some sampled objectives require probability corrections to approximate a desired full-catalog objective. The exact correction depends on the sampler and loss; it is not a universal subtraction applied to every score. Follow-up: better sampled loss but worse production recall should trigger a review of sampling, eligibility, catalog freshness, and index compatibility.
Practice the follow-up
Give one example of a useful hard negative and one example that is actually an unlabeled positive.
Connect this to recommendation retrieval.
Sources & further reading
Google Research: mixed negative sampling. The interview scenario, calculations, and proposed design choices are illustrative.
Continue your preparation
Choose a connected learning path or browse more ML fundamentals questions. Read our editorial method and attribution policy.