Skip to content
Tutorials Center
My learning

Topics

Lesson 35 of 38 ยท Cold Start and Production

Feedback Loops, Bias and Fairness

Understand how recommenders shape their own training data: feedback loops, position and popularity bias, exploration with bandits (epsilon-greedy, UCB, Thompson sampling) and fairness checks.

A recommender is not a passive observer. What it shows decides what users click, and what users click becomes the next training set. That closes a loop: the model learns from data that it helped to create. Left unmanaged, the loop narrows what the system knows and what users see. This lesson explains the main biases that appear in recommendation logs, simulates a feedback loop, shows how exploration (bandits) breaks it, and ends with fairness checks.

Biases in logged data

  • Exposure (selection) bias: users can only click what they were shown, so an unshown item looks unpopular. Missing interactions are not negative feedback.
  • Position bias: items at the top of a list get more clicks just because they are on top. If you train on raw clicks, you learn "top positions are good" instead of "this item is good". Remedies: log the position and use it as a feature during training that you set to a fixed value at serving, or weight clicks by inverse propensity, or randomize a small share of traffic to measure it.
  • Popularity bias: models trained on logs over-recommend items that were already popular, which makes them more popular still.
  • Conformity bias: ratings and clicks are influenced by what others did (visible counts, social proof).
  • Presentation bias: thumbnails, titles and layout change clicks independently of item quality.

A feedback loop in action

The simulation has 30 items with fixed true appeal (the click probability when shown). Each round, 500 users each get a list of 3 items chosen by the system's current estimate of each item's click rate (clicks divided by impressions, with a mild prior). Every click and impression updates the estimates. The greedy recommender always shows the three best estimates; an epsilon-greedy one replaces each slot with a random item with probability epsilon. We watch which items receive impressions.

Python Rich get richer: greedy vs exploring

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Compare the rows. With no exploration, the system shows only 3 of the 30 items for the whole run, chosen by early lucky clicks; only one of the three truly best items is among them (33% of impressions) and the other 27 items stay unknown. With ฮต = 0.1 every item gets shown, the best three collect 82% of the impressions and the overall click rate is higher. Too much exploration (ฮต = 0.3) costs clicks because random items are usually worse. This is the exploration-exploitation trade-off.

Exploration with bandits

A multi-armed bandit formalizes the trade-off: each item is an "arm" with an unknown click probability, and you want to maximize total clicks over time while still learning. Three standard strategies:

  • Epsilon-greedy: with probability ฮต show a random arm, otherwise the best so far. Simple, but exploration is blind: it keeps testing arms it already knows are bad.
  • UCB (upper confidence bound): pick the arm with the highest optimistic estimate, mean + c ยท sqrt(ln t / n). Arms with few trials get a large bonus, so they are tried; the bonus shrinks as evidence accumulates.
  • Thompson sampling: keep a probability distribution over each arm's click rate (a Beta distribution for clicks), sample a value from each, and play the arm with the highest sample. Uncertain arms get sampled widely, so they are explored in proportion to their chance of being best.

Contextual bandits extend this by making the choice depend on user and item features, which is how many production systems pick the top slot for each user.

Python Epsilon-greedy vs UCB vs Thompson sampling

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

In this run Thompson sampling collects the most clicks (about 216 of a possible 240) and plays the best arm most often (67%). Greedy and epsilon-greedy are close behind in clicks, because the arms are similar and a 12% best arm is easy to settle on. UCB with the textbook bonus used here explores too long for a horizon of only 2,000 rounds (30% on the best arm), so its click total is lowest; scaling the bonus down would fix that. The ranking of strategies depends on the horizon and on the gaps between arms, so always test with simulation before choosing.

Fairness in recommendation

Fairness has several meanings, and you must choose which one applies:

  • Provider (supplier) fairness: do small sellers, new creators or minority-language content get a reasonable share of exposure? Measure the exposure share per group against their share of the catalog (or of quality).
  • Consumer fairness: does recommendation quality (NDCG, coverage of interests) differ across user groups, such as by region, language or activity level? Compare metrics per group.
  • Individual fairness: similar users should get similar results.
  • Harm and safety: feedback loops can push users toward ever narrower or more extreme content; track diversity over time and add policies for sensitive categories.

Practical steps: slice offline metrics by group, monitor exposure concentration (the Gini index from the beyond-accuracy lesson), keep a small randomized exploration traffic to estimate unbiased quality, add re-ranking constraints (minimum exposure for some groups, diversity limits), and give users controls ("not interested", reset history) plus explanations of why an item was suggested. Document what is optimized and what is not.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is position bias?

    Clicks depend on where an item is shown, so raw click data confounds position with quality.
  2. 2. Why can a greedy recommender trained on its own logs get stuck?

    Without exposure, an item's true appeal is never learned and the loop reinforces the current choices.
  3. 3. How does Thompson sampling choose which arm to play?

    Uncertain arms have wide distributions, so they are sometimes sampled high and get explored.
  4. 4. Which is an example of provider-side fairness analysis?

    Provider fairness looks at exposure for item suppliers, not at user-side quality.

Summary

  • Recommenders shape their own training data; this creates exposure, position and popularity biases and feedback loops.
  • Without exploration, unseen items stay unknown; exploration costs short-term clicks but improves long-term learning.
  • Bandits (epsilon-greedy, UCB, Thompson sampling) manage the trade-off; contextual bandits add features.
  • Fairness has provider, consumer and individual forms: measure by group, monitor exposure, add constraints and user controls.
  • Keep some randomized traffic to measure unbiased quality.

Next: Project: A Movie Recommender