Token-based Decision Criteria Are Suboptimal in In-context Learning
Hakaze Cho, Yoshihiro Sakai, Mariko Kato, Kenshiro Tanaka, Akira Ishii, Naoya Inoue
TL;DR
This work critiques token-probability based decision criteria in in-context learning and introduces Hidden Calibration, a lightweight method that builds per-label centroids from the LM's last hidden states and predicts via nearest-centroid similarity. Across six models and ten datasets, Hidden Calibration consistently outperforms traditional token-based baselines and even a whole-vocabulary centroid method, achieving strong state-of-the-art results with limited computational overhead. The authors show that hidden-state centroids yield cleaner class separation and that demonstrations promote linear separability in the hidden space, offering new insights into the principles underlying ICL. The approach also demonstrates robustness to prompt design and demonstrates favorable efficiency in time, space, and data usage, suggesting practical benefits for real-world ICL deployments.
Abstract
In-Context Learning (ICL) typically utilizes classification criteria from output probabilities of manually selected label tokens. However, we argue that such token-based classification criteria lead to suboptimal decision boundaries, despite delicate calibrations through translation and constrained rotation applied. To address this problem, we propose Hidden Calibration, which renounces token probabilities and uses the nearest centroid classifier on the LM's last hidden states. In detail, we assign the label of the nearest centroid previously estimated from a calibration set to the test sample as the predicted label. Our experiments on 6 models and 10 classification datasets indicate that Hidden Calibration consistently outperforms current token-based baselines by about 20%~50%, achieving a strong state-of-the-art in ICL. Our further analysis demonstrates that Hidden Calibration finds better classification criteria with less inter-class overlap, and LMs provide linearly separable intra-class clusters with the help of demonstrations, which supports Hidden Calibration and gives new insights into the principle of ICL. Our official code implementation can be found at https://github.com/hc495/Hidden_Calibration.
