TL;DR
This paper introduces "early exiting BERT" for document ranking, a method that allows BERT models to stop processing a document early if it's confident about its relevance. This significantly speeds up inference (up to 2.5x) without a substantial drop in ranking quality, making powerful BERT models more practical for real-world applications.
What Problem Does This Paper Address?
Large pre-trained language models like BERT have revolutionized Natural Language Processing (NLP) and Information Retrieval (IR) by achieving state-of-the-art results. However, their impressive performance comes at a cost: they are computationally intensive and slow, especially during inference. This high latency makes them impractical for many real-world applications where quick responses are crucial, such as search engines. The paper tackles this challenge by proposing a way to make BERT models faster for document ranking tasks.
Methods
The core idea is to modify BERT to have multiple "exit points" during its processing pipeline. Inspired by earlier work like DeeBERT, the authors attach a classifier to each transformer layer of the BERT model. At inference time, a query-document pair is processed sequentially by these layers and their corresponding classifiers. If a classifier is sufficiently confident in its prediction (i.e., whether the document is relevant or not), the model can "exit early," skipping the remaining transformer layers.
A key novelty is the introduction of asymmetric early exiting. Unlike previous approaches that used a single confidence threshold for all classes, this paper proposes two thresholds: one for positive (relevant) predictions ($T_p$) and one for negative (non-relevant) predictions ($T_n$). The rationale is that in document ranking, we are primarily interested in relevant documents. Therefore, the model should be more cautious and use more layers for potentially relevant documents (higher $T_p$) while being able to exit earlier for documents deemed unlikely to be relevant (lower $T_n$). This allows for a more efficient allocation of computational resources based on the predicted relevance.
Datasets
The authors evaluate their method on two standard document ranking datasets:
- MS MARCO passage: A large-scale dataset for passage retrieval.
- ASNQ (Answer Sentence Selection and Question Answering): Another dataset for document ranking tasks.
The paper details how they prepared training sets by selecting unique query-document pairs and augmenting them with non-relevant documents to create balanced datasets.
Key Insights and Ideas
- Asymmetric exiting is crucial for document ranking: The inherent difference in importance between relevant and non-relevant documents means a one-size-fits-all early exiting strategy is suboptimal. Allocating more computation to potentially relevant documents is key.
- Setting $T_p=1$ is optimal: For the tested datasets, setting the threshold for positive predictions to 1 (meaning the model uses as many layers as possible for relevant documents) yields the best trade-off between efficiency and accuracy. This suggests that even with many layers, the final layers still provide valuable discriminative power for relevant documents.
- Early exiting significantly outperforms naive layer-wise baselines: Simply stopping at a fixed layer for all samples (layer-wise scores) is less effective than the confidence-based early exiting approach. This highlights the benefit of dynamically adapting computation based on prediction confidence.
Key Results
The proposed early exiting BERT model achieved significant inference speedups:
- Up to 2.5x faster inference on both MS MARCO passage and ASNQ datasets.
- This speedup was achieved with minimal degradation in ranking effectiveness (e.g., MRR@10 and nDCG@10 scores).
- The asymmetric early exiting strategy demonstrated its effectiveness in balancing efficiency and accuracy by allowing for different trade-offs based on confidence thresholds.
Limitations and Future Work
- Dataset-specific thresholds: While $T_p=1$ was found to be optimal for the tested datasets, the authors suggest that for datasets with a higher proportion of relevant candidates, a smaller $T_p$ might be beneficial. This indicates that the optimal thresholds might depend on the specific characteristics of the dataset.
- Future work could explore: The paper doesn't explicitly detail future work, but the findings suggest exploring how this asymmetric early exiting approach could be applied to other NLP tasks where class importance is uneven, or investigating more sophisticated methods for determining confidence thresholds.
Summary updated