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 ranMethod as code

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

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

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 16 code samples harvested from 1 repository linked to this paper: 10 ran (of which 3 constructed an object rather than computing a result; 4 with no instrument failure: 1 honoured, 0 violated, 3 with no contract checked; 6 where Syntology's instrument failed) · 6 unverified. Where Syntology's instrument failed: 6 where our contract draft was wrong; failures of Syntology's instrument, not of the code.

By repository: official repository: 16 samples from 1 repository, 10 ran (4 with no instrument failure; 6 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Levels written on 2026-09-22 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

chicagohai/active-example-selection officialmentioned in papermentioned on GitHubpytorchSyntology: 16 samples, 10 ran (6 instrument-failed) · 6 unverified 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 (of which 3 constructed an object rather than computing a result; 4 with no instrument failure: 1 honoured, 0 violated, 3 with no contract checked; 6 where Syntology's instrument failed) · 6 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page has not changed since , the first build that kept a record date for it; when this build read Syntology's graph is in the build record. That date is 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. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (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 are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. 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 six 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; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. 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.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

chicagohai/active-example-selection official repository 16 samples, 10 ran (6 instrument-failed) · 6 unverified
DummyCache src/prompting/strategies/greedy_strategies.py ran MIT (permissive) · ba11f7925fceb188 · report fixture: returned DummyCache · level recorded 2026-09-22
GenerationOutput src/prompting/strategies/greedy_strategies.py ran · metamorphic tier: deterministic MIT (permissive) · 4dbcdfc42cf48596 · report fixture: returned GenerationOutput · level recorded 2026-09-22
PromptTooLongError src/prompting/strategies/greedy_strategies.py ran · metamorphic tier: deterministic MIT (permissive) · 139c2397c626a5ae · report fixture: returned PromptTooLongError · level recorded 2026-09-22
deterministic_hash in 5 papers src/prompting/strategies/greedy_strategies.py ran · our draft was wrong fingerprinted MIT (permissive) · a306bbb5821e4026 · report fixture: signature s:str/0/str · returned int · level recorded 2026-09-22
deterministic_random in 5 papers src/prompting/strategies/greedy_strategies.py ran · our draft was wrong MIT (permissive) · 35440e3dc405d3ac · report fixture: signature seed:int/0/int · returned Random · level recorded 2026-09-22
entropy in 112 papers
census: 22 implementations from 25 papers, 16 distinct outputs across 4 buckets, one shared input per bucket this sample: bucket 1 of 4, arg 1: rank 2, kind float, dtype float32
src/prompting/strategies/greedy_strategies.py ran · honoured contract fingerprinted MIT (permissive) · 1425a704ec322a88 · report fixture: signature probs:Tensor/2/float · returned Tensor · level recorded 2026-09-22
extract_completion src/prompting/strategies/greedy_strategies.py ran · our draft was wrong fingerprinted MIT (permissive) · f20f556e35d766b1 · report fixture: signature gpt_output:str/0/str · returned str · level recorded 2026-09-22
print_json src/prompting/strategies/greedy_strategies.py ran · our draft was wrong MIT (permissive) · 7d151daf94139a93 · report fixture: signature d:dict/0/?, indent:int/0/int · returned str · level recorded 2026-09-22
read_json_file in 36 papers src/prompting/strategies/greedy_strategies.py ran · our draft was wrong MIT (permissive) · c7e900c72688b821 · report fixture: signature path:str/0/str · returned dict · level recorded 2026-09-22
to_device in 75 papers src/prompting/strategies/greedy_strategies.py ran · our draft was wrong MIT (permissive) · fc32f59c23dbf003 · report fixture: signature tensor_dict:dict/0/?, device:str/0/str · returned dict · level recorded 2026-09-22
BaseProcessor src/prompting/strategies/greedy_strategies.py unverified MIT (permissive) · 9774b3d0c806c454 · report
BaseStrategy src/prompting/strategies/greedy_strategies.py unverified MIT (permissive) · 35aa183a5e712bbc · report
GPT2Wrapper src/prompting/strategies/greedy_strategies.py unverified MIT (permissive) · 2c1d90531acc1316 · report
GreedyStrategy src/prompting/strategies/greedy_strategies.py unverified MIT (permissive) · b7e78ffc8b787c70 · report
MaxEntropyStrategy src/prompting/strategies/greedy_strategies.py unverified MIT (permissive) · 9bc9d1d77e4260f8 · report
Prompt in 17 papers src/prompting/strategies/greedy_strategies.py unverified MIT (permissive) · 5c27cd49d2cb1b0d · report

Method as code Syntology

What Syntology's graph records as this paper's claimed method, lifted into code: each assembly names its bricks (functions and classes), each with its own role and its own verification level. An assembly is not a check that the code implements the method correctly or reproduces the paper's results. Levels are each brick's own verification level in Syntology's graph (level 0: no recorded run), listed brick by brick and never combined into one level; “ran” means the brick executed on a synthesized input, not that its output is correct, and the instrument figure counts failures of Syntology's instrument, not of the code. Where a model read the code against the paper's claim, each assembly's label verdict is one model's judgement, kept in this page's JSON twin; it is not calibrated, so no card prints it.

1 assembly on this paper: 1 harvested, 0 generated.

harvested Assembly for Active Example Selection (graph method: Active Example Selection). 16 bricks; individually on a fixture: 10 ran (of which 3 constructed an object rather than computing a result; 4 with no instrument failure: 1 honoured, 0 violated, 3 with no contract checked; 6 where Syntology's instrument failed) · 6 unverified. The assembly has not been run end-to-end.

  1. MaxEntropyStrategy entry · level 0 · unverified · 9bc9d1d77e4260f8
  2. BaseProcessor helper · level 0 · unverified · 9774b3d0c806c454
  3. GPT2Wrapper helper · level 0 · unverified · 2c1d90531acc1316
  4. GreedyStrategy helper · level 0 · unverified · b7e78ffc8b787c70
  5. entropy helper · level 1 · ran · honoured contract · 1425a704ec322a88
  6. GenerationOutput helper · level 1 · ran · 4dbcdfc42cf48596
  7. Prompt helper · level 0 · unverified · 5c27cd49d2cb1b0d
  8. deterministic_hash helper · level 1 · ran · our draft was wrong · a306bbb5821e4026
  9. deterministic_random helper · level 1 · ran · our draft was wrong · 35440e3dc405d3ac
  10. DummyCache helper · level 1 · ran · ba11f7925fceb188
  11. PromptTooLongError helper · level 1 · ran · 139c2397c626a5ae
  12. extract_completion helper · level 1 · ran · our draft was wrong · f20f556e35d766b1
  13. to_device helper · level 1 · ran · our draft was wrong · fc32f59c23dbf003
  14. BaseStrategy helper · level 0 · unverified · 35aa183a5e712bbc
  15. print_json helper · level 1 · ran · our draft was wrong · 7d151daf94139a93
  16. read_json_file helper · level 1 · ran · our draft was wrong · c7e900c72688b821

Each brick ends with its code_sha256, Syntology's identity for that exact code; click one to copy the get_code call that returns it. For agents, on Syntology's MCP service: assembly(arxiv_id="2211.04486") returns these assemblies with each brick's role and wiring (how to connect).

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