Distant Supervision for E-commerce Query Segmentation via Attention Network

Zhao Li, Donghui Ding, Pengcheng Zou, Yu Gong, Xi Chen, Ji Zhang, Jianliang Gao, Youxi Wu, Yucong DuanarXiv 2020

Abstract

Accurate query segmentation is fundamental to e-commerce search performance, yet traditional methods struggle with the dynamic nature of e-commerce vocabulary and the lack of large-scale labeled datasets. This paper introduces a novel framework that utilizes distant supervision to automatically label training data and an attention-based BiLSTM-CRF model that incorporates external product context. By leveraging external documents, the model effectively handles out-of-vocabulary (OOV) terms, significantly outperforming existing segmentation tools in specialized domains like fashion and accessories.

Introduction

In e-commerce, search queries are often short, telegraphic, and lack standard grammatical structure (e.g., "highwaistedlongdress"). Segmenting these queries into meaningful units (e.g., "high waisted", "long dress") is crucial for downstream tasks like intent classification and product retrieval. Two primary challenges hinder this process:

  1. Data Scarcity: Manual labeling for deep learning is prohibitively expensive and slow.
  2. Out-of-Vocabulary (OOV) Words: New brands and attributes emerge daily, rendering static dictionaries and pre-trained general-purpose models obsolete.

General-purpose Chinese Word Segmentation (CWS) tools, trained on formal text like news or literature, often fail to capture the specific shorthand and evolving semantics of e-commerce queries.

Methodology

System Pipeline

The proposed system follows a multi-stage pipeline designed to enrich short, context-poor queries with external knowledge harvested from product documentation.

The overall pipeline of the proposed query segmentation system, from query input to final segmentation using external context.

The process begins with a query log and a repository of external product documents. For a given query, the system searches for relevant context in external documents, extracts features through subtraction alignment, and feeds them into the neural model for final labeling.

Distant Supervision for Data Labeling

To overcome the lack of labeled data, the researchers employed distant supervision. They constructed a comprehensive dictionary from product metadata, including brand names, product categories, and specific attributes. Using a "max-matching" algorithm—a greedy approach that identifies the longest possible dictionary matches within a string—they automatically labeled a massive query log. This process generates the "gold standard" training data required for deep learning without the prohibitive cost of manual annotation.

Attention-Based BiLSTM-CRF Model

The core of the segmentation engine is an attention-based architecture consisting of three main components:

Detailed architecture of the Attention-Based BiLSTM-CRF model, including the Query Encoder, Feature Encoder, and Label Decoder.
  1. Query Encoder: A Bidirectional LSTM (BiLSTM) that processes character-level embeddings of the query. By reading the query in both directions, it captures the internal dependencies and local context of each character.
  2. Feature Encoder: This module is the primary innovation for addressing the OOV problem. For each character in the query, the system retrieves neighboring bi-grams from a large corpus of external product documents. Since not all retrieved contexts are equally useful, an Attention Mechanism is applied. It calculates a relevance weight for each external context relative to the query character, allowing the model to prioritize informative signals and ignore noise. The encoder then extracts "distance features" based on the character's proximity to known boundaries in these external texts.
  3. Label Decoder: A Conditional Random Field (CRF) layer sits atop the network. Unlike a simple softmax, the CRF considers the transition probabilities between labels (e.g., an 'I' tag cannot follow an 'O' tag without a 'B' tag), ensuring the final predicted sequence is globally optimal and logically consistent.

Experimental Results

The model was evaluated on two e-commerce categories: Dresses and Bags.

Category Model F1-Score Query Accuracy (QA)
Dresses Jieba (Baseline) 0.538 -
BiLSTM-CRF (Standard) 0.804 -
Proposed (Q+C) 0.853 75.9%
Bags Best Baseline 0.844 -
Proposed (Q+C) 0.867 83.7%

The results demonstrate that incorporating external context (Q+C) provides a substantial performance boost, particularly in the Dress category where OOV terms are more prevalent. The high Query Accuracy (QA) indicates the model's robustness for production environments.

Key Insights

  • Contextual Enrichment: External product descriptions serve as a "lifeline" for short, ambiguous queries, providing the necessary linguistic context for accurate segmentation.
  • Attention as a Filter: The attention mechanism is vital for filtering noise from external documents, ensuring the model focuses on high-quality boundary signals rather than random co-occurrences.
  • Robustness to OOV: By looking "outside" the query, the model can correctly segment terms it has never seen in the training set, provided they appear in external product documentation.

Conclusion

This research presents a scalable and effective approach to e-commerce query segmentation. By combining distant supervision with an attention-based neural network that leverages external knowledge, the authors successfully address the dual challenges of data scarcity and OOV terms. Future work will focus on optimizing the computational efficiency of external context retrieval to meet the low-latency requirements of real-time search engines.

Summary updated

BibTeX
@misc{li2020distant,
  author = {Zhao Li and Donghui Ding and Pengcheng Zou and Yu Gong and Xi Chen and Ji Zhang and Jianliang Gao and Youxi Wu and Yucong Duan},
  title = {{Distant Supervision for E-commerce Query Segmentation via Attention Network}},
  year = {2020},
  eprint = {2011.04166},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2011.04166},
}
Figure