A Chain-of-Thought Approach to Semantic Query Categorization in e-Commerce Taxonomies
Jetlir Duraj, Ishita Khan, Kilian Merkelbach, Mehran Elyasi
TL;DR
This work tackles the challenge of mapping user queries to semantically relevant leaf categories within large e-commerce taxonomies, addressing bias and sparsity in demand signals. It introduces a Chain-of-Thought Breadth-First-Search (CoT BFS) framework that integrates iterative LLM-based semantic scoring with a tree-search over taxonomy leaves, including context injection to reflect user intents and brand origins. The approach is evaluated against a k-NN baseline using human judgments, an AI pseudo-reference, and retrieval tests, demonstrating superior F1, precision, and recall, and revealing taxonomy gaps for targeted improvements. The methodology offers practical impact for improving search relevance and navigation at scale, while providing diagnostic tools to refine and expand taxonomies; scalability refinements (CoT-k-NN BFS and leaf-based k-NN + LLM) enable deployment across millions of queries.
Abstract
Search in e-Commerce is powered at the core by a structured representation of the inventory, often formulated as a category taxonomy. An important capability in e-Commerce with hierarchical taxonomies is to select a set of relevant leaf categories that are semantically aligned with a given user query. In this scope, we address a fundamental problem of search query categorization in real-world e-Commerce taxonomies. A correct categorization of a query not only provides a way to zoom into the correct inventory space, but opens the door to multiple intent understanding capabilities for a query. A practical and accurate solution to this problem has many applications in e-commerce, including constraining retrieved items and improving the relevance of the search results. For this task, we explore a novel Chain-of-Thought (CoT) paradigm that combines simple tree-search with LLM semantic scoring. Assessing its classification performance on human-judged query-category pairs, relevance tests, and LLM-based reference methods, we find that the CoT approach performs better than a benchmark that uses embedding-based query category predictions. We show how the CoT approach can detect problems within a hierarchical taxonomy. Finally, we also propose LLM-based approaches for query-categorization of the same spirit, but which scale better at the range of millions of queries.
