MetaICL: Learning to Learn In Context

Sewon Min, Mike Lewis, Luke Zettlemoyer, Hannaneh Hajishirzi

Abstract

MetaICL (Meta-training for In-Context Learning) is a framework designed to enhance the few-shot capabilities of language models by tuning them on a massive collection of diverse tasks. By training models to recover task semantics directly from a few examples, MetaICL enables smaller models to outperform much larger counterparts and rival fully finetuned models on unseen tasks—all without manual prompt engineering or parameter updates at test time.

Introduction

In-context learning (ICL) allows models like GPT-3 to perform tasks simply by observing a few examples in the prompt. While revolutionary, standard ICL suffers from significant performance gaps compared to supervised finetuning, high instability based on example ordering, and a heavy reliance on labor-intensive "prompt engineering." MetaICL addresses these flaws by asking: Can we train a model specifically to be better at the act of learning from context?

Methods

The core of MetaICL is a "meta-training" phase that shifts the model's objective from standard language modeling to learning task inference from context.

The Meta-Training Objective

Instead of predicting the next token in a vacuum, the model is trained on a large set of tasks. For each iteration, a task and $k+1$ examples are sampled. The first $k$ examples serve as the context, and the model is trained to predict the label of the $(k+1)$-th query example conditioned on that context. Unlike other multi-task approaches like FLAN or T0, MetaICL does not use human-written instructions; it learns to infer the task purely from input-output pairs.

The MetaICL objective for meta-training and inference.

Channel MetaICL

The researchers also implemented a "noisy channel" variant. Rather than predicting the label given the input $P(y|x)$, Channel MetaICL predicts the input given the label $P(x|y)$. This approach has demonstrated superior stability and performance in few-shot settings.

Experimental Setup

The study utilizes a diverse collection of 142 NLP datasets, including text classification, QA, natural language inference (NLI), and paraphrase detection, sourced from benchmarks like CrossFit and UnifiedQA. To ensure rigorous evaluation, the authors used seven different meta-training/target splits, ensuring that target tasks at test time were strictly unseen during the meta-training phase.

Key Results and Insights

Scaling with Task Diversity

A critical finding was that the diversity of meta-training tasks is more important than the sheer quantity of data. As the number of meta-training tasks increases, performance on unseen target tasks improves consistently.

Performance of MetaICL variants as the number of meta-training tasks increases.

Performance Gains

MetaICL consistently outperformed standard ICL and multi-task zero-shot transfer. In the "High Resource to Low Resource" (HR→LR) setting, Channel MetaICL achieved 49.1% accuracy, a significant jump from the 38.2% seen in standard ICL. The gains were most pronounced in unseen domains; for example, on NLI tasks in new domains, MetaICL nearly doubled the performance of zero-shot baselines.

Efficiency and Scale

One of the most striking results is that a meta-trained GPT-2 Large (770M parameters) can outperform a raw GPT-J (6B parameters) on ICL tasks. This suggests that specialized meta-training is a more efficient path to few-shot mastery than simply increasing model scale.

Limitations and Future Work

While MetaICL offers a powerful alternative to standard ICL, it faces constraints regarding context window size. Because it relies on concatenating multiple examples, inference is more computationally expensive than zero-shot methods. Additionally, while the current study focuses on classification and multiple-choice tasks, future research is needed to determine how this meta-training scales to free-form generation tasks like summarization or dialogue.

Summary updated

BibTeX
@inproceedings{min2022metaicl,
  author = {Sewon Min and Mike Lewis and Luke Zettlemoyer and Hannaneh Hajishirzi},
  title = {{MetaICL: Learning to Learn In Context}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2022},
  doi = {10.18653/v1/2022.naacl-main.201},
}
Figure