TL;DR
Facebook Marketplace faces challenges in understanding user search intent due to noisy, imbalanced, and vague real-world data. This paper introduces HierCat, a novel hierarchical query categorization system that leverages a dual-encoder architecture and a hierarchical inference step to effectively learn from weakly supervised signals, significantly improving search relevance and user engagement.
What Problem Does This Paper Address?
Understanding what users are looking for is crucial for any e-commerce platform. For large-scale marketplaces like Facebook Marketplace, this involves mapping user search queries to a predefined product taxonomy. However, this task is fraught with difficulties:
- Noisy Training Data: Relying on user engagement (clicks, purchases) to label queries is common but results in noisy data. Users might click on a product that's only loosely related to their search, or categories themselves might be imprecisely labeled by sellers.
- Vague Search Intent: Unlike a product listing with a precise category, a search query can be ambiguous. For instance, "used electronics" is a broad category, not a specific product.
- Internationalization: A global platform needs to handle queries in multiple languages, but engagement data is naturally skewed towards more popular languages, making it hard to train models that perform well everywhere.
- Scalability: The system needs to handle millions of queries daily and integrate with existing search infrastructure.
Methods
HierCat tackles these challenges with a multi-pronged approach:
- Dual-Encoder Architecture: Instead of treating query categorization as a simple text classification problem, HierCat uses a two-tower architecture. One tower encodes the query, and the other encodes category labels. The similarity between these embeddings is used for classification. This is inspired by retrieval models and allows for better representation learning.
- Hierarchical Inference: Recognizing that the product taxonomy is a tree, HierCat incorporates this structure. After initial classification, a hierarchical inference step re-normalizes probabilities across the taxonomy. This means that if a query is likely to belong to a leaf category (e.g., "iPhone 13 cases"), the system also propagates that probability upwards to its parent categories (e.g., "Accessories," "Cell Phones," "Electronics"). This helps to consolidate predictions and reduce the impact of noisy, low-level labels.
- Weakly Supervised Training: The system is trained on millions of query-category pairs derived from user engagement logs, avoiding the need for expensive manual labeling.
- Pre-trained Encoders: To handle the multilingual nature of the platform and improve representation quality, HierCat utilizes XLM-encoder, a transformer model pre-trained on cross-lingual data. Additionally, it incorporates a pre-training task based on product retrieval (similar to Que2Search), which helps the query encoder learn more discriminative representations.
- Serving-Time Optimizations: For efficient deployment, HierCat uses techniques like category embedding caching and beam search to speed up inference and ensure consistent taxonomy path predictions.
Datasets
The primary dataset used is derived from 14 days of Facebook Marketplace's search engagement logs. This yielded approximately 24 million <query, category> pairs. For evaluation, a stratified sample of 173,000 queries across different regions and languages was used, with human raters mapping them to the correct categories. No new benchmark datasets were introduced; instead, the focus was on leveraging existing, large-scale, weakly supervised data.
Key Insights and Ideas
- Hierarchy is Key: The most significant insight is that explicitly modeling the hierarchical structure of the product taxonomy is crucial for robust query categorization, especially when dealing with noisy, weakly supervised data. The hierarchical inference step effectively mitigates noise by allowing probabilities to flow upwards.
- Dual-Encoder for Richer Representations: Applying a dual-encoder architecture, common in retrieval, to classification tasks proves effective. It allows for learning richer, more comparable representations for both queries and categories.
- Pre-training Pays Off: Pre-training the query encoder on a related task like product retrieval significantly boosts performance, particularly at the leaf levels of the taxonomy, suggesting that finer-grained representations are learned.
- Weak Supervision is Viable: The success of HierCat demonstrates that with the right architecture and inference strategies, weakly supervised signals from user engagement can be effectively harnessed for complex tasks like query categorization.
Key Results
- Offline Performance: HierCat, with its dual-encoder and hierarchical inference, outperforms baseline methods like FastText and standard XLM classification across various levels of the taxonomy (L1, L3, L6) in terms of F1 score and top-5 accuracy. For instance, it achieves a leaf-level (L6) F1 score of 0.259 and an accuracy of 0.369, outperforming other methods.
- Online A/B Testing: In a two-week A/B test on Facebook Marketplace Search:
- HierCat led to a 1.4% improvement in NDCG (Normalized Discounted Cumulative Gain).
- It resulted in a 4.3% increase in searcher engagement.
- Interestingly, NDCG improved with L1/L2 category boosts, but engagement only saw a significant boost when L3 (median level) matches were incorporated, highlighting the importance of granular matches for user satisfaction.
Limitations and Future Work
- Hierarchical Inference Parameter: The paper mentions that the parameter
ain line 6 of Algorithm 1 (controlling the impact of hierarchical inference vs. original prediction) was set to 1 and not tuned. Further tuning of this parameter could potentially yield even better results. - Future Directions: The authors suggest exploring more sophisticated ways to control the impact of hierarchical inference, potentially learning the parameter
aor using more complex aggregation functions. They also imply that the dual-encoder architecture and pre-training strategies could be applied to other related tasks within e-commerce search.
Summary updated