Contextualized Generative Retrieval

Hyunji Lee, Jaeyoung Kim, Hoyeon Chang, Hanseok Oh, Sohee Yang, Vlad Karpukhin, Yi Lu, Minjoon Seo

Abstract

The generative retrieval model depends solely on the information encoded in its model parameters without external memory, its information capacity is limited and fixed. To overcome the limitation, we propose Nonparametric Decoding (Np Decoding) which can be applied to existing generative retrieval models. Np Decoding uses nonparametric contextualized vocab embeddings (external memory) rather than vanilla vocab embeddings as decoder vocab embeddings. By leveraging the contextualized vocab embeddings, the generative retrieval model is able to utilize both the parametric and nonparametric space. Evaluation over 9 datasets (8 single-hop and 1 multi-hop) in the document retrieval task shows that applying Np Decoding to generative retrieval models significantly improves the performance. We also show that Np Decoding is data- and parameter-efficient, and shows high performance in the zero-shot setting.

Introduction

Modern text retrieval is currently dominated by two paradigms: Bi-encoders (e.g., DPR) and Generative Retrieval (e.g., DSI, GENRE). Bi-encoders map queries and documents into a shared vector space, relying on simple vector similarities. However, they face an "embedding space bottleneck" and require substantial storage for document embeddings. Generative Retrieval models retrieve documents by generating unique identifiers token-by-token. While they allow for complex internal interactions, they suffer from a parametric bottleneck: the model must memorize the entire corpus within fixed weights. As the corpus grows, model size must scale aggressively.

This research introduces Nonparametric Decoding (Np Decoding) to bridge this gap, enabling generative models to access external, nonparametric information without sacrificing the benefits of autoregressive generation.

Methodology: Nonparametric Decoding

The core innovation, Np Decoding, replaces the standard "vanilla" vocabulary matrix in a transformer decoder with a Contextualized Embedding Matrix (CE). In a standard decoder, each token has one fixed embedding. In contrast, the CE contains multiple vectors for the same token, representing it in various contexts (e.g., distinguishing "Apple" as a tech company versus a fruit).

Overview of the Np Decoding architecture, showing the transition from vanilla embedding spaces to contextualized ones.

The authors propose three methods for constructing the CE:

  • BASE: Pre-trained encoders generate embeddings for all target sequences once before training.
  • ASYNC: Periodically updates the CE during training to synchronize the encoder and retriever.
  • CONTRA: Employs a novel token-level contrastive loss to structure the embedding space before generative learning begins.

To manage storage, k-means clustering is used. Instead of storing every contextualized embedding, the system saves only $k$ (typically 5) representative centroids per token. This captures 99.7% of the benefit while adding minimal storage overhead (~0.34GB).

Experimental Results

The approach was evaluated across 9 datasets, including the KILT benchmark (FEVER, NQ, TQA, zsRE), NQ-320k, and the multi-hop HotpotQA dataset. Np Decoding consistently outperforms vanilla generative retrieval across all benchmarks. On the KILT benchmark, the CONTRA variant improved R-precision by an average of 4.4%.

Performance comparison of Np Decoding (G*-variants) against baselines on the KILT benchmark.

Significant gains were also observed in specific models:

  • DSI Improvement: On NQ-320k, Np Decoding boosted Hits@1 from 13.3% to 60.4%.
  • Multi-hop Retrieval: On HotpotQA, the model achieved a 5.4% improvement in Recall@2.
  • Zero-Shot Performance: Np Decoding maintained higher accuracy in out-of-domain tests, demonstrating superior generalization compared to models relying solely on memorized parameters.

Discussion and Conclusion

Np Decoding demonstrates that context is vital; allowing models to distinguish word nuances effectively expands their "vocabulary" without increasing parameter counts. This leads to remarkable parameter efficiency, where a T5-base model with Np Decoding can outperform a vanilla T5-large model.

While the current clustering step makes handling dynamic corpora challenging, Np Decoding breaks the parametric bottleneck, offering a scalable and efficient path for generative retrieval. Future work will explore applications to larger decoder-only architectures and more dynamic indexing methods.

Summary updated

BibTeX
@inproceedings{lee2023contextualized,
  author = {Hyunji Lee and Jaeyoung Kim and Hoyeon Chang and Hanseok Oh and Sohee Yang and Vlad Karpukhin and Yi Lu and Minjoon Seo},
  title = {{Contextualized Generative Retrieval}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  url = {https://openreview.net/forum?id=mIUvvc7BzCQ},
}
Figure