Learning to Counterfactually Explain Recommendations

Yuanshun Yao, Chong Wang, Hang LiarXiv 2022

Abstract

Recommender system practitioners are facing increasing pressure to explain recommendations. We explore how to explain recommendations using counterfactual logic, i.e. "Had you not interacted with the following items, we would not recommend it." Compared to the traditional explanation logic, counterfactual explanations are easier to understand, more technically verifiable, and more informative in terms of giving users control over recommendations. The major challenge of generating such explanations is the computational cost because it requires repeatedly retraining the models to obtain the effect on a recommendation caused by the absence of user history. We propose a learning-based framework to generate counterfactual explanations. The key idea is to train a surrogate model to learn the effect of removing a subset of user history on the recommendation. To this end, we first artificially simulate the counterfactual outcomes on the recommendation after deleting subsets of history. Then we train a surrogate model to learn the mapping between a history deletion and the corresponding change of the recommendation caused by the deletion. Finally, to generate an explanation, we find the history subset predicted by the surrogate model that is most likely to remove the recommendation. Through offline experiments and online user studies, we show our method, compared to baselines, can generate explanations that are more counterfactually valid and more satisfactory considered by users.

Introduction

Most recommender systems explain themselves using item-based logic: "We recommended Item A because you previously interacted with Items B and C." While simple, this approach has three major flaws: missing causality (it shows correlation, not necessarily the reason for the choice), lack of verifiability (no guarantee that removing B and C would stop A), and low user agency (it doesn't tell a user how to stop receiving unwanted recommendations).

Counterfactual explanations solve this by identifying the specific subset of history that, if removed, would change the recommendation. However, finding this subset is a "needle in a haystack" problem. The "naive" way requires retraining the recommendation model for every possible combination of a user's history—a task that is computationally impossible at scale.

Methods

The proposed framework shifts the heavy lifting offline through a three-step learning-based process:

  1. Simulating Counterfactual Outcomes: The authors pre-calculate the effects of history deletion by sampling users, removing random subsets of their history, retraining the recommendation model, and recording the change in the target item's rank or score.
  2. Training Surrogate Models: This simulated data is used to train a surrogate model that learns to map a (User, Deleted History, Target Item) triplet to the predicted change in recommendation.
  3. Generating Explanations: At inference time, the system queries the surrogate model to find the history subset most likely to "flip" the recommendation, avoiding the need for real-time retraining.
The three-step framework for generating counterfactual explanations: simulating outcomes, training a surrogate model, and generating explanations.

The paper explores two definitions for the surrogate: a Regression approach (predicting exact score difference) and a Classification approach (predicting directional movement).

Results and Evaluation

The framework was evaluated using industry benchmarks (MovieLens-100K, Netflix, Amazon Music) against Matrix Factorization (SVD) and Neural Collaborative Filtering (NCF) models.

Validity and Efficiency

In tests on MovieLens, the Linear Surrogate generated explanations that were 82% valid (the recommendation actually disappeared when items were removed). In contrast, the Influence Function baseline was only 35.5% valid, and KNN was a mere 17%. Furthermore, the surrogate model generates explanations in roughly 2 seconds—significantly faster than Influence Functions (~6.5 seconds).

User Satisfaction

A user study on Amazon Mechanical Turk found that users rated the counterfactual explanations significantly higher than traditional item-based explanations, finding them more helpful and convincing.

User ratings comparing traditional item-based explanations to the proposed counterfactual explanations.

Conclusion

This learning-based framework provides technically valid and user-satisfying "what-if" explanations for recommendations. By bypassing the computational cost of retraining through surrogate modeling, it offers a scalable path toward more transparent and controllable recommender systems. Future work includes addressing the global "ripple effects" of retraining and refining search strategies for even faster explanation generation.

Summary updated

BibTeX
@misc{yao2022learning,
  author = {Yuanshun Yao and Chong Wang and Hang Li},
  title = {{Learning to Counterfactually Explain Recommendations}},
  year = {2022},
  eprint = {2211.09752},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2211.09752},
}
Figure