Improving In-Context Learning with Small Language Model Ensembles

M. Mehdi Mojarradi, Lingyi Yang, Robert McCraith, Adam Mahdi

TL;DR

Ensemble SuperICL boosts in-context learning (ICL) by enriching prompts with predictions and confidence scores from an ensemble of small language models (SLMs, <1B parameters). By using a larger LLM as an aggregator, the approach significantly outperforms standard ICL, single-model SuperICL, and simple majority voting on benchmark and domain-specific classification tasks without requiring fine-tuning of the primary model.

What Problem Does This Paper Address?

While large language models (LLMs) excel at general tasks, adapting them to specialized domains typically requires fine-tuning or Retrieval-Augmented Generation (RAG)—both of which are compute-heavy, data-intensive, and prone to engineering overhead.

Standard in-context learning (ICL) offers a lightweight alternative by simply prompting the LLM with a few demonstration examples. However, ICL accuracy often lags behind fine-tuned specialists. Earlier work introduced SuperICL, which appends predictions from a single fine-tuned SLM into the ICL prompt. But SuperICL has a catch: it still demands that the small model be fine-tuned directly on the target dataset, undermining ICL's core advantage of zero training overhead and raising data-leakage concerns.

The authors address this tradeoff: Can we combine multiple off-the-shelf SLMs to boost an LLM's in-context reasoning without task-specific fine-tuning?

Methods

Ensemble SuperICL constructs an enriched prompt that allows an LLM (here, Llama-3-8B-Instruct) to act as an informed judge over multiple smaller models:

  1. Demonstration & Query Sampling: Sample $k$ few-shot examples (input–label pairs) alongside the unlabeled test input.
  2. Ensemble Super Context: Pass both the demonstrations and the test input through $p$ fine-tuned SLMs (2 to 5 models, including variants of RoBERTa, DeBERTa, ELECTRA, BART, MobileBERT, and T5). For every input, each SLM outputs a predicted label and a confidence score (derived via sigmoid over logit probabilities).
  3. Prompt Formulation: Each in-context demonstration is formatted to include the original input, the predictions and confidence scores from all $p$ SLMs, and the ground-truth label. The test query is similarly augmented with the SLMs' predictions and confidence scores.
  4. LLM Inference: The LLM receives instructions, the augmented demonstrations, and the augmented test input. Using greedy decoding, it infers the correct final label.

By exposing the LLM to both the SLMs' outputs and the ground-truth answers in the demonstrations, the LLM learns which SLMs are trustworthy and how to calibrate their confidence scores.

[Input Example] + [SLM 1..p Predictions & Confidences] + [True Label]
                              ↓
[Test Input]    + [SLM 1..p Predictions & Confidences] + [LLM Predicts ?]

Datasets

The authors evaluated their framework across five classification benchmarks:

  • GLUE NLU Benchmarks:
  • SST-2: Sentiment analysis (binary, 872 test examples).
  • MRPC: Paraphrase detection (binary, 408 test examples).
  • MNLI: Natural Language Inference (3-class, 9,815 test examples).
  • CoLA: Grammatical acceptability (binary, 1,043 test examples; evaluated via Matthews Correlation).
  • Domain-Specific Case Study:
  • MedMCQA: A medical exam QA dataset. The authors created a balanced 700-question subset requiring models to classify questions into Dental or Surgery. Notably, the SLMs were not fine-tuned on medical text; they were off-the-shelf models fine-tuned purely on MNLI to test out-of-domain transferability.

Key Insights and Ideas

  • Triangulation Over Plain Voting: Rather than using hard-coded majority voting, the LLM uses context examples to calibrate the credibility of each SLM. It learns when a small model is "confidently wrong" versus reliable.
  • Weak Models Still Provide Signal: On CoLA, MobileBERT (52.78%) and T5 (53.51%) both underperformed the base LLM (55.43%). Yet ensembling them via SuperICL lifted performance to 62.21%. Similarly, an ELECTRA model scoring under 30% on MedMCQA still helped boost overall ensemble accuracy to 82.00%.
  • Cross-Task Transferability: SLMs tuned merely on general natural language inference (MNLI) provided sufficient feature representations to substantially boost performance on medical classification tasks.
  • Bigger Gains on Harder Tasks: The more challenging the task was for standard ICL (e.g., MRPC and CoLA), the larger the performance margin provided by Ensemble SuperICL.

Key Results

  • GLUE Benchmarks: Ensemble SuperICL beat standard ICL, single-model SuperICL, and SLM majority voting on three of four tasks:
  • SST-2: 97.13% (vs. ICL 94.15%, SuperICL 96.56%, SLM Majority Vote 96.67%).
  • MRPC: 91.42% (vs. ICL 75.25%, SuperICL 89.22%, SLM Majority Vote 90.69%).
  • CoLA (MCC): 70.36 (vs. ICL 55.43, SuperICL 67.21, SLM Majority Vote 65.64).
  • MNLI: Reached 91.27%, substantially outperforming ICL (71.24%) and SuperICL (87.45%), finishing just shy of the SLM Majority Vote baseline (91.39%).
  • Medical Domain (MedMCQA): Reached 84.29%, beating the LLM alone (79.43%), single SuperICL (82.71%), and SLM majority voting (68.14%).
  • Ablations: Removing SLM predictions from context examples and test confidence scores dropped performance by up to 6 percentage points (notably on MNLI and MedMCQA), confirming that confidence values and demonstration contexts are essential for calibration.

Limitations and Future Work

  • Hyperparameter Sensitivity: The optimal choice of SLMs, number of models (2 to 5), and few-shot count (0 to 32) varies significantly depending on the dataset.
  • Restricted to Classification: The study evaluated text classification; free-form generation and generative QA (e.g., SQuAD) remain unexplored for this specific ensemble setup.
  • Broader Domain Testing: MedMCQA was evaluated only as a binary classification problem (Dental vs. Surgery); future work needs to validate whether transferability holds across more varied technical domains and multi-class settings.

Summary updated

BibTeX
@inproceedings{mojarradi2024improving,
  author = {M. Mehdi Mojarradi and Lingyi Yang and Robert McCraith and Adam Mahdi},
  title = {{Improving In-Context Learning with Small Language Model Ensembles}},
  booktitle = {AFM @ NeurIPS},
  year = {2024},
  url = {https://openreview.net/forum?id=v9WxznHEaL},
}
Figure