Self-Retrieval: Building an Information Retrieval System with One Large Language Model

Qiaoyu Tang, Jiawei Chen, Bowen Yu, Yaojie Lu, Cheng Fu, Haiyang Yu, Hongyu Lin, Fei Huang, Ben He, Xianpei Han, Le Sun, Yongbin Li · DOI

Introduction

Traditional Information Retrieval (IR) systems are typically fragmented, relying on a multi-stage pipeline involving an indexer, a retriever (e.g., BM25 or dense vector models), and a separate reranker. While Large Language Models (LLMs) have been integrated into individual components of this pipeline, the separation often leads to a "knowledge gap" where retrievers fail to capture the nuances required by the LLM.

Self-Retrieval addresses this by transforming a single LLM into a complete, end-to-end IR system. By internalizing an entire corpus into its parameters and using constrained decoding to generate passages, it eliminates the need for external vector databases and separate reranking models, setting new performance benchmarks for retrieval and Retrieval-Augmented Generation (RAG).

Methodology

The Self-Retrieval framework unifies the IR pipeline into three stages within a single model (tested with Llama-2 and StableLM):

  1. Indexing (Internalization): The model "memorizes" the corpus through self-supervised learning on a sentence-to-passage task. Given a single sentence from the corpus, the model must reconstruct the entire parent passage, embedding the knowledge directly into its weights.
  2. Retrieval (Constrained Generation): Instead of looking up a vector, the model generates the relevant passage. To ensure the model generates actual documents from the corpus and avoids hallucinations, the system uses trie-based constrained decoding, restricting the model’s vocabulary at each step to sequences that exist in the original text.
  3. Reranking (Self-Assessment): After generating candidate passages, the model performs a self-critique. It generates a response indicating whether the passage can answer the query (e.g., "can answer" vs. "cannot answer"). The probabilities of these tokens are used to calculate a final relevance score for reranking.
Overview of the Self-Retrieval framework, illustrating the unified indexing, retrieval, and reranking stages within a single LLM.

Experimental Setup

The researchers evaluated Self-Retrieval on several standard IR benchmarks:

  • Natural Questions (NQ): Real-world Google search queries.
  • TriviaQA: A large-scale reading comprehension dataset.
  • MS MARCO: A dataset based on Bing searches, testing robustness in non-Wikipedia scenarios.
  • NQ320K: Specifically for document-level retrieval tasks.

Key Results

Self-Retrieval demonstrates significant performance gains over traditional and generative baselines. On the NQ dataset, the Llama 2-based Self-Retrieval model achieved an MRR@5 of 70.00, significantly outperforming state-of-the-art dense retrievers like BGE-FT (63.99) and generative baselines like DSI-XXL (50.20).

Performance comparison of Self-Retrieval against sparse, dense, and generative retrieval baselines on NQ and TriviaQA datasets.

Furthermore, the system outperformed complex two-stage pipelines (e.g., BGE-FT + RankGPT), proving that a single unified model can be more effective than a collection of specialized ones. In RAG experiments, Self-Retrieval improved Exact Match (EM) scores over traditional retriever-reader setups, showing that internalized knowledge is more accessible during answer generation.

Key Insights

  • Text as the "DocID": The document content itself is the best identifier. By forcing the model to generate the actual text, the system leverages the LLM's pre-existing linguistic knowledge rather than forcing it to learn abstract numeric mappings.
  • The Power of One: Unifying the pipeline allows for deep synergy. The model "knows" what it has internalized, how to retrieve it, and how to judge its own output.
  • Scaling Laws: Retrieval performance improves consistently as the model size increases, suggesting that larger LLMs will inherently become better retrievers.

Conclusion and Future Work

While Self-Retrieval sets new benchmarks, challenges remain regarding efficiency and scale. Generating text token-by-token is computationally more expensive than vector dot-products. Additionally, because the corpus is "baked into" the model weights, adding new information currently requires fine-tuning. Future research will focus on incremental learning and dynamic corpus expansion to make the system more practical for rapidly changing data.

Summary updated

BibTeX
@inproceedings{tang2024self,
  author = {Qiaoyu Tang and Jiawei Chen and Bowen Yu and Yaojie Lu and Cheng Fu and Haiyang Yu and Hongyu Lin and Fei Huang and Ben He and Xianpei Han and Le Sun and Yongbin Li},
  title = {{Self-Retrieval: Building an Information Retrieval System with One Large Language Model}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=DNPiVhkrHi},
}
Figure