Exploring Dual Encoder Architectures for Question Answering

Zhe Dong, Jianmo Ni, Dan Bikel, Enrique Alfonseca, Yuan Wang, Chen Qu, Imed Zitouni · OpenReview

Abstract

Dual encoders have been used for question-answering (QA) and information retrieval (IR) tasks with good results. There are two major types of dual encoders: Siamese Dual Encoders (SDE), with parameters shared across two encoders, and Asymmetric Dual Encoders (ADE), with two distinctly parameterized encoders. In this work, we explore the dual encoder architectures for QA retrieval tasks. By evaluating on MS MARCO and the MultiReQA benchmark, we show that SDE performs significantly better than ADE. We further propose three different improved versions of ADEs. Based on the evaluation of QA retrieval tasks and direct analysis of the embeddings, we demonstrate that sharing parameters in projection layers would enable ADEs to perform competitively with SDEs.

Introduction

In modern Information Retrieval (IR) and Question Answering (QA), Dual Encoders serve as the foundational architecture for efficient document retrieval. These models transform massive text corpora into searchable vector spaces, allowing for high-speed similarity searches. A persistent design question in this field is whether the two "towers" of the encoder—one processing the query and the other the document—should share parameters (Siamese) or remain distinct (Asymmetric).

Intuitively, Asymmetric Dual Encoders (ADE) should offer superior performance because questions and answers possess distinct linguistic structures. However, empirical evidence often shows that Siamese Dual Encoders (SDE) outperform their asymmetric counterparts. This research investigates this discrepancy and proposes architectural modifications to bridge the performance gap.

Architectural Variants

To understand the impact of parameter sharing, we systematically evaluated five architectural variants based on the T5 (v1.1) encoder:

  1. Siamese Dual Encoder (SDE): Full parameter sharing across both towers.
  2. Asymmetric Dual Encoder (ADE): No parameter sharing between towers.
  3. ADE with Shared Token Embedders (ADE-STE): Only the initial embedding layer is shared.
  4. ADE with Frozen Token Embedders (ADE-FTE): Uses pre-trained, non-trainable token embedders.
  5. ADE with Shared Projection Layer (ADE-SPL): The transformer towers remain distinct, but the final linear layer that produces the output embedding is shared.

Experimental Setup

The models were evaluated across several industry-standard benchmarks, including MS MARCO and the MultiReQA suite (comprising Natural Questions, SQuAD, TriviaQA, HotpotQA, and SearchQA). We tested these architectures across multiple scales—Small (77M), Base (250M), and Large (800M) parameters—to ensure the findings were consistent regardless of model capacity.

The Alignment Trap and the Role of Projection

Our analysis revealed that the primary failure mode of pure ADEs is not a lack of representational power, but rather a lack of coordination. Without shared parameters, the two towers tend to map questions and answers into disjoint clusters within the vector space. If the "question space" and "answer space" do not overlap, the retrieval mechanism—which relies on dot-product similarity—fails to find relevant matches.

We found that the final projection layer acts as a critical "anchor." By sharing only this final layer (ADE-SPL), the model forces both towers into the same coordinate system. This hybrid approach allows the transformer blocks to specialize in "question-ness" or "answer-ness" while ensuring the resulting embeddings remain mathematically compatible.

Key Results

The ADE-SPL variant consistently performed on par with or better than the standard SDE across all benchmarks. For instance, on the Natural Questions (NQ) dataset (P@1), ADE-SPL achieved 50.06%, outperforming the SDE's 48.87% and the pure ADE's 47.83%.

Visual analysis using t-SNE plots confirmed these findings. While pure ADEs created two separate "islands" of data, the ADE-SPL architecture produced a single, well-mixed distribution where questions and answers were properly interleaved, facilitating more accurate retrieval.

Conclusion

While Siamese architectures are a strong default for Dual Encoders, they may limit the model's ability to learn specialized representations for queries and documents. Our research demonstrates that the "secret sauce" for effective asymmetric retrieval is the sharing of the final projection layer. This simple modification allows for specialized encoding while maintaining the necessary alignment in the shared embedding space. Future work may explore more complex interactions between towers or the application of these findings to late-interaction models like ColBERT.

Summary updated

BibTeX
@inproceedings{dong2022exploring,
  author = {Zhe Dong and Jianmo Ni and Dan 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