SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.09731 · 2023

What In-Context Learning "Learns" In-Context: Disentangling Task Recognition and Task Learning

arXiv · PDF · Open in the Atlas

Code that ran

8 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 4 failures of our instrument; 0 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2305.09731.json · badge: /api/ran/2305.09731.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
princeton-nlp/whaticllearns canonical (classifier label)
classifier basis: census
8 ran · 0 no recorded run
FunctionStatusWhere it lives
augment_sentence Ran
ran on a synthesized input
princeton-nlp/whaticllearns/spb/utils.py
code served (permissive licence) · get_code("9e506ab33d9191c8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import logging
from typing import Tuple, List, Dict

# Set up logging
logging.basicConfig(level=logging.INFO)

# Define the ARGS dictionary with valid arguments for augment_sentence
ARGS = {
    'tokens': ['Tolkien', 'was', 'born', 'here'],
    'augmentations': [
        ([('person',), ('born in', 'here')], 0, 1),
        ([('location',)], 3, 4),
    ],
    'begin_entity_token': '[',
    'sep_token': '|',
    'er_sep_token': '=',
    'relation_sep_token': '->',
    'end_entity_token': ']',
    'entity_only': False,
    'before': False,
    'entity_types': ['location', 'organization', 'person', 'other']
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
expand_tokens Ran
ran on a synthesized input
princeton-nlp/whaticllearns/spb/utils.py
code served (permissive licence) · get_code("806ae936dd96ba3b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from typing import Tuple, List, Dict

# Define ARGS with valid arguments for expand_tokens
ARGS = {
    "tokens": ["The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"],
    "augmentations": [
        ([], 0, 9),  # root augmentation covering entire span
        ([("PERSON",)], 0, 3),  # entity with type tag
        ([("ORG", "works_for")], 4, 5),  # entity with relation tags
        ([("LOC",)], 6, 9),  # another entity
    ],
    "entity_tree": {
        -1: [0],  # root has child 0
        0: [1, 2, 3],  # augmentation 0 has children 1, 2, 3
        1: [],  # augmentation 1 has no children
        2: [],  # augmentation 2 has no children
        3: [],  # augmentation 3 has no children
    },
    "root": -1,
    "begin_entity_token": "[E]",
    "sep_token": "|",
    "er_sep_token": "->",
    "relation_sep_token": ":",
    "end_entity_token": "[/E]",
    "entity_only": False,
    "before": False,
    "entity_types": ["location", "organization", "person", "other"],
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_avg_results Ran
ran; our contract draft was wrong, not the code
princeton-nlp/whaticllearns/spb/evaluate.py
code served (permissive licence) · get_code("3e9c0f90d3b4010c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Construct sample results - a list of dictionaries from multiple episodes
# Each episode has various metrics
results = [
    {
        'reward': 100.5,
        'loss': 0.45,
        'accuracy': 0.92,
        'steps': 50
    },
    {
        'reward': 105.2,
        'loss': 0.38,
        'accuracy': 0.95,
        'steps': 48
    },
    {
        'reward': 98.7,
        'loss': 0.52,
        'accuracy': 0.89,
        'steps': 52
    }
]

ARGS = {
    'results': results
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_episode_indices Ran
ran on a synthesized input
princeton-nlp/whaticllearns/spb/utils.py
code served (permissive licence) · get_code("dfd64188df5ce2ba")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

# Test case 1: single episode number
ARGS_1 = {
    'episodes_string': '2'
}

# Test case 2: range of episodes
ARGS_2 = {
    'episodes_string': '1-5'
}

# Test case 3: empty string
ARGS_3 = {
    'episodes_string': ''
}

# Test case 4: None
ARGS_4 = {
    'episodes_string': None
}

# Use the first test case as the main ARGS
ARGS = ARGS_1
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_model_family Ran
ran on a synthesized input
princeton-nlp/whaticllearns/spb/compute_summary_stats.py
code served (permissive licence) · get_code("2cc275485c860a52")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

ARGS = {
    'model': 'gpt3-large'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
register_dataset Ran
ran; our contract draft was wrong, not the code
princeton-nlp/whaticllearns/spb/bench_datasets.py
code served (permissive licence) · get_code("404087a3ff94d6e0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned type. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

# Define a minimal dataset class to pass to register_dataset
class MinimalDataset:
    name = "test_dataset"
    
    def __init__(self):
        pass

# Create an instance of the dataset class
dataset_instance = MinimalDataset()

# Define ARGS mapping the parameter to a value
ARGS = {
    "dataset_class": dataset_instance.__class__
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type type — a type output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a type output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
register_input_format Ran
ran; our contract draft was wrong, not the code
princeton-nlp/whaticllearns/spb/input_formats.py
code served (permissive licence) · get_code("4afe64752662fe3b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned type. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function register_input_format takes a format_class parameter
# and expects it to have a 'name' attribute (accessed via format_class.name)
# It stores the class in a dict using that name as the key

class StandInFormatClass:
    name = "test_input_format"

ARGS = {
    "format_class": StandInFormatClass
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type type — a type output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a type output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
register_output_format Ran
ran; our contract draft was wrong, not the code
princeton-nlp/whaticllearns/spb/output_formats.py
code served (permissive licence) · get_code("ba71a83cd3836e77")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned type. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

class SimpleOutputFormat:
    """A minimal output format class with required 'name' attribute"""
    name = "simple_format"

ARGS = {
    "format_class": SimpleOutputFormat
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type type — a type output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a type output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 4 later) and 4 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
get_avg_results 2 other papers
1 dated earlier, 1 later
2205.10475 (2022-05)
DEEPSTRUCT: Pretraining of Language Models for Structure Prediction
2311.03748 (2023-11)
Unified Low-Resource Sequence Labeling by Sample-Aware Dynamic Sparse Finetuning
register_dataset 2 other papers
1 dated earlier, 1 later
2205.10475 (2022-05)
DEEPSTRUCT: Pretraining of Language Models for Structure Prediction
2311.03748 (2023-11)
Unified Low-Resource Sequence Labeling by Sample-Aware Dynamic Sparse Finetuning
register_input_format 2 other papers
1 dated earlier, 1 later
2205.10475 (2022-05)
DEEPSTRUCT: Pretraining of Language Models for Structure Prediction
2311.03748 (2023-11)
Unified Low-Resource Sequence Labeling by Sample-Aware Dynamic Sparse Finetuning
register_output_format 2 other papers
1 dated earlier, 1 later
2205.10475 (2022-05)
DEEPSTRUCT: Pretraining of Language Models for Structure Prediction
2311.03748 (2023-11)
Unified Low-Resource Sequence Labeling by Sample-Aware Dynamic Sparse Finetuning

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Large language models (LLMs) exploit in-context learning (ICL) to solve tasks with only a few demonstrations, but its mechanisms are not yet well-understood. Some works suggest that LLMs only recall already learned concepts from pre-training, while others hint that ICL performs implicit learning over demonstrations. We characterize two ways through which ICL leverages demonstrations. Task recognition (TR) captures the extent to which LLMs can recognize a task through demonstrations -- even without ground-truth labels -- and apply their pre-trained priors, whereas task learning (TL) is the ability to capture new input-label mappings unseen in pre-training. Using a wide range of classification datasets and three LLM families (GPT-3, LLaMA and OPT), we design controlled experiments to disentangle the roles of TR and TL in ICL. We show that (1) models can achieve non-trivial performance with only TR, and TR does not further improve with larger models or more demonstrations; (2) LLMs acquire TL as the model scales, and TL's performance consistently improves with more demonstrations in context. Our findings unravel two different forces behind ICL and we advocate for discriminating them in future ICL research due to their distinct nature.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2305.09731")
get_code_for_paper("2305.09731")
have("2305.09731")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2305.09731.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2305.09731.svg)](https://syntology.ai/paper/2305.09731)

Connect an agent — have() is free.