Batch Calibration: Rethinking Calibration for In-Context Learning and Prompt Engineering
Han Zhou, Xingchen Wan, Lev Proleev, Diana Mincu, Jilin Chen, Katherine Heller, Subhrajit Roy
TL;DR
This work tackles prompt brittleness and contextual bias in in-context learning by proposing Batch Calibration (BC), a zero-shot, inference-only method that marginalizes contextual bias across batched inputs. It unifies and analyzes existing calibration approaches (CC, DC, PC) through decision-boundary perspectives, identifies their failure modes, and motivates BC, with an extension to black-box few-shot learning (BCL). BC achieves state-of-the-art results on PaLM 2 and CLIP across 10+ NLP and vision-language tasks, while remaining inexpensive and robust to prompt design choices; BCL offers additional gains when labeled data are available. The approach generalizes across modalities and reduces the need for careful prompt engineering, enabling more reliable and scalable deployment of LLM-based systems. The work emphasizes the practical value of a simple, principled calibration layer that Accounts for contextual priors without retraining, potentially impacting a wide range of real-world LLM applications.
Abstract
Prompting and in-context learning (ICL) have become efficient learning paradigms for large language models (LLMs). However, LLMs suffer from prompt brittleness and various bias factors in the prompt, including but not limited to the formatting, the choice verbalizers, and the ICL examples. To address this problem that results in unexpected performance degradation, calibration methods have been developed to mitigate the effects of these biases while recovering LLM performance. In this work, we first conduct a systematic analysis of the existing calibration methods, where we both provide a unified view and reveal the failure cases. Inspired by these analyses, we propose Batch Calibration (BC), a simple yet intuitive method that controls the contextual bias from the batched input, unifies various prior approaches, and effectively addresses the aforementioned issues. BC is zero-shot, inference-only, and incurs negligible additional costs. In the few-shot setup, we further extend BC to allow it to learn the contextual bias from labeled data. We validate the effectiveness of BC with PaLM 2-(S, M, L) and CLIP models and demonstrate state-of-the-art performance over previous calibration baselines across more than 10 natural language understanding and image classification tasks.
