Pre-training Tasks for Embedding-based Large-scale Retrieval

Wei-Cheng Chang, Felix X. Yu, Yin-Wen Chang, Yiming Yang, Sanjiv Kumar

In the world of search engines and question-answering systems, retrieving the right information is typically a "two-step" dance. First, a retrieval phase quickly narrows down millions of documents to a few hundred viable candidates. Next, a scoring phase uses a heavy-duty model (like BERT) to carefully cross-reference and re-rank those candidates.

While the scoring phase has seen massive leaps in accuracy thanks to deep learning, the retrieval phase has largely remained stuck in the past, relying heavily on sparse keyword-matching algorithms like BM-25. In this paper, researchers demonstrate how to bring the retrieval phase into the modern era using Transformer-based embeddings and a clever set of paragraph-level pre-training tasks.

The Retrieval Bottleneck

The "retrieval bottleneck" is a major hurdle in natural language processing. Modern models like BERT are exceptional at comparing a query to a document using cross-attention, but this process is computationally expensive. Running a cross-attention BERT model against 10 million documents in real-time would take hours, not milliseconds.

Comparison of the Two-Tower retrieval model (left) and the Cross-attention scoring model (right).

To solve this, researchers use embedding-based retrieval via a Two-Tower architecture. In this setup, one Transformer "tower" encodes the query into a dense vector, and another encodes the document. Because the documents can be pre-computed and stored as vectors, the system only needs to calculate the similarity between the query vector and document vectors using a simple inner product. This allows for lightning-fast searches using Maximum Inner Product Search (MIPS) algorithms.

However, standard pre-training objectives—like the Masked Language Modeling (MLM) used in BERT—focus on predicting missing words within a single sequence. This token-level training doesn't necessarily teach a model whether a specific paragraph is a good answer to a specific question. Consequently, out-of-the-box Transformers often perform worse than simple keyword matching in the retrieval stage.

Paragraph-Level Pre-training Tasks

The core innovation of this paper lies in Paragraph-level Pre-training Tasks. Instead of just masking tokens, the authors propose three tasks designed to teach the model different semantic granularities and relationships between separate blocks of text:

Visual examples of the paragraph-level pre-training tasks derived from Wikipedia pages.
  1. Inverse Cloze Task (ICT): A sentence is sampled from a paragraph and treated as the "query," while the rest of the paragraph serves as the "document." This teaches the model that a query and its surrounding context are semantically related, mimicking the structure of a question-answer pair where the query is specific and the document provides supporting context.
  2. Body First Selection (BFS): A sentence from the first section (the summary) of a Wikipedia page acts as the query, and a random passage from the same page is the document. This captures global "aboutness" and thematic consistency within an article.
  3. Wiki Link Prediction (WLP): A sentence from the first section of a Wikipedia page is the query, and a passage from a different page that hyperlinks to the first page is the document. This captures high-level semantic links between related but distinct topics.

Key Results and Insights

The models were evaluated on the Retrieval Question-Answering (ReQA) benchmark, which includes datasets like SQuAD, Natural Questions (NQ) from real-world Google searches, and an Open-Domain Wikipedia set with 1 million candidate passages to test scalability.

The results show a dramatic shift in performance when using the combined pre-training tasks (ICT + BFS + WLP):

  • Shattering the Baseline: On the Natural Questions dataset (using 80% training data), the pre-trained Transformer model achieved a Recall@1 of 30.27%, completely eclipsing the 4.93% achieved by BM-25.
  • Low-Data Efficiency: Deep Transformers typically overfit on small amounts of labeled data, performing worse than shallow models without pre-training. However, with these new pre-training tasks, the Transformer outperformed BM-25 on Natural Questions even when restricted to just 1% of the training data (17.31% vs 4.99% R@1).
  • Scaling Up: In the open-domain setting with 1 million candidates, the proposed model consistently outperformed BM-25. This proves that dense embeddings, when trained correctly, can handle massive scale better than sparse keyword matching.

Limitations and Future Work

While embedding-based retrieval shows immense promise, the authors note a few limitations. First, the pre-training tasks rely heavily on the specific structure of Wikipedia, such as its summaries and hyperlinks. It remains unclear how well these exact tasks would translate to specialized domains lacking such rich metadata, like legal or medical corpora.

Additionally, the paper uses "Sampled Softmax" for training. Exploring more sophisticated ways to mine "hard negatives"—documents that look highly relevant to a query but actually aren't—could push the model's accuracy even further. Finally, future work could explore how larger architectures, like RoBERTa or XLNet, interact with these paragraph-level objectives to further close the gap between retrieval and scoring performance.

Summary updated

BibTeX
@inproceedings{chang2020pre,
  author = {Wei-Cheng Chang and Felix X. Yu and Yin-Wen Chang and Yiming Yang and Sanjiv Kumar},
  title = {{Pre-training Tasks for Embedding-based Large-scale Retrieval}},
  booktitle = {International Conference on Learning Representations},
  year = {2020},
  url = {https://openreview.net/forum?id=VkgMhaZj720},
}
Figure