Papers › Active Example Selection for In-Context Learning

Active Example Selection for In-Context Learning

8 Nov 2022arXiv:2211.04486archive 2025-07-28

Yiming Zhang, Shi Feng, Chenhao Tan

With a handful of demonstration examples, large-scale language models show strong capability to perform various tasks by in-context learning from these examples, without any fine-tuning. We demonstrate that in-context learning performance can be highly unstable across samples of examples, indicating the idiosyncrasies of how language models acquire information. We formulate example selection for in-context learning as a sequential decision problem, and propose a reinforcement learning algorithm for identifying generalizable policies to select demonstration examples. For GPT-2, our learned policies demonstrate strong abilities of generalizing to unseen tasks in training, with a 5.8% improvement on average. Examples selected from our learned policies can even achieve a small improvement on GPT-3 Ada. However, the improvement diminishes on larger GPT-3 models, suggesting emerging capabilities of large language models.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2211.04486")

Code

Syntology Ran 10 of 16 code samples harvested from 1 repository linked to this paper; 6 have no recorded run. Of those that ran: 1 ran · honoured contract; 6 ran · our draft was wrong; 3 ran with no contract checked.

By repository: official repository: 16 samples from 1 repository, 10 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

chicagohai/active-example-selection officialmentioned in papermentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

16 samples harvested; 10 ran; 1 honoured the contract we drafted; 6 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
6ran · our draft was wrong
3ran
6unverified

Licence: 0 of the 16 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from chicagohai/active-example-selection. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

DummyCache chicagohai/active-example-selection/src/prompting/strategies/greedy_strategies.py official repository ran MIT (permissive) · ba11f7925fceb188 · report
GenerationOutput chicagohai/active-example-selection/src/prompting/strategies/greedy_strategies.py official repository ran · metamorphic tier: deterministic MIT (permissive) · 4dbcdfc42cf48596 · report
PromptTooLongError chicagohai/active-example-selection/src/prompting/strategies/greedy_strategies.py official repository ran · metamorphic tier: deterministic MIT (permissive) · 139c2397c626a5ae · report
deterministic_hash chicagohai/active-example-selection/src/prompting/strategies/greedy_strategies.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · a306bbb5821e4026 · report
deterministic_random chicagohai/active-example-selection/src/prompting/strategies/greedy_strategies.py official repository ran · our draft was wrong MIT (permissive) · 35440e3dc405d3ac · report
entropy chicagohai/active-example-selection/src/prompting/strategies/greedy_strategies.py official repository ran · honoured contract fingerprinted MIT (permissive) · 1425a704ec322a88 · report
extract_completion chicagohai/active-example-selection/src/prompting/strategies/greedy_strategies.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · f20f556e35d766b1 · report
print_json chicagohai/active-example-selection/src/prompting/strategies/greedy_strategies.py official repository ran · our draft was wrong MIT (permissive) · 7d151daf94139a93 · report
read_json_file chicagohai/active-example-selection/src/prompting/strategies/greedy_strategies.py official repository ran · our draft was wrong MIT (permissive) · c7e900c72688b821 · report
to_device chicagohai/active-example-selection/src/prompting/strategies/greedy_strategies.py official repository ran · our draft was wrong MIT (permissive) · fc32f59c23dbf003 · report
BaseProcessor chicagohai/active-example-selection/src/prompting/strategies/greedy_strategies.py official repository unverified MIT (permissive) · 9774b3d0c806c454 · report
BaseStrategy chicagohai/active-example-selection/src/prompting/strategies/greedy_strategies.py official repository unverified MIT (permissive) · 35aa183a5e712bbc · report
GPT2Wrapper chicagohai/active-example-selection/src/prompting/strategies/greedy_strategies.py official repository unverified MIT (permissive) · 2c1d90531acc1316 · report
GreedyStrategy chicagohai/active-example-selection/src/prompting/strategies/greedy_strategies.py official repository unverified MIT (permissive) · b7e78ffc8b787c70 · report
MaxEntropyStrategy chicagohai/active-example-selection/src/prompting/strategies/greedy_strategies.py official repository unverified MIT (permissive) · 9bc9d1d77e4260f8 · report
Prompt chicagohai/active-example-selection/src/prompting/strategies/greedy_strategies.py official repository unverified MIT (permissive) · 5c27cd49d2cb1b0d · report

Tasks

In-Context Learning

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

AdamAttentionAttention DropoutBPECosine AnnealingDense ConnectionsDiscriminative Fine-TuningDropoutGPT-2GPT-3Layer NormalizationLinear LayerLinear Warmup With Cosine AnnealingMulti-Head AttentionResidual ConnectionSoftmaxWeight Decay

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections