Improving BERT-based Query-by-Document Retrieval with Multi-Task Optimization

Amin Abolghasemi, Suzan Verberne, Leif Azzopardi

Abstract

Query-by-Document (QBD) retrieval, where a full document serves as the search query, presents unique challenges for standard BERT-based models due to input length constraints and a focus on token-level matching. This paper proposes a Multi-Task Fine-Tuning (MTFT) strategy that jointly optimizes a BERT re-ranker for both ranking and representation learning. By forcing the model to cluster similar documents in vector space while simultaneously scoring pairs, the shared BERT backbone learns superior document-level semantic features. Experimental results on legal (COLIEE) and scientific (SciDocs) benchmarks demonstrate that MTFT-BERT significantly improves retrieval effectiveness over standard fine-tuning approaches without requiring additional training samples.

Introduction

In specialized search domains such as legal research or scientific literature discovery, users often need to find documents similar to an existing "seed" document. This task, known as Query-by-Document (QBD) retrieval, differs from traditional keyword search because the query itself is long and context-rich.

Standard BERT-based cross-encoders, while powerful, face two primary hurdles in QBD:

  1. Truncation: BERT's 512-token limit often forces the truncation of long documents, potentially losing critical information.
  2. Matching Bias: Cross-encoders excel at fine-grained term matching but may overlook broader document-level semantic themes essential for QBD.

The authors address these issues by introducing a multi-task learning framework that regularizes the ranking task with an auxiliary representation learning objective.

Methodology: Multi-Task Fine-Tuning (MTFT)

The core innovation is the Multi-Task Fine-Tuning (MTFT) strategy. Instead of training BERT solely to predict a relevance score for a query-document pair, the model is assigned two concurrent goals:

  1. Ranking Task (Cross-Encoder): BERT processes a concatenated [Query + Document] pair to predict a relevance score. A pairwise ranking loss ensures that relevant documents ($d^+$) are scored higher than non-relevant ones ($d^-$).
  2. Representation Task (Bi-Encoder): BERT encodes the query and documents independently into vector representations. A triplet loss is applied to ensure the query vector is closer to the relevant document vector than the non-relevant one in the embedding space.
The MTFT architecture jointly optimizes for ranking (left) and representation learning (right) using a shared BERT encoder.

The final objective is an aggregated loss: $L = l_{ranking} + \lambda l_{representation}$. This dual objective forces the BERT backbone to capture both local interactions and global semantic context. At inference time, only the improved ranking head is used.

Experimental Setup

The model was evaluated on two domain-specific benchmarks:

  • COLIEE 2021 (Legal): Finding supporting case law for a given legal case.
  • SciDocs (Scientific): Tasks including citation and co-citation prediction.

The researchers utilized domain-specific pre-trained models, LegalBERT and SciBERT, as the base encoders for their respective tasks.

Results and Analysis

MTFT-BERT consistently outperformed standard BERT re-rankers and strong baselines across both domains.

On the COLIEE benchmark, MTFT-BERT achieved a significant performance boost. It reached an F1 score of 22.05%, representing an 8.3% relative improvement over the optimized BM25 baseline and a substantial jump from the 15.49% F1 score of a standard BERT re-ranker.

Performance comparison on the COLIEE legal case law retrieval task, showing MTFT-BERT's superiority.

Scientific Domain Performance

In the SciDocs benchmark, MTFT-BERT surpassed SPECTER, a model specifically pre-trained for scientific document embeddings, across all metrics (Co-view, Co-read, Cite, and Co-cite). For instance, in the "Co-cite" task, nDCG improved from 0.948 to 0.961.

Key Insights

  • Data Efficiency: MTFT requires no additional training data. It leverages the same $(q, d^+, d^-)$ triples used for standard ranking.
  • Representation as Regularization: The auxiliary task acts as a regularizer, preventing the model from overfitting on specific keywords and encouraging a more holistic understanding of document content.
  • Robustness: The model's performance is stable across different values of the task weight $\lambda$, provided the representation loss is sufficiently weighted (typically $\lambda \ge 0.5$).

Conclusion

The MTFT strategy provides a simple yet effective way to improve BERT-based QBD retrieval. By integrating representation learning into the fine-tuning process, the model overcomes some of the inherent limitations of cross-encoders on long-form text. While the 512-token limit remains a constraint, the improved semantic representations lead to state-of-the-art results in specialized domains. Future work may explore applying this technique to faster bi-encoder architectures or even longer-context models.

Summary updated

BibTeX
@inproceedings{abolghasemi2022improving,
  author = {Amin Abolghasemi and Suzan Verberne and Leif Azzopardi},
  title = {{Improving BERT-based Query-by-Document Retrieval with Multi-Task Optimization}},
  booktitle = {ECIR},
  year = {2022},
  doi = {10.1007/978-3-030-99739-7\_1},
}
Figure