C2T-ID: Converting Semantic Codebooks to Textual Document Identifiers for Generative Search

Yingchen Zhang, Ruqing Zhang, Jiafeng Guo, Wenjun Peng, Sen Li, Fuyu Lv, Xueqi Cheng

Abstract

Generative Retrieval (GR) represents a paradigm shift in information retrieval, where models generate document identifiers (docids) token-by-token. However, the choice of docid presents a significant trade-off: abstract numeric identifiers provide structure but ignore the model's pre-trained semantic knowledge, while natural language titles offer semantic richness but suffer from an unconstrained search space. This paper introduces C2T-ID, a method that bridges this gap by converting hierarchical semantic codebooks into textual identifiers using high-frequency metadata keywords. Our results on Natural Questions and Taobao Product Search demonstrate that C2T-ID significantly outperforms existing docid strategies, particularly in zero-shot scenarios.

Introduction

In the evolving landscape of Generative Retrieval (GR), the model's task is to directly "write" the identifier of a relevant document in response to a query. This approach eliminates the need for external index structures like MIPS (Maximum Inner Product Search) used in traditional dense retrieval. However, the effectiveness of GR is heavily dependent on the design of the document identifier (docid).

Current methodologies generally fall into two categories. Semantic Codebooks use hierarchical clustering to assign numeric paths (e.g., 1-15-3) to documents. While these provide a manageable, constrained search space, the numbers are semantically opaque to Large Language Models (LLMs). Conversely, Textual Docids use document titles or URLs. While these leverage the LLM’s pre-trained knowledge, the search space—the entire vocabulary—is massive, making the model prone to errors at the very first token.

C2T-ID (Codebook-to-Text ID) addresses this trade-off by creating identifiers that are both hierarchically structured and semantically meaningful.

The C2T-ID Framework

The C2T-ID pipeline transforms abstract cluster nodes into keyword-based textual identifiers through a four-stage process:

  1. Hierarchical Clustering: The process begins by building a standard semantic tree. Document embeddings are subjected to recursive k-means clustering, assigning each document a numeric path through the tree.
  2. Metadata Extraction: The system extracts high-quality keywords from document metadata. For general knowledge tasks like Wikipedia retrieval, this involves category labels; for specialized domains like e-commerce, it utilizes product attributes such as "brand," "material," or "intended use."
  3. Textual Replacement: This is the pivotal step. For every node in the hierarchical tree, C2T-ID identifies the most frequent keywords among the documents within that branch. The abstract node number is then replaced with a string of these top-$K$ keywords (e.g., replacing node 12 with Smartphone-Apple-Smart).
  4. Semantic Smoothing (Optional): To further align the identifiers with natural language, an LLM can be used to paraphrase these hyphenated keywords into fluid phrases (e.g., "battery charger for phone") and insert connective words between tree levels.

By replacing numbers with words, the "search space" at any given generation step remains limited to the children of the current node, but the tokens themselves are concepts the LLM already understands.

Experimental Evaluation

The authors evaluated C2T-ID across two distinct benchmarks to test both general knowledge and commercial scalability:

  • Natural Questions (NQ): A Wikipedia-based dataset where the model retrieves articles to answer user queries.
  • Taobao Product Search (TB): A large-scale e-commerce dataset featuring millions of products, testing the system's performance in a high-volume, real-world environment.

Key Results

C2T-ID demonstrated superior performance over both numeric and title-based baselines:

  • Retrieval Accuracy: On the NQ dataset, C2T-ID achieved a 34.3 Hits@5, significantly higher than semantic codebooks (28.3) and title-based docids (25.5).
  • E-commerce Scalability: On the Taobao dataset, the gains were even more pronounced, with C2T-ID reaching 64.0 Hits@5 compared to 51.6 for numeric codebooks. Notably, this generative approach outperformed traditional state-of-the-art dense retrieval (DPR) and BM25 on this large-scale task.
  • Zero-Shot Performance: One of the most striking findings was C2T-ID’s robustness in zero-shot settings. On NQ, it maintained a 33.5 Hits@5 without explicit training on query-document pairs, whereas numeric methods dropped to 22.0 Hits@5. This suggests that the semantic nature of the IDs allows the model to "reason" its way to the correct cluster.

Discussion and Insights

The success of C2T-ID highlights the importance of leveraging the "prior" knowledge of LLMs. Asking a model to navigate a numeric tree is akin to asking a human to memorize a random index; by using keyword-based IDs, the model can use its internal semantic map to navigate the document space. Furthermore, the constrained nature of the tree prevents the "hallucination" of invalid document names, a common failure mode in title-based retrieval.

However, the method is not without limitations. The primary trade-off is inference overhead. Because textual identifiers are longer than numeric ones, the model requires more decoding steps, which may impact latency. Additionally, the method's efficacy is tied to the availability of high-quality metadata. While "Semantic Smoothing" improves naturalness, its performance gains are modest relative to the computational cost of the LLM calls required during indexing.

Conclusion

C2T-ID provides a robust framework for document identification in Generative Retrieval. By grounding hierarchical structures in natural language keywords, it enables LLMs to perform more accurate and interpretable retrieval. Future work will likely focus on automating keyword extraction for metadata-poor datasets and optimizing decoding efficiency for long textual identifiers.

Summary updated

BibTeX
@inproceedings{zhang2025c,
  author = {Yingchen Zhang and Ruqing Zhang and Jiafeng Guo and Wenjun Peng and Sen Li and Fuyu Lv and Xueqi Cheng},
  title = {{C2T-ID: Converting Semantic Codebooks to Textual Document Identifiers for Generative Search}},
  booktitle = {International ACM SIGIR Conference on Research and Development in Information Retrieval},
  year = {2025},
  url = {https://openreview.net/forum?id=GzjsuCeoEO},
}
Figure