Session-Aware Query Auto-completion using Extreme Multi-Label Ranking

Nishant Yadav, Rajat Sen, Daniel N. Hill, Arya Mazumdar, Inderjit S. Dhillon

TL;DR

This paper reimagines session-aware query auto-completion (QAC) as an Extreme Multi-Label Ranking (XMR) problem rather than a generative task. By adapting the PECOS framework with prefix-aware indexing and position-weighted embeddings, the authors achieve sub-10ms latency and a 3.9x improvement in ranking quality, outperforming both traditional frequency-based methods and slow generative deep learning models.

What Problem Does This Paper Address?

Query auto-completion is the "search-as-you-type" feature we use every day. To be truly helpful, it needs to be session-aware: if you just searched for "digital camera" and then type "n," the system should suggest "nikon" over "nike."

Current solutions face a "trilemma" of challenges:

  1. Latency: Suggestions must appear within milliseconds of a keystroke.
  2. Context: Suggestions should reflect the user's recent history.
  3. Coverage: Traditional systems often pick from a small, pre-computed list of popular queries. If the right suggestion isn't in that tiny list, the system fails.

Generative models (like seq2seq) are great at context but are often too slow for real-time use and can occasionally hallucinate nonsensical queries. This paper seeks a middle ground: the speed of a retrieval system with the contextual intelligence of a deep learning model.

Methods

The authors introduce PrefXMRtree, a framework that treats the entire universe of past user queries (tens of millions) as "labels" in an Extreme Multi-Label Ranking problem.

Key innovations include:

  • Prefix-Aware Label Indexing: Standard XMR models cluster labels based on semantic similarity. PrefXMRtree uses a Hybrid Trie-Clustering approach. It uses a Trie structure for the first few characters to ensure prefix constraints are met, then switches to hierarchical 2-means clustering for the remaining labels to maintain a balanced, fast-to-search tree.
  • Position-Weighted TF-IDF: Traditional TF-IDF treats all parts of a string equally. The authors developed a version where character n-grams at the start of a query are weighted more heavily. This ensures that queries starting with the same characters are clustered together in the model's "brain."
  • Joint Input Encoding: The model represents the user's state by concatenating the TF-IDF vector of the previous query with the character n-gram vector of the current prefix.
  • The PECOS Backbone: The system builds on the PECOS (Prediction for Enormous and Correlated Output Spaces) framework, which allows for logarithmic-time search across millions of labels.

Datasets

The researchers evaluated their model on two major datasets:

  1. AOL Search Logs: A public dataset containing sequences of user queries. They extracted over 9 million query pairs and 5.5 million unique "next queries" (labels).
  2. Online Shopping Store Dataset: A massive proprietary dataset from a major e-commerce site (Amazon) consisting of 180 million data points and 23 million unique queries.

Key Insights and Ideas

  • XMR as Retrieval: The biggest "aha" moment is treating QAC as a ranking problem over a massive but fixed set of labels. This avoids the "hallucination" risk of generative models while providing much higher coverage than a simple "top-100" list.
  • The Power of Short Prefixes: Context matters most when the user has only typed 1–3 characters. The authors found that their session-aware model provided the most significant gains (up to 33% improvement) in these "ambiguous" early stages of typing.
  • Balancing the Tree: Pure Tries are great for prefixes but create "skewed" trees that are slow to traverse. By forcing "must-link" constraints (keeping same-prefix items together) within a balanced 2-means cluster, they achieved the best of both worlds: prefix-compliance and lightning-fast inference.

Key Results

  • Speed: The model maintains an inference latency of less than 10 ms, making it viable for production environments where every millisecond counts.
  • Accuracy: On the AOL dataset, PrefXMRtree showed a 3.9x improvement in Mean Reciprocal Rank (MRR) compared to a vanilla, out-of-the-box XMR baseline.
  • Real-world Impact: In a live A/B test on a production e-commerce search bar, the model yielded a 2.81% increase in the suggestion acceptance rate, a statistically significant win in the high-stakes world of online retail.
  • Comparison: While generative models (seq2seq-GRU) had slightly higher raw accuracy on some metrics, they were significantly slower and required expensive GPUs, whereas PrefXMRtree runs efficiently on standard CPUs.

Limitations and Future Work

  • Finite Label Space: Because this is a ranking model, it can only suggest queries it has seen before in the training data. It cannot "invent" a brand-new query for a trending topic it hasn't indexed yet.
  • Memory Footprint: Storing a hierarchical tree for tens of millions of labels requires significant RAM, though the authors note this is manageable for modern production servers.
  • Future Directions: The authors suggest exploring label space augmentation (adding synthetic queries) and using dense embeddings (like BERT) to represent the session context even more deeply, provided they can keep the latency within that critical 10ms window.

Summary updated

BibTeX
@inproceedings{yadav2021session,
  author = {Nishant Yadav and Rajat Sen and Daniel N. Hill and Arya Mazumdar and Inderjit S. Dhillon},
  title = {{Session-Aware Query Auto-completion using Extreme Multi-Label Ranking}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2021},
  url = {https://openreview.net/forum?id=YkYZp8NChDN},
}

Loading related content...

Figure