Recommender Forest for Efficient Retrieval

Chao Feng, Wuchao Li, Defu Lian, Zheng Liu, Enhong ChenNeurIPS 2022

TL;DR: RecForest is a novel retrieval framework for large-scale recommender systems that replaces traditional decoupled search indexes with a forest of $K$-ary trees. By using a Transformer decoder to route users through these trees and sharing parameters across levels, it achieves state-of-the-art accuracy with significantly lower memory overhead and faster inference than existing tree-based or ANN-based methods.

The Retrieval Bottleneck in Recommender Systems

Modern recommender systems (RS) face a classic "needle in a haystack" problem: retrieving the top-$n$ most relevant items from a catalog of millions in mere milliseconds. The standard industry approach relies on a two-stage pipeline:

  1. Representation Learning: Mapping users and items into a shared latent embedding space.
  2. Approximate Nearest Neighbor (ANN) Search: Using an index (like HNSW or SCANN) to find items close to the user's embedding.

The authors of this paper argue that these two stages are fundamentally incompatible. Because the embedding model is learned independently of the index structure, the index often fails to capture the nuances of the learned space, leading to a loss in recommendation accuracy. While previous "jointly optimized" tree models (like Alibaba's TDM and JTM) attempted to fix this, they suffered from high memory usage, sensitivity to "boundary" items (items that fall between clusters), and expensive training cycles that required constant tree re-structuring.

The RecForest Architecture

To overcome the incompatibility problem, RecForest introduces three major architectural shifts:

The RecForest architecture featuring an Encoder-Decoder routing framework and a forest of balanced trees.
  • From Tree to Forest: Instead of relying on a single binary tree, RecForest uses multiple $K$-ary trees. This "forest" approach ensures that if an item is poorly partitioned (placed near a boundary) in one tree, it is likely well-positioned in another. This ensemble effect drastically reduces retrieval errors caused by rigid hierarchical clustering.
  • Transformer-Based Routing: Traditional tree models make routing decisions (which branch to take next) based only on the current node. RecForest treats routing as a sequence-to-sequence problem. It uses a Transformer decoder to look at the entire "routing trajectory"—the path taken from the root to the current node—to make more accurate predictions about the next branch.
  • Extreme Parameter Sharing: In older models, every node in the tree had its own embedding, leading to massive memory consumption. RecForest shares branch parameters across all levels of the tree. For a $K$-ary tree, it only needs to store $K$ vectors per tree, making the index size $O(TKD)$ instead of $O(ND)$ (where $N$ is the number of items and $T$ is the number of trees).

Key Insights and Innovations

  • The "Boundary" Fix: Hierarchical clustering often splits similar items into different branches. By using a forest, RecForest provides multiple "paths" to the same item, effectively creating an ensemble effect for retrieval that mitigates boundary issues.
  • Trajectory Matters: The path an algorithm takes through a tree contains valuable semantic information. By using a Transformer to attend to this path, the model gains context that local, node-based decisions lack.
  • Index as a Model, Not Just a Map: RecForest treats the index not as a static data structure, but as a learnable component of the neural network. This allows the "search" logic to evolve alongside the user representations.
  • Training Efficiency: Because the forest structure is robust, the authors found they didn't need to constantly update the tree structure during training (a major bottleneck in previous models like JTM), saving significant computational resources.

Experimental Results

The authors evaluated RecForest on six diverse, large-scale recommendation datasets: MovieLens 10M, Amazon Books, Tmall Click, Gowalla Check-in, Microsoft News (MIND), and Yelp. These datasets cover both sequential (user history) and non-sequential (user features) recommendation scenarios.

Performance comparison showing RecForest achieving higher NDCG@20 across various inference times compared to baselines.
  • Accuracy: RecForest outperformed all competitive baselines (including JTM, TDM, and SOTA ANN indexes like SCANN and IPNSW) across all six datasets. On the Gowalla dataset, it improved NDCG@20 by a staggering 45.78% over the best baseline.
  • Memory Efficiency: Thanks to parameter sharing, RecForest's index is incredibly lean. For the MovieLens dataset, the index took only 3.21 MB, compared to 10.8 MB for JTM/TDM and 10.08 MB for IPNSW.
  • Inference Speed: Despite using a Transformer, RecForest is highly parallelizable on GPUs. It achieved inference times faster than or comparable to SCANN, which is widely considered the gold standard for Maximum Inner Product Search (MIPS) efficiency.

Limitations and Future Directions

While highly effective, the model currently relies on beam search for decoding. Although $K$-ary trees keep the depth shallow, very large beam sizes could still impact latency in ultra-high-throughput environments (an autoregressive bottleneck). Additionally, while the model is robust to the initial tree partition, the authors suggest that learning the index structure itself (rather than using K-means) could be a promising future direction.

Moving forward, the authors plan to explore non-autoregressive prediction to further speed up inference and investigate multi-task learning to improve the quality of the shared branch embeddings.

Summary updated

BibTeX
@inproceedings{feng2022recommender,
  author = {Chao Feng and Wuchao Li and Defu Lian and Zheng Liu and Enhong Chen},
  title = {{Recommender Forest for Efficient Retrieval}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=Yc4MjP2Mnob},
}
Figure