Boosting In-Context Learning in LLMs Through the Lens of Classical Supervised Learning

Korel Gundem, Juncheng Dong, Dennis Zhang, Vahid Tarokh, Zhengling Qi · Submission to ICLR 2026 · Desk rejected

TL;DR

Standard calibration techniques for in-context learning (ICL) only shift an LLM’s decision threshold, which fails when the model is fundamentally misdirected. Supervised Calibration (SC) reframes calibration as learning an affine transformation (both scaling and shift) directly on logit space using surrogate data generated from the prompt demonstrations. By allowing the decision boundary to rotate and even flip—stabilized by context-invariance and trust-region regularizers—SC achieves state-of-the-art few-shot classification across diverse benchmarks.

What Problem Does This Paper Address?

Few-shot in-context learning in Large Language Models (LLMs) is notoriously fragile. Models are easily swayed by prompt templates, label verbalizers, and exemplar ordering.

To correct these biases, standard approaches (such as Contextual Calibration, Batch Calibration, and Domain-Context Calibration) estimate the LLM’s marginal label prior and discount over-represented classes. However, in logit space, these methods are mathematically equivalent to adding a class-specific bias term—they only shift the decision boundary without changing its orientation.

If the base LLM’s predictions are fundamentally misaligned (for instance, performing worse than random guess on a difficult multi-class task), simply shifting the decision threshold cannot fix the underlying issue. At best, it caps performance at random guessing.

Methods

The authors introduce Supervised Calibration (SC), which treats calibration as a classical supervised learning problem:

  1. Affine Logit Transformation: Instead of just shifting logits by a bias $b_c$, SC learns an affine transformation for each non-reference class $c$: $$L_c(x) = w_c \cdot m_c(x; C_k) + b_c$$ Optimizing the scaling factor $w_c$ enables the model to rotate or even invert ($w_c < 0$) misdirected decision boundaries.

  2. Surrogate Data via Leave-Subset-Out: Without needing external labeled data, SC creates a surrogate dataset from the prompt's $k$ demonstration examples. It partitions the demonstrations into smaller sub-contexts of size $i < k$ and evaluates the held-out examples as queries, pairing the LLM’s output logits with ground-truth labels.

  3. Purpose-Built Regularizers:
  4. Context-Invariance Regularizer: Penalizes symmetric cross-entropy divergence between predictions on the same query under different demonstration permutations, directly tackling ICL prompt instability.
  5. Directional Trust-Region: Constrains the cosine similarity between the learned parameter vector $[b_c, w_c]^\top$ and the identity vector $[0, 1]^\top$, preventing aggressive overfitting when the base model is already reliable.
  6. Two-Level Ensembling: Combines predictions across multiple sub-context sizes (inter-size) and across different sampled sub-contexts (intra-size) at inference time.

Datasets

The authors evaluate SC on nine benchmark text classification datasets across sentiment, topic, subjectivity, and emotion classification:

  • Sentiment: SST-2, SST-5, Rotten Tomatoes, Financial PhraseBank
  • Topic & Question Classification: AG News, SUBJ, TREC
  • Social Media Analysis: TweetEval-Emotion, TweetEval-Hate

Evaluations are conducted off-the-shelf across Llama-2-7B-Chat, Mistral-7B-Instruct-v0.3, and Qwen2-7B-Instruct, with scaling experiments on Llama-13B.

(Note: In the 4-shot setting, SST-5 and TREC were excluded because having more classes than shots leads to missing classes in the surrogate subsets.)

Key Insights and Ideas

  • Why Existing Calibration Fails on Tough Tasks: Label-marginal calibration methods implicitly assume a fixed slope ($w_c = 1$). When an LLM systematically misclassifies nuanced categories (e.g., confusing "negative" with "very negative"), shifting thresholds alone cannot rescue accuracy.
  • Decision Flipping: By allowing $w_c$ to be negative, the calibrator can invert predictions relative to the reference class. On 8-shot SST-5 with Qwen2, SC learned $w_{\text{negative}} = -0.19$ and $b_{\text{negative}} = -1.29$, reorienting the boundary and boosting performance dramatically.
  • The Bias-Variance Trade-off in ICL: SC optimizes $2(n-1)$ parameters compared to $n-1$ for marginal methods. While this richer hypothesis class reduces approximation error, it risks higher estimation variance in low-data regimes. The trust-region and context-invariance regularizers serve as necessary variance dampers.

Key Results

  • Consistent SOTA Gains: SC outperforms the uncalibrated base LLM and all baselines (CC, DC, BC) across 4-, 8-, and 16-shot configurations.
  • Substantial Average Improvements: SC provides an average absolute gain of +11.1% Macro-F1 over the base LLM and +7.1% Macro-F1 over the strongest competing baseline (Batch Calibration). Peak gains reach up to +22.6% (8-shot Qwen2-7B-Instruct).
  • Major Leaps on Hard Benchmarks: On 8-shot SST-5 using Qwen2-7B, SC increases accuracy from 24% (base LLM) and 25% (baselines) to 44% (Macro-F1 jumping from 0.1565 to 0.4106).
  • Ablations Confirm Component Synergy: Ablation studies show that fixing $w_c = 1$ causes performance on SST-5 to collapse to 0.10 Macro-F1. Furthermore, combining both the trust-region constraint and context invariance yields the highest overall accuracy (0.788 vs. 0.729 unregularized).

Limitations and Future Work

  • Inference Latency Overhead: Sub-context ensembling requires multiple forward passes per test example; inference time scales roughly linearly with the number of sampled sub-contexts $m_i$.
  • Sub-Context Selection: Sub-contexts are currently sampled uniformly at random rather than selected or weighted via active or uncertainty-guided strategies.
  • Surrogate Data Dependencies: A rigorous statistical analysis accounting for dependencies between overlapping sub-contexts in the surrogate dataset remains an open question.
  • Task Scope: The current formulation focuses on classification; extending affine-logit reorientation to generative or regression tasks is left for future research.

Summary updated

BibTeX
@misc{gundem2025boosting,
  author = {Korel Gundem and Juncheng Dong and Dennis Zhang and Vahid Tarokh and Zhengling Qi},
  title = {{Boosting In-Context Learning in LLMs Through the Lens of Classical Supervised Learning}},
  year = {2025},
  eprint = {2505.23783},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.23783},
}
Figure