Selective Question Answering under Domain Shift

Amita Kamath, Robin Jia, Percy Liang

Selective Question Answering under Domain Shift

Introduction

Modern question answering (QA) systems, particularly those based on large language models like BERT, achieve impressive performance when evaluated on data similar to their training set. However, these models often struggle with domain shift—the phenomenon where real-world user queries deviate from the training distribution. A critical failure mode in these scenarios is overconfidence: models frequently provide incorrect answers with high certainty. To address this, we explore a "selective prediction" framework that enables models to abstain from answering when they are likely to be wrong.

The Challenge of Overconfidence

When a QA model encounters out-of-domain (OOD) data, standard confidence metrics like the maximum softmax probability (MaxProb) become unreliable. Ideally, a system should maintain high accuracy by staying silent on uncertain inputs. The goal is to maximize "coverage"—the percentage of questions answered—while adhering to a strict target accuracy (e.g., 80% or 90%) across a mixture of familiar and unfamiliar domains.

Methodology: Decoupled Calibration

We propose a decoupled approach that separates the task of answering from the task of assessing confidence.

  1. The QA Model: A standard BERT-base model trained on a source dataset (SQuAD 1.1).
  2. The Calibrator: A lightweight Random Forest classifier trained to predict the likelihood of the QA model's correctness.

The core innovation is the training strategy for the calibrator. Rather than training solely on in-domain data, we expose the calibrator to a small amount of "Known OOD" data. This data is distinct from both the source training set and the "Unknown OOD" data encountered at test time.

The experimental setup involves training on a source domain, calibrating with a mix of source and known OOD data, and testing on a mix of source and unknown OOD data.

The calibrator utilizes seven simple features: the top five softmax probabilities from the QA model, the input passage length, and the predicted answer length. By observing the QA model's behavior across different domains, the calibrator learns the "signature" of overconfident errors.

Experimental Setup and Datasets

To simulate domain shift, we utilize a variety of extractive QA datasets:

  • Source (In-domain): SQuAD 1.1.
  • Out-of-Domain (OOD): NewsQA, TriviaQA, SearchQA, HotpotQA, and Natural Questions.

Experiments involve testing the system on a 50/50 mixture of SQuAD and one "Unknown" OOD dataset, while the calibrator is trained using a different "Known" OOD dataset.

Insights: The Overconfidence Gap

Analysis reveals a significant mismatch in model behavior. QA models tend to be underconfident on in-domain data (often due to multiple valid answer spans in SQuAD) but wildly overconfident on OOD data. This discrepancy is why simple thresholding on MaxProb fails.

Comparison of MaxProb and Calibrator Probability. (a, b) show that MaxProb is poorly calibrated for OOD data, while (c, d) demonstrate that the proposed calibrator better aligns predicted probability with actual correctness.

As shown in the figures above, the calibrator effectively shifts the probability distribution to better reflect the model's actual performance on OOD data. Notably, passage length emerged as a crucial feature, acting as a proxy for detecting domain shift since different datasets have distinct average lengths.

Key Results

The Random Forest calibrator significantly outperforms the standard MaxProb baseline:

  • Improved Coverage: At a target accuracy of 80%, the proposed method achieved 56.1% coverage, compared to 48.2% for MaxProb.
  • Calibration vs. Retraining: Interestingly, using OOD data to train a separate calibrator is more effective than using that same data to fine-tune the entire QA model (which only reached 51.8% coverage). The calibrator is better at learning the model's limitations than the model is at adapting its internal knowledge to a new domain.
  • Efficiency: While techniques like Monte Carlo dropout can further improve coverage, they are computationally intensive. The Random Forest calibrator offers a highly efficient "black-box" alternative.

Conclusion and Future Work

While this framework significantly improves reliability under domain shift, a substantial gap remains between current performance and the theoretical "best possible" coverage (~75% at 80% accuracy). Future research could explore more sophisticated features for the calibrator, such as internal model gradients or hidden layer representations, to further close this gap. Additionally, improving QA evaluation metrics to account for valid alternative answers would likely reveal even stronger calibration performance.

Summary updated

BibTeX
@inproceedings{kamath2020selective,
  author = {Amita Kamath and Robin Jia and Percy Liang},
  title = {{Selective Question Answering under Domain Shift}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2020},
  doi = {10.18653/v1/2020.acl-main.503},
}
Figure