DC-BERT: Decoupling Question and Document for Efficient Contextual Encoding

Yuyu Zhang, Ping Nie, Xiubo Geng, Arun Ramamurthy, Le Song, Daxin Jiang

Abstract

Open-domain question answering (QA) systems typically rely on computationally intensive BERT-based models for document reranking. This creates a significant latency bottleneck in real-time applications. We present DC-BERT (Decoupled Contextual encoding BERT), which decouples the encoding of questions and documents. By pre-encoding and caching document representations offline and employing a lightweight online interaction layer, DC-BERT achieves a 10x speedup in retrieval while maintaining approximately 98% of the accuracy of standard BERT models.

Introduction

The standard "retrieve and read" pipeline for open-domain QA uses a fast initial retriever (like TF-IDF or BM25) followed by a high-accuracy BERT-based reranker. However, standard BERT rerankers require concatenating the question and document, necessitating a full forward pass for every pair. In high-throughput settings where a single query is compared against hundreds of documents, this approach is prohibitively slow. DC-BERT addresses this by decoupling the lower layers of the Transformer stack, allowing for efficient document caching.

Methodology: Decoupled Contextual Encoding

DC-BERT introduces a dual-model architecture designed to minimize online computation.

The DC-BERT architecture decouples question and document encoding, using offline caching for document representations.

Dual-BERT Component

The architecture consists of an online BERT for question encoding and an offline BERT for document encoding. Document encodings are computed once and stored in a cache.

Interaction and Global Embeddings

The model leverages the insight that lower Transformer layers primarily capture local syntax, while higher layers handle complex semantics. DC-BERT decouples the lower layers and introduces a small number of shared Transformer Interaction Layers ($K$) at the top. To preserve contextual information across the decoupled sequences, trainable global position and type embeddings are added before the interaction stage. A final binary classifier predicts document relevance.

Experimental Setup

The model was evaluated on SQuAD Open and Natural Questions (NQ) Open. Initial candidates were retrieved using DrQA's TF-IDF system. Performance was measured using standard QA metrics (Exact Match) and retrieval-specific metrics like PBT@N (Position-Biased Top-N) and PTB@N (Position-To-Bottom Top-N) to evaluate the reranker's ability to identify relevant documents missed by keyword-based systems.

Key Results and Discussion

DC-BERT demonstrates a significant improvement in efficiency without a substantial loss in performance.

Efficiency vs. Accuracy Trade-off

The number of interaction layers ($K$) is a critical hyperparameter. As shown in the figure below, increasing $K$ improves accuracy (Answer EM) but significantly reduces the retriever speedup.

Impact of the number of Transformer interaction layers on Answer EM and Retriever Speedup.

Performance Benchmarks

  • Speedup: DC-BERT achieved a 10.3x speedup over the BERT-base baseline.
  • Fidelity: On SQuAD Open, the Exact Match (EM) score dropped only slightly from 40.1 to 39.2, retaining 98% of the baseline's performance.
  • Comparison with Baselines: DC-BERT outperformed other efficient variants like DistilBERT, which, while fast, suffered from much lower accuracy.

Conclusion

DC-BERT provides a practical solution for deploying high-performance BERT-based rerankers in real-time open-domain QA systems. By strategically decoupling the encoding process and utilizing offline caching, it bridges the gap between the computational efficiency of dual-encoders and the high accuracy of cross-encoders. Future work includes extending this decoupling strategy to the "reader" component of the QA pipeline.

Summary updated

BibTeX
@inproceedings{zhang2020dc,
  author = {Yuyu Zhang and Ping Nie and Xiubo Geng and Arun Ramamurthy and Le Song and Daxin Jiang},
  title = {{DC-BERT: Decoupling Question and Document for Efficient Contextual Encoding}},
  booktitle = {International ACM SIGIR Conference on Research and Development in Information Retrieval},
  year = {2020},
  doi = {10.1145/3397271.3401271},
}
Figure