Skip to main content
QUICK REVIEW

[Paper Review] How Context Affects Language Models' Factual Predictions

Fabio Petroni, Patrick Lewis|arXiv (Cornell University)|May 10, 2020
Topic ModelingComputer Science42 references80 citations
TL;DR

The paper shows that augmenting pre-trained language models (BERT/RoBERTa) with retrieved contexts at test time in a fully unsupervised setup dramatically improves factual cloze-style QA, matching supervised baselines, and that BERT’s Next Sentence Prediction helps filter noise from contexts.

ABSTRACT

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.

Motivation & Objective

  • Demonstrate that retrieving contexts at test time can unlock factual knowledge in pre-trained language models without supervision.
  • Quantify how context type (oracle, retrieved, generated, adversarial) affects LAMA-based cloze QA performance.
  • Assess robustness of BERT/RoBERTa to noisy contexts and the role of NSP in filtering context relevance.
  • Compare unsupervised retrieval-augmented LM performance to a supervised open-domain QA baseline (DrQA).

Proposed method

  • Evaluate BERT-large and RoBERTa-large on the LAMA relational probes using cloze-style questions.
  • Augment cloze prompts with different context types: oracle (snippet from Wikipedia), retrieved (DrQA-like TF-IDF paragraphs), generated (autoregressive LM context), and adversarial (unrelated context).
  • Separate question and context using model-specific segment tokens (BERT) or eos/separator when applicable.
  • Measure P@1 for single-token answers across Google-RE, T-REx, and SQuAD-derived subsets.
  • Analyze NSP classifier activation and the importance of input segmentation for context usefulness.
  • Compare against DrQA as a supervised open-domain QA baseline and discuss the implications for unsupervised QA.

Experimental results

Research questions

  • RQ1Can unsupervised retrieval-augmented language models reach supervised QA performance on factual knowledge tasks?
  • RQ2How does the type of context (oracle, retrieved, generated, adversarial) influence LM-based cloze QA accuracy?
  • RQ3What role does BERT's NSP objective and input segmentation play in leveraging context?
  • RQ4Is the improvement from retrieved context robust across relations and datasets?

Key findings

  • Context-enriched prompts substantially boost LM factual QA: B-ora (oracle) yields large gains over context-free input, and B-ret (retrieved) often matches or exceeds supervised baselines.
  • BERT with retrieved context is competitive with DrQA on Google-RE and SQuAD, and outperforms the context-free baseline by large margins across relations.
  • Adversarial contexts show BERT remains robust when using two-segment inputs, suggesting NSP helps filter irrelevant contexts; concatenation degrades performance significantly.
  • Generated contexts can help on some relations but are generally less effective than retrieved or oracle contexts, and can mislead when noisy.
  • BERT's NSP-based relevance signaling appears to enable robust conditioning on context, contributing to improved accuracy without supervised fine-tuning.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.