SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.17264 · NeurIPS · 2024

On the Noise Robustness of In-Context Learning for Text Generation

Hongxin Wei, Feng Zheng, Wenyu Jiang, Hongfu Gao, Feipeng Zhang, Jun Shu

arXiv · PDF · Open in the Atlas

Code that ran

5 of 11 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, 1 violated it and 0 have no contract verdict; 4 failures of our instrument; 6 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.17264.json · badge: /api/ran/2405.17264.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
ml-stat-Sustech/Local-Perplexity-Ranking canonical (classifier label)
classifier basis: census
5 ran · 6 no recorded run
FunctionStatusWhere it lives
get_inputes Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ml-stat-Sustech/Local-Perplexity-Ranking/common/utils.py
code served (permissive licence) · get_code("29e3b3506f0f02c6")
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

torch.manual_seed(0)

# Construct arguments for get_inputes function

# task - appears to be unused in the function body, can be a simple string or dict
task = "classification"

# new_ice_idx - list of lists of indices to select from training_dataset
# Each inner list represents indices for one example
new_ice_idx = [[0, 1], [1, 2]]

# new_ice_target - dict-like object that supports indexing with int keys
# Maps indices to target/answer values
new_ice_target = {
    0: "answer_0",
    1: "answer_1",
    2: "answer_2"
}

# template - string template with placeholders </text> and </answer>
template = "Text: </text> Answer: </answer>"

# template_dict - appears to be unused in the function body
template_dict = {}

# training_dataset - dict with 'text' key containing list of text strings
# Must have at least as many elements as the max index in new_ice_idx
training_dataset = {
    'text': [
        "This is sample text 0",
        "This is sample text 1",
        "This is sample text 2"
    ]
}

ARGS = {
    'task': task,
    'new_ice_idx': new_ice_idx,
    'new_ice_target': new_ice_target,
    'template': template,
    'template_dict': template_dict,
    'training_dataset': training_dataset
}
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_logger Ran
ran; our contract draft was wrong, not the code
ml-stat-Sustech/Local-Perplexity-Ranking/common/logging.py
code served (permissive licence) · get_code("792a2c8b12b13057")
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 Logger. 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
import torch.distributed as dist
import tempfile
import os

# Set up a temporary directory for log files (no actual I/O will occur since rank != 0 in non-distributed setup)
temp_dir = tempfile.gettempdir()
log_file_path = os.path.join(temp_dir, "test_logger.log")

ARGS = {
    "name": "test_logger",
    "level": logging.INFO,
    "log_file": log_file_path,
    "file_mode": "w"
}
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 Logger — a Logger output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Logger 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_prompt_label Ran
ran; our contract draft was wrong, not the code
ml-stat-Sustech/Local-Perplexity-Ranking/common/utils.py
code served (permissive licence) · get_code("14ee44efe36afcfb")
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)

ARGS = {
    'task': 'sciq'
}
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
ignore_pad_dict Ran
ran; our contract draft was wrong, not the code
ml-stat-Sustech/Local-Perplexity-Ranking/common/collators.py
code served (permissive licence) · get_code("4753b3ba80fb1cca")
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 torch
import torch.nn as nn

torch.manual_seed(0)

# The function expects a list of dictionaries (features)
# It checks if 'metadata' exists in the first element
# It pops 'metadata' from each dict in the list
# The ListWrapper is instantiated with the collected metadata

ARGS = {
    "features": [
        {
            "metadata": {"id": 1, "text": "sample1"},
            "other_field": torch.randn(2, 4),
        },
        {
            "metadata": {"id": 2, "text": "sample2"},
            "other_field": torch.randn(2, 4),
        },
    ]
}
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 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
is_api_available Ran
ran, violated the contract we drafted
ml-stat-Sustech/Local-Perplexity-Ranking/common/api.py
code served (permissive licence) · get_code("aa66004e48501c30")
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 bool, 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 torch
import torch.nn as nn

# The function is_api_available checks if api_name is in OPENICL_API_NAME_LIST
# It takes a single parameter: api_name (a string or None)
# The function returns False if api_name is None, otherwise checks membership

ARGS = {
    'api_name': 'opt-175b'
}
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 bool, 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
api_get_ppl Not yet run
unverified (harvested, no recorded run)
ml-stat-Sustech/Local-Perplexity-Ranking/common/api.py
code served (permissive licence) · get_code("fc0a9b057f213a9a")
How it ran

no invocation recorded.

api_get_tokens Not yet run
unverified (harvested, no recorded run)
ml-stat-Sustech/Local-Perplexity-Ranking/common/api.py
code served (permissive licence) · get_code("430c98669fe41c1a")
How it ran

no invocation recorded.

get_dataloader Not yet run
unverified (harvested, no recorded run)
ml-stat-Sustech/Local-Perplexity-Ranking/dataset/utils.py
code served (permissive licence) · get_code("de0caf0b39aa6452")
How it ran

no invocation recorded.

get_model Not yet run
unverified (harvested, no recorded run)
ml-stat-Sustech/Local-Perplexity-Ranking/model/utils.py
code served (permissive licence) · get_code("58927e35b21bb640")
How it ran

no invocation recorded.

get_retriever Not yet run
unverified (harvested, no recorded run)
ml-stat-Sustech/Local-Perplexity-Ranking/algorithms/utils.py
code served (permissive licence) · get_code("9350b61b9bb071e4")
How it ran

no invocation recorded.

get_tokenizer Not yet run
unverified (harvested, no recorded run)
ml-stat-Sustech/Local-Perplexity-Ranking/model/utils.py
code served (permissive licence) · get_code("a9c86da890c793a6")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 11 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.

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) have shown impressive performance on downstream tasks by in-context learning (ICL), which heavily relies on the quality of demonstrations selected from a large set of annotated examples. Recent works claim that in-context learning is robust to noisy demonstrations in text classification. In this work, we show that, on text generation tasks, noisy annotations significantly hurt the performance of in-context learning. To circumvent the issue, we propose a simple and effective approach called Local Perplexity Ranking (LPR), which replaces the "noisy" candidates with their nearest neighbors that are more likely to be clean. Our method is motivated by analyzing the perplexity deviation caused by noisy labels and decomposing perplexity into inherent perplexity and matching perplexity. Our key idea behind LPR is thus to decouple the matching perplexity by performing the ranking among the neighbors in semantic space. Our approach can prevent the selected demonstrations from including mismatched input-label pairs while preserving the effectiveness of the original selection methods. Extensive experiments demonstrate the effectiveness of LPR, improving the EM score by up to 18.75 on common benchmarks with noisy annotations. Our code is available at https://github.com/ml-stat-Sustech/Local-Perplexity-Ranking * Work done while working at SUSTech as a visiting scholar.

For agents

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

get_harvested_code_for_paper("2405.17264")
get_code_for_paper("2405.17264")
have("2405.17264")

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

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

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

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

Connect an agent — have() is free.