SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2205.05055 · NeurIPS · 2022

Data Distributional Properties Drive Emergent In-Context Learning in Transformers

Jane Wang, Andrew Lampinen, Stephanie Chan, Adam Santoro, Deepmind Aaditya, K Singh, Pierre Richemond, James Mcclelland Deepmind, Felix Deepmind

arXiv · PDF · Open in the Atlas

Code that ran

6 of 9 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; 1 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 3 failures of our instrument; 3 no recorded run), measured 2026-11-22; 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/2205.05055.json · badge: /api/ran/2205.05055.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
deepmind/emergent_in_context_learning canonical (classifier label)
classifier basis not recorded on the link
3 ran · 3 no recorded run
aadityasingh/icl-dynamics reimplementation (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
FunctionStatusWhere it lives
apply_rope Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
aadityasingh/icl-dynamics/models.py
pointer only (licence: NONE) · get_code("369d990a59246f7f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, aadityasingh/icl-dynamics when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

create_sinusoidal_positions Ran
ran, honoured the contract we drafted
aadityasingh/icl-dynamics/models.py
pointer only (licence: NONE) · get_code("6c3305fbafc272c8")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, aadityasingh/icl-dynamics when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

make_cache_assign Ran
ran; our contract draft was wrong, not the code
aadityasingh/icl-dynamics/models.py
pointer only (licence: NONE) · get_code("45325303dac3d895")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, aadityasingh/icl-dynamics when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

prepare_seqs_for_transformer Ran
ran on a synthesized input
deepmind/emergent_in_context_learning/datasets/utils.py
code served (permissive licence) · get_code("2fa569a9eb572a35")
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 _FlatMapDataset. 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 tensorflow.compat.v2 as tf

# Enable eager execution for TF2
tf.enable_v2_behavior()

# Create a small dataset with image examples
batch_size = 2
seq_len = 4
height = 8
width = 8
channels = 3

# Create example data with images (5D tensor: batch, seq_len, height, width, channels)
example_images = tf.random.uniform(
    shape=(batch_size, seq_len, height, width, channels),
    minval=0,
    maxval=256,
    dtype=tf.int32
)

# Create labels (2D tensor: batch, seq_len)
example_labels = tf.random.uniform(
    shape=(batch_size, seq_len),
    minval=0,
    maxval=10,
    dtype=tf.int32
)

# Create a dataset with the required structure
def create_dataset():
    for i in range(1):
        yield {
            'example': example_images,
            'label': example_labels
        }

ds = tf.data.Dataset.from_generator(
    create_dataset,
    output_signature={
        'example': tf.TensorSpec(shape=(batch_size, seq_len, height, width, channels), dtype=tf.int32),
        'label': tf.TensorSpec(shape=(batch_size, seq_len), dtype=tf.int32)
    }
)

ARGS = {
    'ds': ds,
    'use_constant_labels': False,
    'interleave_targets': True,
    'downsample': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type _FlatMapDataset — a _FlatMapDataset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a _FlatMapDataset 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
reduce_fn Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
deepmind/emergent_in_context_learning/modules/losses.py
code served (permissive licence) · get_code("34959b5d69981166")
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 ArrayImpl, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 jax.numpy as jnp
import numpy as np

# Create a simple numeric array/list to reduce
x = np.array([1.0, 2.0, 3.0, 4.0])

# Test with different reduction modes
ARGS = {
    'x': x,
    'mode': 'mean'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 0, dtype family float, shape () — shape () as a later run recorded it
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
softmax_cross_entropy Ran
ran on a synthesized input
deepmind/emergent_in_context_learning/modules/losses.py
code served (permissive licence) · get_code("c8b1743b116dcfc8")
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 ArrayImpl, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 jax.numpy as jnp
import optax

# Set seed for reproducibility
import numpy as np
np.random.seed(0)

# Create small logits and labels for softmax cross entropy
batch_size = 2
num_classes = 4

# logits: shape (batch_size, num_classes)
logits = jnp.array([
    [1.0, 2.0, 0.5, 1.5],
    [0.2, 0.8, 1.2, 0.1]
], dtype=jnp.float32)

# labels: one-hot encoded, shape (batch_size, num_classes)
labels = jnp.array([
    [0.0, 1.0, 0.0, 0.0],
    [0.0, 0.0, 1.0, 0.0]
], dtype=jnp.float32)

# Test with different reduction modes
ARGS = {
    'logits': logits,
    'labels': labels,
    'reduction': 'sum'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, numpy, optax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 0, dtype family float, shape () — shape () as a later run recorded it
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
conv1 Not yet run
unverified (harvested, no recorded run)
deepmind/emergent_in_context_learning/modules/transformer_core.py
code served (permissive licence) · get_code("652a0680a67dcd73")
How it ran

no invocation recorded.

get_pos_start Not yet run
unverified (harvested, no recorded run)
deepmind/emergent_in_context_learning/modules/transformer_core.py
code served (permissive licence) · get_code("4821ab9352b9a1c1")
How it ran

no invocation recorded.

layer_norm Not yet run
unverified (harvested, no recorded run)
deepmind/emergent_in_context_learning/modules/transformer_core.py
code served (permissive licence) · get_code("5d83309868b4e1a6")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 6 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 6 later) and 3 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
apply_rope 2 other papers
2 later
2404.07129 (2024-04)
What needs to go right for an induction head? A mechanistic study of in-context learning circuits and their formation
2503.05631 (2025-03)
Strategy Coopetition Explains the Emergence and Transience of In-Context Learning
create_sinusoidal_positions 2 other papers
2 later
2404.07129 (2024-04)
What needs to go right for an induction head? A mechanistic study of in-context learning circuits and their formation
2503.05631 (2025-03)
Strategy Coopetition Explains the Emergence and Transience of In-Context Learning
layer_norm 2 other papers
2 later
2207.02098 (2022-07)
Neural Networks and the Chomsky Hierarchy
2302.03067 (2023-02)
Memory-Based Meta-Learning on Non-Stationary Distributions
make_cache_assign 2 other papers
2 later
2404.07129 (2024-04)
What needs to go right for an induction head? A mechanistic study of in-context learning circuits and their formation
2503.05631 (2025-03)
Strategy Coopetition Explains the Emergence and Transience of In-Context Learning
get_pos_start 1 other paper
1 later
2603.13459 (2026-03)
Reconciling In-Context and In-Weight Learning via Dual Representation Space Encoding
reduce_fn 1 other paper
1 later
2603.13459 (2026-03)
Reconciling In-Context and In-Weight Learning via Dual Representation Space Encoding

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-22.

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 transformer-based models are able to perform in-context few-shot learning, without being explicitly trained for it. This observation raises the question: what aspects of the training regime lead to this emergent behavior? Here, we show that this behavior is driven by the distributions of the training data itself. In-context learning emerges when the training data exhibits particular distributional properties such as burstiness (items appear in clusters rather than being uniformly distributed over time) and having large numbers of rarely occurring classes. In-context learning also emerges more strongly when item meanings or interpretations are dynamic rather than fixed. These properties are exemplified by natural language, but are also inherent to naturalistic data in a wide range of other domains. They also depart significantly from the uniform, i.i.d. training distributions typically used for standard supervised learning. In our initial experiments, we found that in-context learning traded off against more conventional weight-based learning, and models were unable to achieve both simultaneously. However, our later experiments uncovered that the two modes of learning could co-exist in a single model when it was trained on data following a skewed Zipfian distribution -another common property of naturalistic data, including language. In further experiments, we found that naturalistic data distributions were only able to elicit in-context learning in transformers, and not in recurrent models. In sum, our findings indicate how the transformer architecture works together with particular properties of the training data to drive the intriguing emergent in-context learning behaviour of large language models, and how future work might encourage both in-context and in-weights learning in domains beyond language. 1 (a) In-context learning on holdout classes. (a) In-context learning on holdout classes.

For agents

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

get_harvested_code_for_paper("2205.05055")
get_code_for_paper("2205.05055")
have("2205.05055")

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

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

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

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

Connect an agent — have() is free.