Language models get smarter at test time by fixing shortcuts
Counterfactual Test-Time Augmentation for Shortcut Removal in Language Models
Machine LearningArtificial IntelligenceComputation and Language
Summary
Language models sometimes rely on easy clues called shortcuts that worked during training but don't hold up later, causing mistakes. The authors propose a way to fix these problems right when the model is tested, without retraining it. They do this by creating changed versions of the input where these shortcuts are altered and combining the model’s answers from those versions. Their method comes close to the performance of fully retrained models but works without needing extra labeled data or heavy computing.
What this means in practice
- •For natural language processing developers: Improve language models’ accuracy by fixing shortcut mistakes during testing without retraining or labeled data.
- •For chatbot development teams: Reduce errors from spurious text patterns by adjusting chatbot responses in real time using counterfactual inputs.
Authors
Katie Matton, Rosalind W. Picard, John Guttag, Maggie Makar
Abstract
Large language models (LLMs) can exploit shortcuts, i.e., correlations present in training data that may not hold at test time. This can lead to poor predictions when correlations shift. Most existing solutions for removing shortcuts operate at training time, requiring labeled training data, model weight access, and significant computational resources. Here, we study the problem of test-time shortcut removal. We propose a family of counterfactual test-time augmentation (CTTA) methods: given an example, each method uses an auxiliary model to generate counterfactual edits in which the shortcut value is changed, and then takes a weighted average of the LLM's predictions across these edits. We prove that the optimal shortcut-invariant predictor is a member of this CTTA family, and we characterize its weights. The weights depend on the training distribution, and therefore are, in general, not identifiable from the trained model and unlabeled test data. However, we present assumptions under which the weights can be obtained using the token probabilities of the trained LLM, and propose tests to detect violations of these assumptions. We use these tests to develop Select-CTTA, an aggregate method that selects among CTTA methods. Empirically, we find that Select-CTTA outperforms test-time baselines and approaches the performance of models fine-tuned on shortcut-balanced data.