Prototypical Calibration for Few-shot Learning of Language Models

Zhixiong Han, Yaru Hao, Li Dong, Furu Wei

Introduction: The Fragility of In-Context Learning

Few-shot in-context learning (ICL) allows large language models (LLMs) to perform tasks using only a few demonstration examples. However, this paradigm is notoriously "fragile": performance can swing wildly based on minor changes in prompt phrasing or example ordering.

Standard in-context learning setup where a model predicts a label based on a few demonstrations.

The core issue identified in this research is a shifted decision boundary. Due to intrinsic model biases—such as a preference for certain common words or the most recent example in a prompt—the model's default decision threshold (e.g., 0.5 for binary classification) often fails to align with the actual distribution of its outputs.

Prototypical Calibration (PROCA)

To address this, the authors introduce Prototypical Calibration (PROCA). Instead of relying on raw probability scores, PROCA uses unlabeled, in-domain data to adaptively learn more robust decision boundaries. The method follows a four-step pipeline:

  1. Output Formalization: Predictions are represented as log-probability vectors for each possible label.
  2. Prototypical Cluster Estimation: A Gaussian Mixture Model (GMM) is fitted to the model's outputs on a small set of unlabeled data to identify "prototypical" clusters.
  3. Cluster-Label Assignment: Clusters are mapped to target labels using weighted bipartite matching (the Kuhn-Munkres algorithm).
  4. Inference: New examples are classified based on their likelihood of belonging to these discovered prototypical clusters.

Key Insights: The "Robust Region"

A critical finding of this work is that for almost any prompt, there exists a "robust region"—a decision boundary that yields high accuracy. The problem isn't necessarily a "bad" prompt, but rather that the default threshold is poorly placed. PROCA effectively "sees" where these clusters form in the output space and adjusts the boundary accordingly.

The authors also found that using log-probabilities instead of raw logits makes the output distribution more Gaussian-like, which significantly improves the GMM's fitting accuracy compared to using simple probabilities.

Evaluation and Results

PROCA was evaluated across nine text classification benchmarks (including SST-2, AGNews, and RTE) using models ranging from GPT-2 (0.8B) to Bloom (176B).

Comparison of output distributions and accuracy for different prompts. PROCA identifies a better decision boundary than the default GPT threshold, leading to significant accuracy gains.
  • Significant Performance Gains: PROCA achieved an average 13% absolute accuracy boost over standard GPT decoding and a 6% improvement over previous state-of-the-art calibration methods.
  • Massive Improvements in Extreme Cases: On the DBPedia dataset with GPT-J, accuracy improved by as much as 40% absolute.
  • Stability: PROCA significantly reduced performance variance caused by the ordering of examples, making ICL much more reliable regardless of prompt organization.
  • Scalability: The method remains effective across model scales, though larger models like Bloom (176B) show more inherent robustness to boundary shifts than smaller ones.

Conclusion and Limitations

While PROCA offers a robust solution for classification tasks, it is currently limited to closed label spaces where the set of possible answers is predefined. It does not yet apply to open-ended generation tasks like summarization. Additionally, while it corrects decision boundaries, it does not mitigate underlying social biases present in the base LLMs. Future work will explore extending prototypical logic to broader generative tasks.

Summary updated

BibTeX
@inproceedings{han2023prototypical,
  author = {Zhixiong Han and Yaru Hao and Li Dong and Furu Wei},
  title = {{Prototypical Calibration for Few-shot Learning of Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=nUsP9lFADUF},
}
Figure