Active Learning Principles for In-Context Learning with Large Language Models

Katerina Margatina, Timo Schick, Jane Dwivedi-Yu

2023 · 24 citations · 58 references

DOIFull text

Open access

Concepts

TL;DR

Large language models achieve strong few‑shot performance by leveraging a small set of demonstrations in in‑context learning, yet the selection of these demonstrations has received limited study. This work formulates the selection of the most informative demonstrations as a single‑iteration pool‑based active learning problem. The authors evaluate standard active learning strategies—uncertainty, diversity, and similarity—within this framework to identify optimal demonstrations. Across 24 classification and multi‑choice tasks with GPT and OPT models, similarity‑based sampling consistently outperforms random, diversity, and uncertainty methods, demonstrating that semantically similar demonstrations yield higher accuracy, while uncertainty sampling performs poorly in in‑context learning.

Abstract

The remarkable advancements in large language models (LLMs) have significantly enhanced predictive performance in few-shot learning settings. By using only a small number of labeled examples, referred to as demonstrations, LLMs can effectively perform the task at hand through in-context learning. However, the process of selecting demonstrations for maximizing performance has received limited attention in prior work. This paper addresses the issue of identifying the most informative demonstrations for few-shot learning by approaching it as a pool-based Active Learning (AL) problem over a single iteration. We compare standard AL algorithms based on uncertainty, diversity, and similarity, and consistently observe that the latter outperforms all other methods, including random sampling. Our extensive experimentation involving a diverse range of GPT and OPT models across 24 classification and multi-choice tasks, coupled with thorough analysis, unambiguously demonstrates the importance of using demonstrations that are semantically similar to the domain of the test examples. In fact, we show higher average classification performance using "similar" demonstrations with GPT-2 (124M) than random demonstrations with GPT-Neox (20B). Notably, while diversity sampling shows promise, uncertainty sampling, despite its success in conventional supervised learning AL scenarios, performs poorly in in-context learning.

References

58