Fine-tune BERT for E-commerce Non-Default Search Ranking

Yunjiang Jiang, Yue Shang, Hongwei Shen, Wen-Yun Yang, Yun XiaoarXiv 2020

Abstract

In e-commerce, users frequently switch from default relevance-based rankings to non-default criteria such as ascending price or descending sales volume. This often leads to "relevance pollution," where low-priced accessories dominate the top results for a high-value query. This paper presents a winning two-stage ranking system developed for the SIGIR 2019 High Accuracy Recall challenge. By combining traditional keyword-based recall with a fine-tuned BERT-Large classifier and custom engineering optimizations, the system effectively filters irrelevant items at scale.

Introduction

The "Wild West" of e-commerce search occurs when users sort by non-default attributes. For instance, a search for "guitar" sorted by "lowest price" might return strings, picks, or unrelated cheap accessories at the top of the list. This mismatch between the user's intent and the sorting criteria hurts the user experience and platform profitability. The challenge lies in maintaining high relevance even when the primary sorting mechanism is agnostic to query-item matching.

Methodology: A Two-Stage Ranking Scheme

To address the scale of e-commerce data—often involving hundreds of millions of potential query-item pairs—the researchers proposed a hierarchical architecture.

The two-stage ranking pipeline: from coarse-grained recall to fine-grained relevance classification.
  1. Coarse-grained Item Recall: Traditional NLP techniques, including tokenization, stopword removal, stemming, and synonym expansion, are used to narrow down the initial pool of 150 million pairs to approximately 5 million candidate pairs.
  2. Fine-grained Relevance Classification: A fine-tuned BERT-Large model acts as a binary classifier to determine the actual relevance of the recalled items. Only items deemed relevant by the BERT model are passed through to the final sorting stage.

Technical Optimizations and Engineering

Deploying BERT at this scale required several domain-specific optimizations:

  • Sequence Length Reduction: While BERT typically uses a 128-token sequence, e-commerce queries and titles are notably short. Reducing the maximum length to 64 tokens halved memory usage and allowed for larger training batches without sacrificing accuracy.
  • Second-Phase Fine-Tuning: The team added a 2-layer Multi-Layer Perceptron (MLP) on top of BERT's second-to-last layer, providing a measurable boost in classification precision.
  • C++ Streaming Tokenizer: To eliminate the bottleneck of Python-based data preprocessing, the team implemented a custom C++ tokenizer operator for TensorFlow. This allowed for high-speed data conversion directly within the computation graph.
  • Distributed Prediction: The system utilized a parallel architecture across 40 GPUs (5 hosts) to handle the inference load for millions of candidate pairs.

Experimental Results

The system was evaluated using the SIGIR 2019 "High Accuracy Recall Task" dataset, which includes 899,000 documents and 150 queries. The researchers experimented with several BERT variants, including Whole Word Masking (WWM) and ensemble methods.

Performance metrics for various BERT model configurations on the SIGIR 2019 dataset.

The bert.wwm.mlp32 model achieved an F1 score of 0.8293, while an ensemble of five models pushed the final F1 score to 0.8451. These results secured 1st place in the supervised phase of the SIGIR challenge. Interestingly, the team found that while text-based features (titles) were highly effective, incorporating product images via Inception V3 did not yield significant improvements, suggesting that textual relevance remains the primary signal for e-commerce search.

Conclusion

This work demonstrates that fine-tuning BERT for specific domain constraints—such as short sequence lengths and high-throughput engineering requirements—can solve the relevance pollution problem in e-commerce. Future work will focus on BERT distillation to create faster, smaller models and the integration of implicit feedback signals like user clicks and purchase history.

Summary updated

BibTeX
@misc{jiang2020fine,
  author = {Yunjiang Jiang and Yue Shang and Hongwei Shen and Wen-Yun Yang and Yun Xiao},
  title = {{Fine-tune BERT for E-commerce Non-Default Search Ranking}},
  year = {2020},
  eprint = {2008.09689},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2008.09689},
}
Figure