Condenser: a Pre-training Architecture for Dense Retrieval

Luyu Gao, Jamie Callan

Abstract

Standard language models like BERT are highly effective at token-level understanding but often lack the inherent ability to aggregate global information into a single dense representation suitable for retrieval. This paper introduces Condenser, a novel architecture that enforces "structural readiness" during pre-training. By utilizing a specialized head that combines early-layer token information with late-layer global representations, Condenser forces the model to condense semantic information into a single vector. Experimental results demonstrate that Condenser significantly outperforms standard BERT in low-data regimes and achieves state-of-the-art performance on large-scale retrieval benchmarks like MS-MARCO.

Introduction

In the field of Dense Retrieval, "bi-encoders" are used to map queries and documents into a shared vector space. The relevance of a document to a query is then determined by a simple dot product of their respective vectors. While pre-trained models like BERT serve as the foundation for these encoders, they are not naturally optimized for this task.

The authors identify a lack of structural readiness in standard models. In Masked Language Modeling (MLM), tokens primarily attend to their local context. Consequently, the [CLS] token—intended to represent the entire sequence—often remains "dormant" in intermediate layers, only becoming active in the final layers. Fine-tuning such models for retrieval requires a significant "re-wiring" of internal attention mechanisms to move information into the [CLS] token, a process that is data-intensive and inefficient.

The Condenser Architecture

To address this, the Condenser architecture builds structural readiness directly into the pre-training phase.

The Condenser architecture splits the model into Early and Late layers, using a temporary head to force global information aggregation into the CLS token.

The model is partitioned into Early and Late layers. During pre-training, a temporary Condenser Head is introduced. This head receives two distinct inputs: the detailed token-level outputs from the Early layers and the global [CLS] representation from the Late layers. The training objective remains Masked Language Modeling, but the head must predict masked tokens using only these two inputs. This "short circuit" forces the model to encode the sophisticated semantic information from the Late layers into the [CLS] vector to successfully reconstruct the masked tokens. Post-pre-training, the head is discarded, leaving a standard Transformer backbone that is already optimized for global aggregation.

Experimental Evaluation

Condenser was pre-trained on English Wikipedia and BookCorpus, mirroring the original BERT setup. Evaluation spanned several key tasks:

  • Semantic Similarity: STS-b benchmark.
  • Structural Understanding: Wikipedia Section Distinction.
  • Open Domain QA: Natural Questions (NQ) and TriviaQA.
  • Large-scale Retrieval: MS-MARCO (Passage and Document ranking).

Key Results and Analysis

Condenser demonstrates remarkable efficiency, particularly when training data is scarce. On the STS-b task with only 500 training pairs, Condenser achieved a 76.6 Spearman correlation, significantly higher than BERT's 68.6. On the MS-MARCO passage ranking task, it reached an MRR@10 of 0.366, surpassing BERT (0.309) and even complex systems like RocketQA (0.364) that rely on extensive data augmentation.

Structural Readiness and Attention Entropy

The core advantage of Condenser lies in its internal attention structure. The authors analyzed "attention entropy" across layers to visualize how the model processes information.

Attention entropy plots for BERT, ICT, and Condenser. Condenser shows a more stable attention pattern between pre-training and fine-tuning, indicating superior structural readiness.

As shown in the analysis, standard BERT undergoes a drastic structural shift during fine-tuning as it learns to aggregate information. In contrast, Condenser's pre-trained attention pattern is already closely aligned with the requirements of the retrieval task. This alignment explains its superior performance and data efficiency.

Conclusion

Condenser provides a simple yet powerful architectural modification to the pre-training process. By forcing global information aggregation, it creates models that are "born ready" for dense retrieval. This approach reduces the need for massive fine-tuning datasets and complex training pipelines, making high-performance dense retrieval more accessible and robust across various domains.

Summary updated

BibTeX
@inproceedings{gao2021condenser,
  author = {Luyu Gao and Jamie Callan},
  title = {{Condenser: a Pre-training Architecture for Dense Retrieval}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2021},
  url = {https://openreview.net/forum?id=UQlAJs6LLC87},
}
Figure