SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.14660 · 2024

Implicit In-context Learning

arXiv · PDF · Open in the Atlas

Code that ran

3 of 4 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 0 have no contract verdict; 2 failures of our instrument; 1 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/2405.14660.json · badge: /api/ran/2405.14660.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
lzvv123456/i2cl canonical (classifier label)
classifier basis: census
3 ran · 1 no recorded run
FunctionStatusWhere it lives
prepare_inject_dicts_params Ran
ran; our contract draft was wrong, not the code
lzvv123456/i2cl/run_i2cl_transfer_learning.py
code served (permissive licence) · get_code("169ef87f2e4e8abc")
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 tuple. 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)

# Analyze function usage:
# - tar_prob: indexed with [idx], should be numeric (float)
# - tar_cv_dicts: list indexed with [idx], each element is dict with layer keys
#   - each layer maps to dict with module keys
#   - values are cv (numeric, used in multiplication)
# - tar_coef: indexed with [idx], has .size() method, indexed as [idx][layer_idx, module_idx, 0]
#   - appears to be a tensor with shape (num_samples, num_layers, num_modules, 1)

# Build small example data
num_samples = 2
num_layers = 2
num_modules = 3

# tar_prob: list of probabilities
tar_prob = [0.4, 0.6]

# tar_cv_dicts: list of dicts, each mapping layer names to module dicts
tar_cv_dicts = [
    {
        0: {"module_0": 0.1, "module_1": 0.2, "module_2": 0.3},
        1: {"module_0": 0.15, "module_1": 0.25, "module_2": 0.35},
    },
    {
        0: {"module_0": 0.12, "module_1": 0.22, "module_2": 0.32},
        1: {"module_0": 0.17, "module_1": 0.27, "module_2": 0.37},
    },
]

# tar_coef: list of tensors with shape (num_layers, num_modules, 1)
tar_coef = [
    torch.randn(num_layers, num_modules, 1),
    torch.randn(num_layers, num_modules, 1),
]

ARGS = {
    "tar_prob": tar_prob,
    "tar_cv_dicts": tar_cv_dicts,
    "tar_coef": tar_coef,
}
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 tuple — a tuple output has no array shape of its own; none is 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
set_device Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
lzvv123456/i2cl/utils.py
code served (permissive licence) · get_code("39337f4c7d83dd47")
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 device. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 takes a gpu_id parameter
# It checks torch.cuda.is_available() and constructs a device string
# Since we're CPU-only, we just pass a valid gpu_id integer
# The function will handle the CPU fallback internally

ARGS = {
    'gpu_id': 0
}
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 device — a device output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a device 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
target_layer_selection Ran
ran, honoured the contract we drafted
lzvv123456/i2cl/run_task_vector.py
code served (permissive licence) · get_code("405289a97499d9cc")
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) and returned int, ndim 0, dtype family int, 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 torch
import torch.nn as nn

torch.manual_seed(0)

class MockTokenizer:
    def __call__(self, text):
        return {"input_ids": torch.tensor([[1, 2, 3, 4]])}

class MockEvaluator:
    def evaluate(self, model, tokenizer, demonstration='', use_cache=False):
        return {
            'accuracy': 0.75,
            'loss': 0.25,
            'f1': 0.70
        }

class MockModelWrapper(nn.Module):
    def __init__(self, num_layers=4):
        super().__init__()
        self.num_layers = num_layers
        self.layers = nn.ModuleList([nn.Linear(4, 4) for _ in range(num_layers)])
    
    def forward(self, x):
        for layer in self.layers:
            x = layer(x)
        return x
    
    class ContextManager:
        def __init__(self, model):
            self.model = model
        
        def __enter__(self):
            return self
        
        def __exit__(self, exc_type, exc_val, exc_tb):
            pass
    
    def replace_latent(self, context_vector_dict, layers, config):
        return self.ContextManager(self)

class MockArgs:
    def __init__(self):
        self.metric = 'accuracy'
        self.config = {
            'use_cache': False,
            'hidden_size': 4
        }

model_wrapper = MockModelWrapper(num_layers=4)
tokenizer = MockTokenizer()
evaluator = MockEvaluator()
args = MockArgs()

context_vector_dict = {
    0: torch.randn(2, 4),
    1: torch.randn(2, 4),
    2: torch.randn(2, 4),
    3: torch.randn(2, 4)
}

ARGS = {
    'args': args,
    'model_wrapper': model_wrapper,
    'tokenizer': tokenizer,
    'evaluator': evaluator,
    'context_vector_dict': context_vector_dict
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, 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
load_model_tokenizer Not yet run
unverified (harvested, no recorded run)
lzvv123456/i2cl/utils.py
code served (permissive licence) · get_code("41fdcb9543d21908")
How it ran

no invocation recorded.

Also present in other papers' code

Of 4 samples lifted from this paper's linked repositories, 4 carry a function identity and 0 do not. Of the 4 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 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
target_layer_selection 1 other paper
1 later
2605.20730 (2026-05)
Distributional Alignment as a Criterion for Designing Task Vectors in In-Context Learning

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

In-context Learning (ICL) empowers large language models (LLMs) to swiftly adapt to unseen tasks at inference-time by prefixing a few demonstration examples before queries. Despite its versatility, ICL incurs substantial computational and memory overheads compared to zero-shot learning and is sensitive to the selection and order of demonstration examples. In this work, we introduce Implicit In-context Learning (I2CL), an innovative paradigm that reduces the inference cost of ICL to that of zero-shot learning with minimal information loss. I2CL operates by first generating a condensed vector representation, namely a context vector, extracted from the demonstration examples. It then conducts an inference-time intervention through injecting a linear combination of the context vector and query activations back into the model's residual streams. Empirical evaluation on nine real-world tasks across three model architectures demonstrates that I2CL achieves few-shot level performance at zero-shot inference cost, and it exhibits robustness against variations in demonstration examples. Furthermore, I2CL facilitates a novel representation of task-ids, enhancing task similarity detection and fostering effective transfer learning. We also perform a comprehensive analysis and ablation study on I2CL, offering deeper insights into its internal mechanisms. Code is available at https://github.com/LzVv123456/I2CL.

For agents

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

get_harvested_code_for_paper("2405.14660")
get_code_for_paper("2405.14660")
have("2405.14660")

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

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

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

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

Connect an agent — have() is free.