Task Calibration: Calibrating Large Language Models on Inference Tasks

Yingjie Li, Yun Luo, Xiaotian Xie, Yue Zhang · Submission to ICLR 2025 · Rejected

TL;DR

Large Language Models (LLMs) often "cheat" on reasoning tasks by relying on spurious correlations in just one part of the input (e.g., answering a question based solely on the question itself, ignoring the provided context). This paper introduces Task Calibration (TC), a zero-shot, inference-only method inspired by mutual information that forces the model to weigh both parts of an input equally. By factoring out the model's biases toward partial inputs, TC significantly improves zero-shot performance across a wide range of natural language understanding tasks without requiring any fine-tuning.

What Problem Does This Paper Address?

When evaluating LLMs on inference tasks like Natural Language Inference (NLI), stance detection, or paraphrasing, the input typically consists of two distinct parts (e.g., a "premise" and a "hypothesis"). Ideally, an LLM should reason over both components to predict the correct label.

However, the authors identify a phenomenon they call context preference bias. LLMs often suffer from spurious correlations that allow them to guess the answer using only half of the input. For instance, an LLM might predict "entailment" just by looking at the hypothesis, completely ignoring the premise. When the model is given the full context and makes an incorrect prediction, it is frequently because it over-relied on this biased, partial-input guess. While previous calibration methods exist (like Contextual Calibration or Batch Calibration), they generally rely on content-free tokens (like [MASK] or N/A) to estimate bias and fail to address the specific issue of a model overly relying on one specific piece of the contextual input.

Methods

To mitigate context preference bias, the authors propose Task Calibration (TC). TC is a zero-shot, inference-only technique, meaning it requires no annotated data or model fine-tuning.

An illustration of Task Calibration (TC), showing how the model's predictions on partial inputs (Sentence-Only, Question-Only) are used to adjust the final full-context prediction.

The core idea is rooted in mutual information, which measures the joint dependency of two variables on a target, beyond their individual dependencies. Instead of just asking the LLM for the probability of a label given the full input, TC requires three separate forward passes:

  1. Full Context: Calculate the probability of the label given both inputs $p(y | x_{premise}, x_{hypothesis})$.
  2. Premise Only: Calculate the probability given only the premise $p(y | x_{premise})$.
  3. Hypothesis Only: Calculate the probability given only the hypothesis $p(y | x_{hypothesis})$.

TC then reformulates the scoring function to highlight the synergistic effect of both inputs. Mathematically, it adjusts the standard prediction by multiplying it by a penalty term: $\log \left( \frac{p(y | x_{premise}, x_{hypothesis})^2}{p(y | x_{premise}) p(y | x_{hypothesis})} \right)$. If the model is highly confident based on just the premise or just the hypothesis, this formula penalizes that label, forcing the model to favor predictions that genuinely require both pieces of information.

Datasets

The authors evaluated TC on 17 existing text classification datasets spanning several categories. No new datasets were introduced.

  • Natural Language Inference (NLI): RTE, WNLI, SciTail, CB, MNLI, QNLI (drawn heavily from GLUE/SuperGLUE).
  • Stance Detection: Perspectrum, IBM30K, EZ-Stance, IAM, VAST.
  • Paraphrasing: PAWS, QQP.
  • Additional NLU Tasks: SST-2 (Sentiment), OffensEval (Offensive Language), HatEval, HateSpeech18 (Hate Speech).

Key Insights and Ideas

  • LLMs are excellent guessers: The authors proved that models like Mistral-7B can often predict labels like entailment or not_entailment with surprisingly high confidence even when the premise or hypothesis is entirely deleted from the prompt.
  • Partial bias drives full-context errors: There is a massive correlation between a model's incorrect predictions on full inputs and its predictions on partial inputs. For example, on the SciTail dataset, over 90% of the LLM's incorrect predictions perfectly aligned with the guesses it made when looking only at the hypothesis.
  • Mutual information is a natural debiaser: By framing the problem through the lens of mutual information, the authors found a mathematically grounded way to isolate the "joint" reasoning of the LLM, effectively subtracting the "shortcut" reasoning it does on individual sentences.

Key Results

The method was primarily tested on two instruction-tuned models: Mistral-7B-Instruct-v0.3 and Phi-3-mini-4k-instruct.

Performance comparison between the original uncalibrated model (Ori.) and Task Calibration (TC) across various datasets.
  • Universal Improvement: TC consistently outperformed the uncalibrated, original LLM across all 13 primary inference datasets.
  • State-of-the-Art Calibration: TC beat existing top-tier calibration baselines (like Batch Calibration and Domain Conditional PMI) in 12 out of 13 datasets for Mistral-7B, and 10 out of 13 for Phi-3.
  • Massive Gains on Specific Tasks: In some cases, the performance jump was staggering. For instance, on the CB (CommitmentBank) dataset, Phi-3's accuracy jumped from 39.3% (uncalibrated) to 83.9% using TC.
  • Robustness: TC proved highly robust to different prompt templates and maintained strong performance in few-shot (1-to-4 shot) in-context learning scenarios.
  • Complementary: TC can actually be combined with other calibration methods (like Batch Calibration) to yield even higher accuracy, showing that task reformulation tackles a unique type of bias.

Limitations and Future Work

  • Computational Overhead: Because TC requires computing probabilities for the premise-only and hypothesis-only inputs, it triples the number of inference passes required per sample. The authors suggest model acceleration techniques (pruning, quantization) to offset this.
  • Requires Logit Access: The method relies on extracting the exact prediction probabilities (logits) for specific classes. This makes it incompatible with many closed-source commercial APIs (like GPT-4 or Claude-3) that do not expose full logit distributions.
  • Future Work: The authors plan to explore extending this mutual information-based calibration to a wider variety of NLP tasks beyond binary/ternary classification, and further investigate how to optimally integrate TC with existing calibration frameworks.

Summary updated

BibTeX
@misc{li2024task,
  author = {Yingjie Li and Yun Luo and Xiaotian Xie and Yue Zhang},
  title = {{Task Calibration: Calibrating Large Language Models on Inference Tasks}},
  year = {2024},
  eprint = {2410.18764},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.18764},
}
Figure