Sub topic 15
Popularity bias and feedback loops
This chapter assumes you can read the Python and NumPy from earlier chapters. It also assumes you know how neighborhood methods and matrix factorization produce scores, and how precision@k and recall@k are computed.
What popularity bias is
Popularity bias means a recommender suggests popular items far more often than their true appeal justifies. It happens because interaction data is uneven. A few items collect most of the ratings or clicks, and most items have very few. This is called a long-tail distribution.
Collaborative filtering learns from counts of behavior, so it inherits that skew:
- Item-based similarity is more reliable for popular items, because they have many co-ratings.
- Matrix factorization fits the observed entries. Popular items contribute the most training error, so the model shapes itself around them.
- Top-N lists then fill up with the same head items, and rarely include niche items a user might love.
How a feedback loop forms
A feedback loop starts when the model's output changes the data it is later trained on. Users can only click what they are shown. The new clicks become training data, and the next model shows the same items again.
The loop has two effects. Head items gain share at the expense of tail items. The logged data also stops reflecting what users would have chosen from the whole catalog. That matters for evaluation, as the next section explains.
Measuring the problem
An accuracy metric can look healthy while the lists are dominated by hits. Two simple diagnostics help.
- Head share is the fraction of recommended slots filled by the most popular items.
- Catalog coverage is the fraction of all items that appear in at least one list.
import numpy as np
# Number of training interactions per item (item ids 0..9).
train_counts = np.array([500, 300, 120, 40, 20, 10, 5, 3, 1, 1])
recs = [[0, 1, 2], [0, 1, 3], [0, 2, 1], [1, 0, 2]]
n_items = len(train_counts)
n_head = max(1, n_items // 5) # top 20% of the catalog
head = {int(i) for i in np.argsort(train_counts)[::-1][:n_head]}
flat = [i for r in recs for i in r]
head_share = sum(i in head for i in flat) / len(flat)
coverage = len(set(flat)) / n_items
print(f"head share = {head_share:.2f}, coverage = {coverage:.2f}")This prints head share = 0.67, coverage = 0.40. Two items out of ten supply two thirds of all recommendations, and six items are never shown.
Common mitigations
| Approach | Idea | Cost |
|---|---|---|
| Inverse-popularity weighting | Give rare items larger weight in the loss or the score | Can hurt accuracy and amplify noise on very rare items |
| Re-ranking | Reorder a candidate list to promote diversity or tail items | Adds a tuning knob and some latency |
| Exploration | Occasionally show items the model is unsure about | Short-term loss of clicks |
| Logging exposure | Record what was shown, not only what was clicked | Needs extra logging infrastructure |
Common errors
- Evaluating only on logged clicks. A model that repeats the old recommender's choices scores well on data the old recommender produced.
- Reading a rise in clicks as proof of better relevance. The model may just be concentrating attention on fewer items.
- Removing all popular items. Popularity is often a useful signal, so the aim is balance, not elimination.
Exercise
A team retrains its recommender weekly on click logs from its own recommendations. Precision@10 rises each week, but catalog coverage falls. What is the likely cause, and name one mitigation.
Show answer
A feedback loop. The model shows popular items, users click mostly what is shown, and retraining on those clicks reinforces the same items. Precision rises because the evaluation data was produced by the earlier model. One mitigation is to add exploration, so some slots show less-certain items and the logs include broader behavior. Re-ranking for diversity or weighting rare items more also works.