Inverse propensity scoring

Also known as: inverse propensity weighting

On this page 7

Inverse propensity scoring (IPS) is a statistical technique that corrects selection bias in logged feedback by weighting each observed interaction by the inverse of the probability that it was observed in the first place. In recommender systems, it is the standard tool for estimating how a new recommendation policy would perform, or for training a model, using data that an earlier policy collected and therefore skewed toward the items it chose to show.

The method is also called inverse propensity weighting, and it originates in survey sampling and causal inference, where the Horvitz-Thompson estimator weights sampled units by their inverse inclusion probability. Recommendation adopted it because user feedback is never a random sample: people only click, rate or buy what the system exposed to them, and they are more likely to notice items in top positions.

How inverse propensity scoring corrects bias

The core idea is that an interaction observed with low probability represents many unobserved ones. A propensity is the probability that a given user-item pair entered the logged data, for example the probability that the logging policy recommended the item or that the user examined its position. Dividing the observed outcome by that propensity gives rare observations proportionally more weight.

For off-policy evaluation, the IPS estimate of a new policy’s value is the average of logged rewards multiplied by the ratio of the new policy’s action probability to the logging policy’s probability: V = (1/n) * sum(r_i * pi(a_i|x_i) / mu(a_i|x_i)). When propensities are correct and every action the new policy may take had a nonzero logging probability, this estimator is unbiased in expectation.

For training, the same weights enter the loss function. Each observed rating or click contributes its loss divided by its propensity, so the model minimizes an estimate of the error it would have on the full user-item matrix instead of only on the biased observed subset.

The table below lists the main sources of bias that IPS addresses in recommendation and what the propensity represents in each case.

Bias typeWhat the propensity measuresTypical estimation method
Exposure biasProbability that an item was shown to the userLogged policy probabilities
Position biasProbability that a user examined a given rankRandomization experiments or click models
Missing-not-at-random ratingsProbability that a user rated an itemNaive Bayes or logistic models on observation
Popularity biasProbability of observation as a function of popularityPopularity-based smoothing models
Bias types addressed by inverse propensity scoring

Estimating the propensities

IPS is only as reliable as its propensities, so propensity estimation is the critical step. When the logging system was itself stochastic, the best source is the exact probability recorded at serving time, which requires engineering foresight because many production systems log only the chosen items.

When logged probabilities are missing, teams estimate them. For position bias, a common approach is a small randomization experiment, such as swapping results between ranks for a fraction of traffic, which reveals how click probability decays with position. For rating data, a model predicts whether a user-item pair would be observed, using features such as item popularity and user activity.

  • Logged propensities: most accurate, require stochastic serving and careful logging.
  • Randomized interventions: reliable for position effects, but cost some user experience.
  • Learned observation models: flexible, but errors in the model translate directly into biased weights.

Variance and its remedies

The main weakness of IPS is high variance. When a propensity is very small, the corresponding weight becomes very large, and a handful of interactions can dominate the estimate. In recommendation, with large catalogs and near-deterministic rankers, small propensities are common, so plain IPS estimates often fluctuate strongly between samples.

Practitioners therefore use modified estimators that trade a small amount of bias for much lower variance, as summarized below.

EstimatorModificationBiasVariance
Vanilla IPSPlain inverse weightsUnbiased with correct propensitiesHigh
Clipped IPSCaps weights at a maximum valueSmall downward biasLower
Self-normalized IPS (SNIPS)Divides by the sum of weightsSmall, vanishes with more dataLower
Doubly robustCombines IPS with a reward modelUnbiased if either part is correctLower when the model is good
Common IPS variants and their trade-offs

Weight clipping is the simplest fix, and thresholds are usually tuned on validation data. Doubly robust estimation is often the strongest choice in practice because a reasonable reward model absorbs most of the variance while the IPS correction removes the model’s systematic error.

Where IPS is used in recommender systems

IPS appears wherever a team must learn or evaluate from biased logs rather than from randomized experiments. Its most common uses are listed below together with the practical goal of each.

ApplicationGoalKey requirement
Offline recommender evaluationEstimate a new policy’s metrics before an A/B testLogged action probabilities
Unbiased learning to rankTrain rankers from clicks despite position biasPosition propensity estimates
Debiased rating predictionPredict ratings for unrated itemsModel of which ratings are observed
Contextual bandit learningImprove exploration policies from logged rewardsStochastic logging policy
Typical applications of inverse propensity scoring

In offline evaluation, IPS lets teams screen candidate policies cheaply and reserve online A/B tests for the most promising ones. In unbiased learning to rank, it allows clicks to serve as relevance labels without simply reinforcing the current ranking, a pattern that otherwise produces a recommendation feedback loop.

Common mistakes and limitations

The most frequent error is applying IPS to a deterministic logging policy. If the old system never showed an item to a user, its propensity is zero and no weighting can recover that missing information. This condition, called positivity or overlap, must hold for every action the evaluated policy might choose.

  • Misspecified propensities introduce new bias instead of removing the old one.
  • Ignoring variance leads teams to trust noisy offline wins that disappear online.
  • Large action spaces such as full slates make exact propensities tiny, so slate-level or item-position factorizations are needed.
  • Unobserved confounders that influence both exposure and feedback remain uncorrected.

Put simply

A recommendation system mostly learns from items it already showed. Popular items and top positions get far more clicks. So the data gives a distorted picture of what people really like.

Inverse propensity scoring fixes this by counting rare observations more. Imagine a poll where only one in ten rural residents answered, but every city resident did. To get a fair result, each rural answer should count ten times. IPS does the same for clicks on items that were rarely shown.

In practice

An online bookstore wants to replace its homepage ranker with a model that promotes lesser-known titles. Running an A/B test for every candidate model would take weeks, so the data science team first evaluates candidates offline on 30 days of logs.

Because the current ranker places each item with a logged probability, the team computes IPS and doubly robust estimates of purchase rate for each candidate. They clip weights at 50 to limit the influence of rare exposures and check that every candidate stays within the overlap of the logging policy.

The naive offline metric favored the existing ranker, but the IPS estimate showed one candidate with a 3 percent higher purchase rate. A subsequent two-week A/B test confirmed a gain of similar size, and the team adopted the new model while keeping a small amount of randomized exploration to support future evaluations.