Learning to Tokenize for Generative Retrieval

Weiwei Sun, Lingyong Yan, Zheng Chen, Shuaiqiang Wang, Haichao Zhu, Pengjie Ren, Zhumin Chen, Dawei Yin, Maarten de Rijke, Zhaochun Ren

Abstract

Generative Retrieval (GR) represents a paradigm shift in document retrieval, where models directly generate document identifiers (docids) for a given query. However, current GR systems often rely on heuristic docids that fail to capture semantic nuances, leading to poor generalization on unseen documents. We present GenRet, a framework that learns to tokenize documents into semantic, discrete identifiers using a discrete auto-encoding approach. By forcing docids to be reconstructible into original text, GenRet creates a rich semantic index. Our results demonstrate that GenRet achieves state-of-the-art performance on benchmarks like NQ320K, particularly excelling in retrieving documents not seen during training.

Introduction

Traditional information retrieval has long relied on dual-encoder architectures for dense retrieval or inverted indices for sparse retrieval. Generative Retrieval (GR) offers a promising alternative by framing retrieval as a sequence-to-sequence task. Despite its potential, GR faces a significant "docid bottleneck." Existing methods use rule-based identifiers—such as titles or cluster IDs from pre-trained embeddings—which are often ad-hoc and semantically shallow. This limitation prevents GR models from generalizing to new documents, a critical requirement for real-world search engines.

Methodology: The GenRet Framework

GenRet addresses the docid bottleneck by treating document tokenization as a learnable task. The framework consists of three integrated components:

  1. Tokenization Model ($Q$): A T5-based encoder that maps a document to a sequence of discrete tokens, forming its unique docid.
  2. Reconstruction Model ($R$): An auxiliary decoder that reconstructs the original document from the generated docid. This bottleneck ensures the docid captures essential semantic information.
  3. Retrieval Model ($P$): A sequence-to-sequence model trained to generate these learned docids in response to user queries.
The GenRet framework: Document tokenization via discrete auto-encoding and query-based retrieval.

Training Innovations

To ensure stable and effective learning, GenRet employs two key strategies:

  • Progressive Training: Instead of learning the entire docid sequence simultaneously, GenRet learns tokens iteratively ($T=1, 2, \dots$), fixing previous tokens to stabilize the autoregressive learning process.
  • Diverse Clustering: To avoid docid "collisions" (where multiple documents share the same ID), the model uses constrained K-Means for initialization and the Sinkhorn-Knopp algorithm for balanced re-assignment.

Experimental Evaluation

We evaluated GenRet on three diverse benchmarks:

  • NQ320K: A subset of Natural Questions used to test generalization on "seen" vs. "unseen" documents.
  • MS MARCO: A large-scale web search dataset.
  • BEIR: A zero-shot benchmark covering six distinct domains including Bio-medical and Financial.

Results and Discussion

GenRet establishes a new state-of-the-art on NQ320K, outperforming both dense retrieval baselines (e.g., GTR) and previous generative models (e.g., NCI).

Analysis of docid distribution and retrieval performance across seen and unseen document sets.

Key Findings

  • Semantic Generalization: On the NQ320K "unseen" test set, GenRet achieved a 14% relative improvement in Recall@1 over the best generative baseline. This confirms that learned semantic docids enable the model to "understand" documents it hasn't explicitly memorized.
  • Zero-Shot Capability: On BEIR, GenRet outperformed standard BM25 and remained competitive with state-of-the-art dense retrievers, demonstrating robust cross-domain performance.
  • Retrieval Efficiency: GenRet offers faster online retrieval (0.16s for Top-100) compared to models like DSI (0.32s), attributed to its more structured and efficient docid space.

Conclusion and Future Work

GenRet demonstrates that learning to tokenize is a viable path toward solving the docid bottleneck in generative retrieval. By aligning docids with document semantics through reconstruction, we bridge the gap between generative and dense retrieval. Future research will focus on scaling GenRet to billion-scale corpora and exploring pre-training strategies to further refine the semantic quality of learned identifiers.

Summary updated

BibTeX
@inproceedings{sun2023learning,
  author = {Weiwei Sun and Lingyong Yan and Zheng Chen and Shuaiqiang Wang and Haichao Zhu and Pengjie Ren and Zhumin Chen and Dawei Yin and Maarten de Rijke and Zhaochun Ren},
  title = {{Learning to Tokenize for Generative Retrieval}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=UKd6dpVGdu},
}
Figure