Knowledge Distillation based Contextual Relevance Matching for E-commerce Product Search

Ziyang Liu, Chaokun Wang, Hao Feng, Lingfei Wu, Liqun Yang

This research, presented at EMNLP 2022, introduces a practical framework for improving e-commerce search by combining the deep semantic understanding of Transformers with the structural context of user behavior graphs.

The Relevance Challenge in E-commerce

In large-scale e-commerce platforms like JD.com, relevance matching is critical. A search for "mac pro" should return a high-end laptop, not "mac lipstick." However, achieving high accuracy at scale involves overcoming three primary hurdles:

  1. Speed-Accuracy Trade-off: High-performance Transformer models like BERT are too slow for real-time search, where latency requirements are often under 50ms.
  2. Noisy Interaction Data: Models often train on user clicks, but clicks are noisy—users frequently click irrelevant items out of curiosity or by mistake.
  3. Contextual Isolation: Most models treat query-item pairs in isolation, ignoring the rich structural information in search logs where queries and items form a complex bipartite graph.

Methodology: The BERM Framework

To address these challenges, the authors introduced BERM (Bipartite graph Embedding for Relevance Matching), a framework that leverages Knowledge Distillation to transfer semantic knowledge from a powerful teacher to a graph-aware student.

The three-stage Knowledge Distillation framework for BERM, involving graph refinement by a BERT teacher and subsequent distillation into online models.

The process follows three main stages:

  1. Teacher Training & Graph Refinement: A BERT model is fine-tuned on high-quality human-labeled data. This "Teacher" is then used to clean the raw search log graph. It removes "noisy" edges (clicks on irrelevant items) and adds "missing" edges where items are highly relevant but weren't clicked.
  2. Student Model (BERM): The student model captures both 0-order relevance (direct text matching) and k-order relevance. The latter uses "metapaths" (e.g., Query → Item → Query) to incorporate context from neighboring nodes in the graph, using a Graph Attention mechanism to weight the most informative neighbors.
  3. Online Distillation (BERM-O): For production deployment, BERM is distilled into a lightweight two-layer neural network (BERM-O) to meet the extreme latency demands of 150 million daily queries.

Key Insights

  • Refining the Signal: Using the BERT teacher as a graph filter is a key innovation. By pruning the graph, the student learns from a much cleaner signal than raw click logs provide.
  • Structural Context: The model resolves ambiguity through its neighbors. For example, if a query is "nissan thermos cup," the graph context helps distinguish the brand "Nissan" from other unrelated brands by looking at what similar users interacted with.
  • Optimal Context Depth: Experiments showed that $k=2$ (immediate neighbors) is the optimal depth. Higher values of $k$ introduce too much noise from distant nodes, degrading performance.
  • Isomeric Distillation: Unlike traditional distillation where the student mimics the teacher's architecture, this uses "isomeric" distillation—the student (a graph-based model) is architecturally different from the teacher (a Transformer), allowing it to capture structural features the teacher cannot.

Experimental Results

BERM was evaluated against 17 state-of-the-art baselines using massive real-world datasets from JD.com (Data-E, Data-A, and Data-S).

Comparison of BERM against various baseline models across multiple metrics and datasets.

The results demonstrate that BERM consistently outperforms existing methods:

  • Offline Performance: BERM achieved the highest AUC and F1-scores while significantly reducing the False Negative Rate (FNR).
  • Online Impact: In live A/B testing on JD.com, the distilled BERM-O model led to a 5.7% increase in UV-value (gross merchandise volume per user) and a 5.5% increase in RPM (revenue per mille) in price-sort mode.

Conclusion

By combining the semantic depth of Transformers with the structural context of bipartite graphs, BERM provides a scalable solution for e-commerce relevance. The use of "isomeric" distillation allows the system to be both fast enough for production and smart enough to handle complex, noisy user behavior.

Summary updated

BibTeX
@inproceedings{liu2022knowledge,
  author = {Ziyang Liu and Chaokun Wang and Hao Feng and Lingfei Wu and Liqun Yang},
  title = {{Knowledge Distillation based Contextual Relevance Matching for E-commerce Product Search}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.emnlp-industry.5},
}
Figure