Exploring Dual Encoder Architectures for Question Answering

Zhe Dong, Jianmo Ni, Daniel M. Bikel, Enrique Alfonseca, Yuan Wang, Chen Qu, Imed Zitouni

TL;DR

This paper investigates the performance gap between Siamese (shared parameters) and Asymmetric (separate parameters) dual encoders for question answering. The authors discover that while standard asymmetric models often fail due to misaligned embedding spaces, simply sharing the projection layer between the two towers allows asymmetric models to match or even outperform their Siamese counterparts.

What Problem Does This Paper Address?

Dual encoders are the workhorse of modern information retrieval (IR) and open-domain question answering (QA). They work by mapping a question and a potential answer into a high-dimensional embedding space; if the embeddings are close together (usually measured by cosine similarity), the answer is considered relevant.

Architecturally, researchers usually choose between two extremes:

  1. Siamese Dual Encoders (SDE): Both the question and answer are processed by the exact same model weights.
  2. Asymmetric Dual Encoders (ADE): The question and answer use two entirely different models.

Intuitively, ADEs should be better because questions and answers are different types of text (short vs. long, inquisitive vs. declarative). However, in practice, SDEs often perform better. This paper sets out to understand why this gap exists and how to design an asymmetric architecture that actually delivers on its theoretical promise.

Methods

The authors systematically explore the "middle ground" between SDE and ADE by sharing or freezing specific components of the model. Using T5-1.1 encoders as a backbone, they compare five architectures:

  • SDE: Full parameter sharing.
  • ADE: No parameter sharing.
  • ADE-STE: Shared Token Embedder only.
  • ADE-FTE: Frozen Token Embedder (using pre-trained weights).
  • ADE-SPL: Shared Projection Layer (the final linear layer that produces the embedding).

The models are trained using a standard contrastive loss with in-batch negatives, where the goal is to maximize the similarity between a question and its ground-truth answer while minimizing similarity to other answers in the same batch.

Figure 1: Architectures of dual encoders. We study whether parameter sharing in different dual encoder components (i.e. token embedder, transformer encoder, and projection layer) can lead to better representation learning. Orange and green components are distinctly parameterized for question and answer encoder towers, respectively. Blue components are shared between two encoding paths. Grey components are frozen during the fine-tuning.

Datasets

The study evaluates these architectures across seven established benchmarks:

  • MS MARCO: A large-scale dataset for passage retrieval.
  • MultiReQA: A suite of five datasets (including SQuAD, TriviaQA, HotpotQA, and SearchQA) focused on sentence-level retrieval.
  • Natural Questions (NQ): An open-domain dataset using real Google search queries for passage retrieval.

Key Insights and Ideas

  • The "Disjoint Space" Trap: Through t-SNE visualizations, the authors show that standard ADEs fail because they map questions and answers into two completely separate "islands" in the embedding space. Even if the model learns internal relationships well, the two spaces aren't aligned, making similarity search ineffective.
  • The Projection Layer is the Anchor: Sharing the final projection layer (ADE-SPL) acts as a mathematical anchor. It forces the outputs of the two distinct encoder towers into the same coordinate system. This single change effectively merges the two "islands" into one cohesive space.
  • Token Embeddings aren't the Bottleneck: While sharing or freezing token embeddings (ADE-STE/FTE) provides marginal gains, it doesn't solve the fundamental alignment problem. The "magic" happens at the output stage, not the input stage.
t-SNE clustering showing how ADE-SPL aligns question and answer embeddings compared to the disjoint clusters in standard ADE.

Key Results

The results across all datasets were remarkably consistent:

  1. SDE > ADE: In almost every test, the Siamese model significantly outperformed the fully asymmetric model. For example, on SQuAD, SDE achieved a Precision@1 of 70.13% vs. ADE’s 60.39%.
  2. ADE-SPL is the Winner: Sharing the projection layer closed the gap. On Natural Questions (NQ), ADE-SPL (50.06% P@1) actually outperformed SDE (48.87%).
  3. Robustness to Scale: These findings held true as the authors scaled the models from "small" (~77M parameters) to "large" (~800M parameters). As models get bigger, the benefit of sharing the projection layer remains a critical design choice.
Relative performance improvements of different models over the baseline ADE.

Limitations and Future Work

The authors acknowledge a few boundaries to their study:

  • Scope of Architectures: The paper focuses strictly on dual encoders. It does not compare these results against "late-interaction" models like ColBERT or more complex phrase-level retrieval systems.
  • Simple Sharing: The study only looks at binary sharing (shared vs. not shared). There may be more sophisticated ways to encourage alignment, such as using auxiliary alignment losses or more complex projection architectures, which were not explored here.
  • Task Specificity: While highly effective for QA and IR, it remains to be seen if the "Shared Projection Layer" rule of thumb applies to other multi-modal tasks (like image-text retrieval).

Summary updated

BibTeX
@inproceedings{dong2022exploring,
  author = {Zhe Dong and Jianmo Ni and Daniel M. Bikel and Enrique Alfonseca and Yuan Wang and Chen Qu and Imed Zitouni},
  title = {{Exploring Dual Encoder Architectures for Question Answering}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  url = {https://openreview.net/forum?id=5NqFr9pJEu},
}
Figure