Shareable Representations for Search Query Understanding

Mukul Kumar, Youna Hu, Will Headden, Rahul Goutam, Heran Lin, Bing Yin · DOI

Abstract

Understanding search queries is critical for shopping search engines to deliver a satisfying customer experience. Popular shopping search engines receive billions of unique queries yearly, each of which can depict any of hundreds of user preferences or intents. In order to get the right results to customers it must be known queries like "inexpensive prom dresses" are intended to not only surface results of a certain product type but also products with a low price. Referred to as query intents, examples also include preferences for author, brand, age group, or simply a need for customer service. Recent works such as BERT have demonstrated the success of a large transformer encoder architecture with language model pre-training on a variety of NLP tasks. We adapt such an architecture to learn intents for search queries and describe methods to account for the noisiness and sparseness of search query data. We also describe cost effective ways of hosting transformer encoder models in context with low latency requirements. With the right domain-specific training we can build a shareable deep learning model whose internal representation can be reused for a variety of query understanding tasks including query intent identification. Model sharing allows for fewer large models needed to be served at inference time and provides a platform to quickly build and roll out new search query classifiers.

Introduction

Modern e-commerce platforms process billions of unique search queries annually. These queries are often short, noisy, and highly varied in intent. A query like "cheap running shoes" indicates a price sensitivity (Low ASP intent), while "how to return a fire tv" indicates a need for customer support (Help intent). Accurately identifying these intents is paramount for providing relevant search results and a seamless user experience.

While large-scale Transformer models like BERT have revolutionized Natural Language Processing (NLP), their deployment in high-traffic, low-latency environments like search engines presents significant challenges. Hosting a separate 100-million-parameter model for every possible intent—of which there could be hundreds—is computationally prohibitive and financially unsustainable. This research explores a "model-as-a-service" approach, where a single large encoder is shared across multiple classification tasks, significantly reducing the infrastructure footprint while maintaining high accuracy.

Methodology

Domain-Specific Training (DST)

Standard BERT models are pre-trained on general-purpose text like Wikipedia. To better capture the nuances of e-commerce, the authors introduce Domain-Specific Training (DST). This involves training the Transformer encoder on an "extreme multi-label classification" task: predicting the product categories (out of tens of thousands) that users are likely to click on for a given query. This process conditions the model to the specific vocabulary and semantic relationships found in shopping data.

Shared Encoder Architecture

The proposed architecture utilizes a 12-layer Transformer encoder. To enable multi-tasking, the lower layers of the encoder are "frozen"—meaning their parameters are shared across all tasks and not updated during fine-tuning. Only the top layers and a final task-specific dense layer are tuned for individual intents.

Architecture of the shareable Transformer encoder with task-specific heads.

At inference time, a query passes through the shared frozen layers once. The resulting representation is then fed into multiple lightweight classification "heads" in parallel. This allows the system to identify dozens of intents with only a marginal increase in latency over a single-task model.

Datasets

The researchers evaluated their approach using several large-scale datasets derived from Amazon's anonymized logs:

  • DST Dataset: 4 billion query-to-category samples from the UK marketplace.
  • Help Intent: 2.5 million queries labeled for customer service vs. product search.
  • Adult Intent: 2.9 million queries identified via interactions with adult-classified products.
  • Low ASP (Average Selling Price): 3 million queries categorized by historical purchase price thresholds (e.g., above or below $10).

Results and Analysis

Performance Comparison

The experimental results demonstrate that Transformer-based models consistently outperform traditional baselines like Deep Neural Networks (DNNs) using n-grams. Furthermore, models pre-trained with DST generally outperformed those using standard BERT initialization, highlighting the value of domain-specific conditioning.

Performance comparison of different model architectures and pre-training strategies.

A key finding is the efficacy of layer freezing. As shown in the results table, freezing the first 10 layers and training only the top 2 (and the output head) often yielded performance comparable to training the entire 12-layer model. In the case of the "Adult" intent, the DST model with 10 frozen layers actually achieved a slightly higher accuracy (0.944) than the fully-tuned version (0.943). This indicates that the lower layers capture general semantic features that are broadly applicable across different e-commerce tasks.

Efficiency and Latency

By freezing 10 out of 12 layers, the number of task-specific parameters is reduced from approximately 109 million to 14 million. If only the final dense layer is tuned (12 layers frozen), the task-specific parameters drop to a mere 1,538. This massive reduction in parameters per task is what enables the scaling of hundreds of classifiers on shared hardware.

Latency tests confirmed the feasibility of this approach for real-time search. The 109M parameter model achieved inference times as low as 6ms on modern GPUs. However, larger models (e.g., 330M parameters) saw latency jump to over 300ms, suggesting a practical upper limit for real-time applications without further optimization like quantization or pruning.

Conclusion

This work demonstrates a scalable and efficient framework for query intent classification in e-commerce. By combining domain-specific pre-training with a shared, partially-frozen Transformer architecture, it is possible to deploy hundreds of high-accuracy classifiers with minimal infrastructure overhead. Future work will focus on handling data sparsity for rare queries and exploring more granular intent categories to further personalize the shopping experience.

Summary updated

BibTeX
@misc{kumar2019shareable,
  author = {Mukul Kumar and Youna Hu and Will Headden and Rahul Goutam and Heran Lin and Bing Yin},
  title = {{Shareable Representations for Search Query Understanding}},
  year = {2019},
  eprint = {2001.04345},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2001.04345},
}
Figure