Abstract
Retrieval, the initial stage of a recommendation system, is tasked with down-selecting items from a pool of tens of millions of candidates to a few thousands. Embedding Based Retrieval (EBR) has been a typical choice for this problem, addressing the computational demands of deep neural networks across vast item corpora. EBR utilizes Two Tower or Siamese Networks to learn representations for users and items, and employ Approximate Nearest Neighbor (ANN) search to efficiently retrieve relevant items. Despite its popularity in industry, EBR faces limitations. The Two Tower architecture, relying on a single dot product interaction, struggles to capture complex data distributions due to limited capability in learning expressive interactions between users and items. Additionally, ANN index building and representation learning for user and item are often separate, leading to inconsistencies exacerbated by representation and item drift. In this paper, we introduce the Hierarchical Structured Neural Network (HSNN), an efficient deep neural network model to learn intricate user and item interactions beyond the commonly used dot product in retrieval tasks, achieving sublinear computational costs relative to corpus size. A Modular Neural Network (MoNN) is designed to maintain high expressiveness for interaction learning while ensuring efficiency. A mixture of MoNNs operate on a hierarchical item index to achieve extensive computation sharing, enabling it to scale up to large corpus size. MoNN and the hierarchical index are jointly learnt to continuously adapt to distribution shifts in both user interests and item distributions. HSNN achieves substantial improvement in offline evaluation compared to prevailing methods.
Introduction
Modern large-scale recommendation systems typically employ a multi-stage pipeline. The retrieval stage is the most computationally constrained, as it must filter a massive item corpus (often >10 million items) down to a manageable candidate set in milliseconds. Traditionally, this has been solved using Embedding Based Retrieval (EBR) with Two-Tower architectures. While efficient, Two-Tower models suffer from limited expressiveness due to the simple dot-product interaction and suffer from "index drift" where the search index becomes inconsistent with the evolving model parameters.
Methodology
Modular Neural Network (MoNN)
To overcome the expressiveness bottleneck of the dot-product, we propose the Modular Neural Network (MoNN). Unlike the Two-Tower approach, MoNN incorporates three distinct components: a User Tower, an Item Tower, and a dedicated Interaction Tower. These towers feed into an "OverArch" (e.g., NeuMF or DHEN) to compute the final logit.
A key innovation within MoNN is the use of Inverted Index Based Interaction Features (I2IF). I2IF enables the efficient crossing of user and item features—such as matching user-engaged topics with item categories—at query time, allowing the model to capture complex non-linear interactions without the prohibitive cost of full cross-features.
Hierarchical Structured Neural Network (HSNN)
The HSNN framework scales the MoNN architecture to large corpora by utilizing a hierarchical item index. This structure allows for significant computation sharing. At the top levels of the hierarchy (coarse granularity), items are grouped into large clusters. We apply high-complexity MoNN variants (e.g., MoNN-XL) to these clusters. Because the cost is amortized over thousands of items represented by a single cluster, we can afford much more expressive models than in a flat retrieval setting. As the search descends to individual items (fine granularity), the model complexity is reduced (e.g., MoNN-Small) to maintain high throughput.
Jointly Optimized Indexing and MoNN (JOIM)
To address the inconsistency between representation learning and index building, we introduce JOIM. This method employs a gradient-descent-based "Learning To Index" (LTI) algorithm. By treating index assignment as a differentiable process during training, the model simultaneously learns the hierarchical cluster assignments and the network weights. This ensures the index remains optimal as the model adapts to online data shifts.
Evaluation and Results
The HSNN was evaluated on Meta's internal production ads datasets, comprising billions of training examples.
Offline Performance
A 3-layer HSNN configuration achieved a 1.46% reduction in Normalized Entropy (NE) and a 10% lift in Recall@K compared to a standard Two-Tower baseline. Notably, the inclusion of the Interaction Tower alone provided a 0.29% NE gain for even the smallest MoNN variant.
Efficiency and Scalability
HSNN enables the use of extremely complex models that would be computationally infeasible in a flat architecture. For instance, while a flat MoNN-XL would require 64x the infrastructure cost of a Two-Tower model, the hierarchical HSNN implementation achieves superior performance at only 4.5x the cost.
Online Impact
In production A/B tests at Meta, HSNN delivered a 2.57% gain in topline ads metrics. This represents a significant improvement in a highly optimized production environment.
Conclusion
The Hierarchical Structured Neural Network (HSNN) effectively resolves the trade-off between retrieval efficiency and model expressiveness. By combining modular interaction learning with a jointly optimized hierarchical index, HSNN allows deep, interaction-heavy models to scale to tens of millions of items with sublinear costs. Future work includes extending the hierarchical structure to the user side and exploring generative retrieval components.
Summary updated