Abstract
E-commerce search queries are notoriously short and ambiguous, making it difficult for search engines to accurately determine user intent. This paper introduces an end-to-end, context-aware model that utilizes a session graph and graph attention mechanisms to leverage a user's recent search history. By explicitly modeling cross-query relations, the proposed system significantly improves query rewriting, boosting search relevance by over 20% in real-world large-scale tests.
Introduction
When a user types "bumblebee costumes" into a search bar, the intent could range from a simple insect outfit to a complex Transformer character suit. Traditional e-commerce search engines often rely on global statistical rules, which ignore individual session context. While some modern models attempt to incorporate search history, they frequently struggle with "noisy" data or require extensive human-labeled datasets to understand semantic similarity.
The authors address this by creating a model that automatically interprets the context of a shopping session—previous searches—to disambiguate the current query. This model is trained directly on raw search logs, eliminating the need for manual intervention.
Methodology
The researchers proposed a multi-stage architecture built upon a Transformer backbone, integrating graph-based reasoning to capture session-level context.
1. Transformer Encoder
The current "source" query and all preceding "history" queries in the session are encoded into vector representations.
2. Session Graph and Graph Attention (GAT)
The model constructs a session graph where nodes represent queries and individual tokens. If two searches share a word, they are connected. The Graph Attention Mechanism (GAT) iteratively updates these representations, allowing tokens to "learn" from their parent queries and vice versa. This explicitly models the relationships between disparate searches in a session.
3. Aggregation and Decoding
An Aggregation Network uses an attention mechanism to filter the session history, retaining only the information pertinent to the current search. Finally, a Transformer Decoder combines the current query representation with this filtered context to generate a precise, rewritten query (e.g., transforming "bumblebee costumes" into "transformers bumblebee costume").
Experimental Results
The model was evaluated using in-house data from a major e-commerce platform, comprising approximately 3 million sessions and 18.7 million queries.
Performance Metrics
The Transformer+Aggregation+Graph model significantly outperformed standard baselines:
- Ranking Accuracy: Achieved an 11.6% improvement in MRR (Mean Reciprocal Rank) and a 20.1% improvement in HIT@16 compared to a standard Transformer model.
- Efficiency: The model is 20% smaller than a standard BERT-base model, facilitating high-traffic online deployment.
Key Insights
- Graphs Over Recursion: Unlike RNNs, which may forget early session data, the session graph treats history as a web of related concepts, capturing high-order relations more effectively.
- Self-Supervision: By using the query that led to a purchase as the ground truth, the model scales cheaply without human labeling.
- The Pre-training Paradox: Interestingly, while pre-trained models like BART improved text fluency (BLEU), they performed slightly worse on ranking metrics (MRR) than a Transformer trained from scratch, suggesting that search query "language" is distinct from standard natural language.
Conclusion
The proposed system demonstrates that session history acts as a powerful filter for disambiguating intent. In live A/B tests involving 30 million sessions, the system increased revenue and reduced the need for manual query reformulations. Future work may involve expanding the session graph to include product categories or specific items viewed to provide even deeper contextual insights.
Summary updated