Search Query Embeddings via User-behavior-driven Contrastive Learning

Sosuke Nishikawa, Jun Hirako, Nobuhiro Kaji, Koki Watanabe, Hiroki Asano, Souta Yamashiro, Shumpei SanoNAACL 2025

Abstract

Understanding search query intent is a fundamental challenge in information retrieval due to the short, "telegraphic" nature of user input. Researchers at LY Corporation (Yahoo! JAPAN) have introduced UBIQUE (User Behavior-driven contrastive learning with Intent alignment for search QUery Embeddings), a framework that leverages large-scale user logs to train lightweight embedding models. By using clickthrough patterns and session reformulations as proxies for intent, UBIQUE creates embeddings that capture semantic meaning even when queries share no common words. Evaluation across multiple tasks shows that UBIQUE significantly outperforms much larger state-of-the-art models, offering a highly efficient solution for production-scale query understanding.

Introduction

Search queries are notoriously difficult for standard natural language processing models. Unlike prose, queries like "buy car" lack grammatical structure and context. Existing embedding models often fall into the "lexical trap," where similarity is determined by shared words rather than shared intent (e.g., failing to link "purchase automobile" with "buy car"). Furthermore, models pre-trained on long-form web text often struggle with the unique linguistic style of search queries. The authors sought to build "universal" query embeddings that prioritize intent over surface-level appearance.

Methodology: Mining User Intent

The UBIQUE framework employs contrastive learning to align query embeddings with user intent. The model is trained to minimize the distance between "positive pairs" (queries with similar intent) while maximizing the distance between "negative pairs." The core innovation lies in the automated mining of these positive pairs from two types of real-world user behavior logs:

  1. Clickthrough Data ($UBIQUE_{click}$): Queries are paired if they lead users to click the same set of URLs. To ensure high-quality pairs, a Jaccard coefficient threshold is applied to the clicked URL sets, filtering out noisy or generic clicks.
  2. Session Data ($UBIQUE_{session}$): Queries submitted by the same user within a 300-second window are treated as potential reformulations. These co-occurrences are aggregated across millions of users to identify stable intent-based pairs.
Overview of user behavior data sources for mining positive query pairs: (a) Clickthrough data and (b) Session data.

The base model is a Japanese DistilBERT (68M parameters), chosen for its efficiency in production environments compared to massive billion-parameter models.

Evaluation and Datasets

The models were trained on a massive dataset of 50 million query pairs mined from Yahoo! JAPAN Search logs. Evaluation was conducted using a "QU Benchmark" consisting of four tasks: Query-Synonym Retrieval (QR), Query Suggestion (QS), Query Classification (QC), and Short-Text Reranking (SR).

Key Results

UBIQUE demonstrates substantial improvements over both unsupervised and large-scale supervised baselines. $UBIQUE_{click}$ outperformed the 1.2B parameter $mE5_{large}$ model by an average of 8.7 points across the benchmark.

Robustness to Lexical Variation

A critical finding is UBIQUE's ability to maintain performance even when queries look different. While unsupervised models like SimCSE rely heavily on word overlap, UBIQUE's performance remains stable as the lexical similarity (measured by edit distance) decreases. On the Query-Synonym Retrieval task, UBIQUE achieved a Mean Reciprocal Rank (MRR) of 91.4, compared to just 28.5 for the SimCSE baseline.

Performance comparison (Average MRR) across different levels of lexical similarity (Normalized Levenshtein Similarity).

Qualitatively, for a query like "LA travel expenses," UBIQUE correctly identifies "Cost of a trip to Los Angeles" as a match, whereas baseline models often suggest unrelated queries that merely share the words "travel expenses."

Conclusion

UBIQUE proves that domain-specific "weak supervision" from user behavior is more effective for query understanding than general-purpose scaling. By using behavior as a high-fidelity proxy for intent, a relatively small model can achieve superior performance, making it both more accurate and more efficient for real-world search applications.

Summary updated

BibTeX
@inproceedings{nishikawa2025search,
  author = {Sosuke Nishikawa and Jun Hirako and Nobuhiro Kaji and Koki Watanabe and Hiroki Asano and Souta Yamashiro and Shumpei Sano},
  title = {{Search Query Embeddings via User-behavior-driven Contrastive Learning}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.naacl-industry.12},
}
Figure