Test-time Augmentation for Factual Probing

Go Kamoda, Benjamin Heinzerling, Keisuke Sakaguchi, Kentaro Inui · DOI

Abstract

Language models (LMs) often serve as repositories of factual knowledge, yet their ability to retrieve this information is highly sensitive to the specific phrasing of a prompt. This paper explores the adaptation of Test-time Augmentation (TTA)—a technique widely used in computer vision—to the domain of Natural Language Processing. By generating multiple paraphrased versions of a query and aggregating the model's responses, we demonstrate that TTA can significantly improve the reliability of factual probing and enhance model calibration, helping LMs better signal when they lack specific knowledge.

1. Introduction

Factual probing is the primary method for assessing the extent of world knowledge contained within a Language Model. However, LMs are notoriously fickle; a model might correctly identify Albert Einstein's place of death when asked "Where did Einstein die?" but fail when the query is phrased as "What was the site of Einstein's death?" This inconsistency makes it difficult to discern whether a model lacks knowledge or simply fails to process a specific linguistic structure.

Traditional solutions often involve "prompt engineering" or fine-tuning models on specific relations. However, these methods are frequently tied to specific datasets and do not generalize well across different types of facts. This research proposes a relation-agnostic, unsupervised framework using Test-time Augmentation (TTA) to make factual probing more robust and reliable.

2. Methodology

The proposed TTA framework introduces two primary components into the standard inference pipeline: the Augmenter and the Aggregator.

2.1 The Augmenter

When a prompt is received, the Augmenter generates up to 30 variations (paraphrases) using three distinct techniques:

  • Synonym Replacement: Utilizing WordNet or GloVe embeddings to swap words (e.g., replacing "buried" with "inhumed").
  • Back-translation: Translating the prompt into a pivot language (such as French or Russian) and then back to English to generate naturalistic variations.
  • Stopword Filtering: Removing non-essential "filler" words to determine if the core keywords alone can elicit the correct response.

2.2 The Aggregator

The model processes all generated variations. Rather than selecting a single answer from a single prompt, the Aggregator sums the generation probabilities for identical answers across the entire set of augmented prompts. The final output is the answer with the highest cumulative probability score.

3. Experimental Setup

To evaluate the framework, the researchers constructed a dataset of 12,500 relational facts derived from Wikidata. The dataset spans 25 unique relations (e.g., "Place of birth," "Official language," "Follows"), with 500 facts per relation. To ensure straightforward evaluation, the dataset was filtered to include only facts with a single, unambiguous object.

4. Results and Discussion

4.1 Accuracy and Model Size

TTA consistently improved exact-match accuracy for smaller and mid-sized models, including T5-Small, T5-3B, and T0_3B. Interestingly, larger models (such as T5-11B) occasionally experienced a slight performance dip. This suggests that larger models may be more sensitive to the "noise" introduced by ungrammatical or low-quality paraphrases generated by simple rule-based augmentation.

4.2 The Calibration Advantage

The most significant benefit of TTA was observed in model calibration. Without augmentation, LMs are often "confidently wrong," assigning high probability to incorrect answers. TTA forces a more honest representation of uncertainty; if different phrasings lead to different answers, the aggregate confidence score drops. Reliability diagrams indicate that TTA moves models closer to "ideal calibration," where a confidence score of 0.8 accurately corresponds to an 80% likelihood of correctness.

4.3 The Quality Bottleneck

The success of TTA is heavily dependent on the quality of the paraphrases. When the researchers replaced rule-based synonym swapping with GPT-3 generated paraphrases, performance gains became more consistent across all model sizes, highlighting that the primary limitation of TTA is the semantic integrity of the augmented prompts.

5. Limitations and Future Work

While effective, TTA introduces significant computational overhead, as running 30 prompts is 30 times more expensive than a single inference. Furthermore, certain relations—such as the "follows" relation (e.g., "Monday follows Sunday")—are highly sensitive to even minor word changes, making them difficult to augment without breaking the underlying logic. Future research should focus on generating high-quality, meaning-preserving variations more efficiently to reduce costs and improve performance on complex relations.

6. Conclusion

Test-time Augmentation provides a promising, unsupervised path toward more reliable factual probing. By mitigating prompt sensitivity and improving calibration, TTA allows researchers to better understand the true knowledge boundaries of language models, ensuring that model outputs are not just accurate, but also appropriately confident.

Summary updated

BibTeX
@inproceedings{kamoda2023test,
  author = {Go Kamoda and Benjamin Heinzerling and Keisuke Sakaguchi and Kentaro Inui},
  title = {{Test-time Augmentation for Factual Probing}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.findings-emnlp.236},
}
Figure