Generalization Error Bounds for Two-stage Recommender Systems with Tree Structure

Jin Zhang, Ze Liu, Defu Lian, Enhong Chen

Introduction

Modern recommender systems face a "needle in a haystack" problem: they must select a handful of relevant items from billions of options in mere milliseconds. To manage this immense scale, engineers typically deploy a two-stage pipeline:

  1. The Retriever: A fast, "coarse" model—often utilizing a tree structure to navigate the item space—that narrows down millions of items to a few hundred candidates.
  2. The Ranker: A slower, "fine-grained" model that leverages complex features to select the absolute best items from that small candidate pool.

While these two-stage systems are an industry standard, their theoretical foundations have historically been shaky. Specifically, there has been a lack of mathematical understanding regarding how the tree structure affects the system's ability to generalize to new users, or how the "distribution shift" between the two stages impacts overall performance. This paper provides the first rigorous theoretical analysis of generalization error for two-stage recommender systems that use tree-structured retrievers.

Methodology

The authors utilize Rademacher complexity—a measure of a model class's ability to fit random noise—to establish upper bounds on generalization error. Their theoretical framework involves several key components:

  • Error Decomposition: The total system error is broken down into two distinct parts: the probability that the retriever misses the target item entirely, and the probability that the ranker fails to pick the target item from the retrieved candidates.
  • Beam Search Analysis: The researchers provide the first proven generalization bounds for tree-based retrievers specifically using beam search (a greedy search algorithm that keeps the top-$K$ paths open).
  • Architectural Coverage: Bounds are derived for three common scoring models: Linear models, Multi-Layer Perceptrons (MLPs), and Target Attention models.
  • Distribution Harmonization: The study analyzes the impact of training the ranker on a "shifted" distribution. Specifically, it looks at the effects of training the ranker only on items that the retriever would actually surface during inference, rather than the entire dataset.

Datasets

The theoretical findings were validated using two well-known real-world datasets, pre-processed into implicit feedback (clicks/interactions) using sliding windows to capture user history:

  • Mind (Microsoft News Dataset): 36,281 users and 7,129 items.
  • Movie (MovieLens 10M): 69,878 users and 10,677 items.

Key Insights

  • The "Flatter is Better" Insight: The mathematical analysis reveals a term in the generalization bound proportional to $B/\sqrt{B^2 - 1}$, where $B$ is the number of branches per node. As $B$ increases, the tree becomes flatter. Theoretically, a flatter tree generalizes better because it behaves more like a single-stage model, even though it sacrifices some retrieval speed.
  • Harmonization is Essential: Standard systems often train rankers on all available data. However, the authors demonstrate that the ranker performs better when trained on a subset of data that has been "filtered" by the retriever. This aligns the training distribution with the inference distribution, effectively reducing the "disparity error" term in their derived bounds.
  • The Recall Threshold: For "harmonized" training to be effective, the retriever must possess a baseline level of quality. The authors found that a recall rate of at least 10% is typically necessary before the benefits of distribution alignment outweigh the loss of training sample size.

Results

Branching Impact

Experimental results on both the Mind and Movie datasets confirmed the theoretical propositions: increasing the number of branches in the tree retriever consistently improved Recall@20. For instance, on the Movie dataset, Recall@20 jumped significantly as the number of branches increased from 2 to 32.

Effect of branch number on Recall@20 for Mind and Movie datasets

Harmonized Two-Stage (H-TS) vs. Standard (TS)

The Harmonized Two-Stage (H-TS) model consistently outperformed the standard Two-Stage (TS) model in classification accuracy (Precision@1). On the Mind dataset with $K=80$ candidates, H-TS achieved an accuracy of 0.6026, compared to the standard model's 0.5970.

Limitations and Future Work

  • Sample Size Trade-off: Harmonizing the distribution requires training the ranker on a smaller subset of data (only what the retriever "sees"). If the initial dataset is small or the retriever is overly restrictive, the ranker may lack sufficient samples to learn effectively, which could widen the generalization gap.
  • Retriever Dependency: The ranker's performance improvement relies heavily on the retriever's recall. If the retriever is poor, the ranker is essentially forced to learn from low-quality candidates.
  • Future Directions: The authors suggest exploring joint optimization techniques where the tree structure and the ranker are updated simultaneously within this error-bound framework. This could help find the optimal balance between computational efficiency and generalization capability.

Summary updated

BibTeX
@inproceedings{zhang2024generalization,
  author = {Jin Zhang and Ze Liu and Defu Lian and Enhong Chen},
  title = {{Generalization Error Bounds for Two-stage Recommender Systems with Tree Structure}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=m1a4CrRJR7},
}
Figure