Topic-DPR: Topic-based Prompts for Dense Passage Retrieval

Qingfa Xiao, Shuangyin Li, Lei Chen

Presented at EMNLP 2023, Topic-DPR introduces a novel approach to Dense Passage Retrieval (DPR) by utilizing multiple topic-based prompts. This method effectively mitigates "semantic space collapse" and enhances retrieval accuracy, particularly in specialized domains like scientific literature and patents. By anchoring representations to specific topical distributions, the model prevents embedding space anisotropy, leading to significantly better differentiation between relevant and irrelevant passages.

The Problem: Semantic Space Collapse

Standard DPR models embed queries and documents into a shared low-dimensional space where relevance is determined by vector distance. While "prompt-tuning"—adding a trainable continuous vector to the input—is often used to improve performance, the authors identify a significant flaw: semantic space collapse.

When a single prompt is applied across a diverse dataset, it induces a uniform semantic shift. This leads to anisotropy, a phenomenon where embeddings converge into a narrow, restricted region of the vector space. In such a "crowded" space, it becomes difficult for the model to distinguish a truly relevant passage from an irrelevant one that happens to share a broad topic.

Comparison of embedding space distributions: Topic-DPR prevents semantic collapse by using multiple topic-based anchors.

The Topic-DPR Framework

To address these limitations, Topic-DPR moves away from the "one-size-fits-all" prompting strategy. The framework consists of several key components designed to maintain semantic diversity:

  1. Topic-based Prompt Generation: Instead of random initialization, the model uses Hierarchical Latent Dirichlet Allocation (hLDA) to extract the underlying topic structure of the document corpus. This ensures that the prompts are grounded in the actual semantic diversity of the data.
  2. Prompt Encoder: The top words from these discovered topics are fed into a specialized encoder to create initial continuous prompt vectors. This "topical pre-guidance" primes the model to look for nuances specific to a field, such as quantum physics versus legal patents.
  3. Deep Prompt Tuning (P-Tuning v2): These topic-specific prompts are injected into every layer of the Pre-trained Language Model (PLM), such as BERT, using the attention mechanism. This acts as internal guidance for the model's representations throughout the encoding process.
The end-to-end Topic-DPR pipeline, illustrating the transition from a document corpus to topic-based continuous vectors.

Multi-Objective Contrastive Learning

The model is trained using a sophisticated multi-objective loss function. Beyond the standard goal of matching queries to relevant abstracts (Query-Passage Relation), the authors introduce a Topic-Topic Relation loss. This "secret sauce" pushes prompts of different topics apart on a probabilistic simplex, explicitly encouraging the embedding space to remain spread out and uniform. Additionally, Query-Query Relation loss ensures that semantically similar queries remain close to one another.

Results and Key Insights

The model was evaluated on two large-scale, semi-structured scientific datasets: arXiv-Article and USPTO-Patent. Both datasets include multi-category metadata used to refine the contrastive learning process.

  • State-of-the-Art Performance: Topic-DPR consistently outperformed existing methods like standard DPR across all metrics. On the arXiv dataset, it improved MAP@10 (Mean Average Precision) by approximately 3 points over the strongest baseline.
  • Parameter Efficiency: In a "frozen" setting where the main PLM parameters were locked and only the prompts were tuned (representing only 0.1%–0.4% of total parameters), Topic-DPR still maintained highly competitive performance.
  • Anisotropy Mitigation: Quantitative analysis confirmed that Topic-DPR achieved superior uniformity scores. T-SNE visualizations show that while vanilla BERT results in a disorganized "blob," Topic-DPR creates a structured distribution where topics are clearly separated but internally clustered.

Conclusion and Future Work

Topic-DPR demonstrates that maintaining embedding space uniformity is as critical as alignment for effective retrieval. While the current model relies on static topic modeling (hLDA) as a pre-processing step, future work could explore joint training, where topic discovery and the retrieval task are optimized simultaneously. Additionally, leveraging broader metadata—such as citation graphs—could further refine the training process for even more robust dense retrieval.

Summary updated

BibTeX
@inproceedings{xiao2023topic,
  author = {Qingfa Xiao and Shuangyin Li and Lei Chen},
  title = {{Topic-DPR: Topic-based Prompts for Dense Passage Retrieval}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.findings-emnlp.480},
}
Figure