Source-linked AI summary

How Context Affects Language Models' Factual Predictions

Fabio Petroni, Patrick Lewis, Aleksandra Piktus, Tim Rocktäschel, Yuxiang Wu, Alexander H. Miller, Sebastian Riedel

arXiv:2005.04611v1cs.CL

TL;DR

Language models can encode factual knowledge, but fixed parameters limit reliable access to extensive facts. The paper adds retrieved contexts to pre-trained models without supervised fine-tuning and finds dramatic gains, competitive performance with supervised DrQA, and robust rejection of noisy contexts.

  • Problem

    Fixed model parameters limit reliable storage and retrieval of the extensive factual knowledge found in textual resources.

  • Method

    The paper augments pre-trained BERT and RoBERTa with retrieved contexts at test time in a purely unsupervised cloze-question-answering setup.

  • Results

    B-ret is competitive with supervised DrQA, while context enrichment dramatically improves BERT and RoBERTa on the LAMA probe.

  • Takeaways & Limitations

    BERT’s Next Sentence Prediction pre-training provides an unsupervised mechanism for exploiting relevant context and ignoring noisy or irrelevant context.

  • Takeaways & Limitations

    LAMA requires single-token answers, making generation of arbitrarily long contiguous answers with bidirectional models nontrivial.

Abstract

from arXiv · show

When pre-trained on large unsupervised textual corpora, language models are able to store and retrieve factual knowledge to some extent, making it possible to use them directly for zero-shot cloze-style question answering. However, storing factual knowledge in a fixed number of weights of a language model clearly has limitations. Previous approaches have successfully provided access to information outside the model weights using supervised architectures that combine an information retrieval system with a machine reading component. In this paper, we go a step further and integrate information from a retrieval system with a pre-trained language model in a purely unsupervised way. We report that augmenting pre-trained language models in this way dramatically improves performance and that the resulting system, despite being unsupervised, is competitive with a supervised machine reading baseline. Furthermore, processing query and context with different segment tokens allows BERT to utilize its Next Sentence Prediction pre-trained classifier to determine whether the context is relevant or not, substantially improving BERT's zero-shot cloze-style question-answering performance and making its predictions robust to noisy contexts.

1. Introduction

Pre-trained language models can store factual knowledge, but their fixed parameters limit reliable retrieval. This paper augments them with retrieved contexts without supervised fine-tuning, substantially improving cloze QA and enabling robust handling of irrelevant information.

  • Fixed-parameter language models may not reliably store and retrieve the millions of facts found across textual resources.
  • The paper augments pre-trained language models with retrieved contexts at test time in a purely unsupervised setting.
  • BERT can use relevant information even when the context lacks the answer span directly, unlike an extractive QA reader.
  • BERT’s Next Sentence Prediction objective helps it ignore noisy or irrelevant contexts.
  • Context augmentation dramatically improves BERT and RoBERTa on the LAMA probe and gives BERT performance on par with supervised DrQA.

2. Related Work

Prior work studies language-model knowledge, open-domain retrieval, reading, and integrated retriever–reader systems. This paper differs by examining fully unsupervised context augmentation for factual cloze prediction.

  • Research probes have been developed to analyze what pre-trained language models learn, including syntactic and semantic knowledge.
  • Open-domain QA systems retrieve relevant documents and use a reader to produce answers without knowing the documents in advance.
  • Prior open-domain QA work improves retrieval quality, answer aggregation, or overall pipeline efficiency.
  • REALM augments language-model pre-training with a knowledge retriever, whereas this work uses a fully unsupervised setting with a pre-trained language model.

3. Methodology

The study evaluates how retrieved or generated context changes language-model predictions on LAMA cloze questions, comparing BERT and RoBERTa with supervised and unsupervised baselines.

  • Datasets: The evaluation measures how language-model predictions for cloze question–answer pairs change when contexts are added.
  • Datasets: LAMA contains relational cloze questions with single-token answers and Wikipedia snippets, using Google-RE, T-REx, and SQuAD subsets.
  • Language Models: BERT and RoBERTa produce masked-token probability distributions, evaluated with mean precision at one (P@1).
  • Context Construction: BERT separates question and context with segment embeddings and [SEP], while RoBERTa uses an eos separator because it lacks segment embeddings.
  • Oracle Contexts: Oracle contexts use each example’s Wikipedia snippet, truncated to at most five sentences and containing related true information.
  • Evaluation: Table 2 reports P@1 for DrQA and BERT under context-free and context-enriched conditions on the relational LAMA probe.
  • Context Construction: The study compares oracle, retrieved, generated, and adversarial contexts, with adversarial documents drawn from different subjects but containing plausible distractor answers.

4. Results

Adding contextual information substantially improves unsupervised cloze-question answering, while BERT’s segment separation makes it robust to irrelevant contexts. Retrieved context can approach supervised QA performance, whereas generated context can introduce noisy or incorrect information.

  • ×7.4 on Google-RE, ×1.9 on T-REx, and ×3.5 on SQuAD are the oracle-context improvements over context-free BERT.No fine-tuning is required for BERT to exploit relevant context as a machine reader.
  • Retrieved context substantially improves BERT and is comparable with DrQA on Google-RE and SQuAD, while exceeding it on T-REx.The retrieved-context improvements over BERT’s no-context setting are statistically significant, with p-value below 1e-5.
  • BERT can use related retrieved context even when it does not explicitly contain the answer, unlike an extractive reader that would provide an incorrect or no answer.Most of B-ret’s gain comes from contexts containing the answer, but related contexts also sometimes help select it.
  • 4.1 Adversarial Robustness: A 0.5 P@1 average drop under adversarial context occurs when BERT separates question and context, whereas concatenation causes a 12.4 P@1 drop.The 12.4-point decline corresponds to a 40.7% relative performance drop; two segments also consistently improve retrieved and oracle contexts.
  • 4.1 Adversarial Robustness: Higher NSP probabilities co-occur with larger changes in the correct-answer probability when adversarial, retrieved, or generated contexts are appended.This supports NSP as an emergent mechanism for selectively conditioning on context relevance.
  • 4.2 Generated context: Generated context improves performance for 13 relations and 7% of T-REx questions overall, but noisy, irrelevant, or wrong generations can hurt performance.BERT assigns generated contexts high NSP probabilities because they appear as plausible continuations, limiting selective behavior.

5. Discussion

The discussion highlights that Next Sentence Prediction supports robust use of retrieved context in unsupervised tasks, while comparisons with DrQA depend on the task’s answer format and baseline choice.

  • Re-examining NSP: Next Sentence Prediction is important for robust exploitation of retrieved context in unsupervised tasks, despite limited usefulness for downstream fine-tuning accuracy.The authors argue that evaluating pre-trained models across more diverse use-cases may reveal capabilities missed by conventional downstream criteria.
  • Practical Takeaways: BERT behaves very differently with one versus two input segments, so practitioners should thoroughly ablate segmentation options.The discussion also notes that retrieved documents may improve other tasks, but investigating that possibility remains future work.
  • Comparison with DrQA: BERT with retrieved context and no fine-tuning performs on par with DrQA on the LAMA probe.The comparison is notable because BERT is unsupervised, whereas DrQA requires substantial supervision.
  • Comparison with DrQA: LAMA’s single-token answers limit how broadly the BERT–DrQA comparison generalizes to open-domain question answering.BERT and RoBERTa are abstractive bidirectional models, while extractive QA systems handle contiguous spans of varying lengths.
  • Comparison with DrQA: More sophisticated supervised open-domain QA models outperform DrQA on a variety of open-domain QA tasks.Thus, DrQA provides a comparison with a supervised baseline but is not the strongest available supervised reference.

6. Conclusion

The paper shows that adding context documents greatly improves factual unsupervised cloze QA. Off-the-shelf retrieval matches DrQA on LAMA, while appropriately featurized BERT remains robust to noisy context, apparently because of Next Sentence Prediction.

  • Conclusion: Providing context documents as additional inputs greatly improves factual unsupervised cloze QA.The technique directly augments the information available to the language model during prediction.
  • Conclusion: Off-the-shelf information retrieval is sufficient for performance on par with the supervised DrQA system.Oracle documents were used to establish an upper bound for the improvement from contextual augmentation.
  • Conclusion: Appropriately featurized BERT is very robust to noisy and irrelevant context documents.The conclusion attributes this robustness to the Next Sentence Prediction pretraining task.
Loading 2005.04611v1…