SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2407.16695 · NeurIPS · 2024

Stress-Testing Long-Context Language Models with Lifelong ICL and Task Haystack

Xiang Ren, Qinyuan Ye, Xiaoyue Xu

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 3 failures of our instrument; 0 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/2407.16695.json · badge: /api/ran/2407.16695.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
ink-usc/lifelong-icl canonical (classifier label)
classifier basis: classifier_2025
6 ran · 0 no recorded run
FunctionStatusWhere it lives
Dataloader Ran
ran on a synthesized input · constructed an object; no result was computed
ink-usc/lifelong-icl/dataloader/incremental_task.py
code served (permissive licence) · get_code("76c1acb67d1fed8f")
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 an instance of its own class, Dataloader: the run constructed the object and did not call it, so no result was computed. 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 Logger:
    def info(self, msg):
        print(f"INFO: {msg}")
    
    def debug(self, msg):
        print(f"DEBUG: {msg}")
    
    def warning(self, msg):
        print(f"WARNING: {msg}")
    
    def error(self, msg):
        print(f"ERROR: {msg}")

logger = Logger()

args = {
    "batch_size": 2,
    "num_workers": 0,
    "shuffle": True,
    "dataset_name": "test_dataset",
    "data_path": None,
    "max_seq_length": 128,
    "vocab_size": 1000,
    "num_classes": 10,
}

ARGS = {
    "args": args,
    "logger": logger,
}
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 Dataloader — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Dataloader 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
IncrementalDataloader Ran
ran on a synthesized input · constructed an object; no result was computed
ink-usc/lifelong-icl/dataloader/incremental_task.py
code served (permissive licence) · get_code("e68aa86c3c1abab6")
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 an instance of its own class, IncrementalDataloader: the run constructed the object and did not call it, so no result was computed. 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 os
import random
import json
import tempfile
import shutil

class MockLogger:
    def info(self, msg):
        pass

class MockArgs:
    def __init__(self):
        self.data_dir = None
        self.demo_sep = " [SEP] "
        self.task_sep = " [TASK_SEP] "
        self.n_shot = 2

# Create temporary directory structure with mock data
temp_dir = tempfile.mkdtemp()

# Create task directories and files
for task_name in ["task1", "task2", "task3"]:
    task_dir = os.path.join(temp_dir, task_name)
    os.makedirs(task_dir, exist_ok=True)
    
    # Create config.json
    config = {
        "options": ["A", "B", "C"],
        "demonstration_prompt": "Instruction: {instruction}\nInput: {input}\nLabel: {label}",
        "inference_prompt": "Instruction: {instruction}\nInput: {input}\nLabel:",
        "instruction": "Classify the text",
        "instruction_2": "Classify the text (paraphrased)"
    }
    with open(os.path.join(task_dir, "config.json"), "w") as f:
        json.dump(config, f)
    
    # Create train_0.jsonl through train_4.jsonl
    for i in range(5):
        train_file = os.path.join(task_dir, f"train_{i}.jsonl")
        with open(train_file, "w") as f:
            for j in range(6):
                example = {
                    "instruction": "Classify",
                    "input": f"Sample text {j}",
                    "label": random.choice(["A", "B", "C"])
                }
                f.write(json.dumps(example) + "\n")
    
    # Create test.jsonl
    test_file = os.path.join(task_dir, "test.jsonl")
    with open(test_file, "w") as f:
        for j in range(3):
            example = {
                "instruction": "Classify",
                "input": f"Test sample {j}",
                "label": random.choice(["A", "B", "C"])
            }
            f.write(json.dumps(example) + "\n")

# Create args
args = MockArgs()
args.data_dir = temp_dir

# Create logger
logger = MockLogger()

ARGS = {
    "args": args,
    "logger": logger
}
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 IncrementalDataloader — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a IncrementalDataloader 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
SingleTaskDataloader Ran
ran on a synthesized input · constructed an object; no result was computed
ink-usc/lifelong-icl/dataloader/incremental_task.py
code served (permissive licence) · get_code("ddc10b8f2f0154ff")
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 an instance of its own class, SingleTaskDataloader: the run constructed the object and did not call it, so no result was computed. 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 os
import random
import json
import tempfile
from pathlib import Path

class SimpleLogger:
    def info(self, msg):
        print(f"INFO: {msg}")

class SimpleArgs:
    def __init__(self, data_dir, demo_sep):
        self.data_dir = data_dir
        self.demo_sep = demo_sep

# Create a temporary directory structure with test data
temp_dir = tempfile.mkdtemp()
task_name = "test_task"
task_dir = os.path.join(temp_dir, task_name)
os.makedirs(task_dir, exist_ok=True)

# Create config.json
config = {
    "demonstration_prompt": "Input: {instruction}\nOutput: {label}",
    "inference_prompt": "Input: {instruction}\nOutput:",
    "instruction": "Answer the following question:",
    "instruction_2": "Please respond to:",
    "options": ["A", "B", "C"]
}
with open(os.path.join(task_dir, "config.json"), "w") as f:
    json.dump(config, f)

# Create train_0.jsonl through train_4.jsonl
for i in range(5):
    train_file = os.path.join(task_dir, f"train_{i}.jsonl")
    with open(train_file, "w") as f:
        for j in range(2):
            example = {
                "instruction": f"What is {j}?",
                "label": "A"
            }
            f.write(json.dumps(example) + "\n")

# Create test.jsonl
test_file = os.path.join(task_dir, "test.jsonl")
with open(test_file, "w") as f:
    for j in range(2):
        example = {
            "instruction": f"Test question {j}?",
            "label": "B"
        }
        f.write(json.dumps(example) + "\n")

logger = SimpleLogger()
args = SimpleArgs(data_dir=temp_dir, demo_sep=" | ")

ARGS = {
    "args": args,
    "logger": logger
}
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 SingleTaskDataloader — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SingleTaskDataloader 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
generate_random_permutations Ran
ran; our contract draft was wrong, not the code
ink-usc/lifelong-icl/dataloader/incremental_task.py
code served (permissive licence) · get_code("79fcb5916af8f843")
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 2, 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 random

ARGS = {
    "lst": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    "n_item": 5,
    "n_permutations": 3,
    "seed": 42
}
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 list, ndim 2, 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
read_json Ran
ran; our contract draft was wrong, not the code
ink-usc/lifelong-icl/dataloader/incremental_task.py
code served (permissive licence) · get_code("0ae221496d4ff083")
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 json
import tempfile
import os

# Create a temporary JSON file with valid config data
temp_dir = tempfile.mkdtemp()
config_file = os.path.join(temp_dir, "test_config.json")

test_config = {
    "model": "test_model",
    "learning_rate": 0.001,
    "batch_size": 32,
    "epochs": 10,
    "layers": [128, 64, 32]
}

with open(config_file, 'w') as f:
    json.dump(test_config, f)

ARGS = {
    "filename": config_file
}
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 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
read_jsonl Ran
ran; our contract draft was wrong, not the code
ink-usc/lifelong-icl/dataloader/incremental_task.py
code served (permissive licence) · get_code("9cfdd3d5a62805fa")
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 json
import tempfile
import os

# Create a temporary JSONL file with test data
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test.jsonl")

# Write sample JSONL data
with open(temp_file, 'w') as f:
    f.write(json.dumps({"key1": "value1", "key2": 42}) + "\n")
    f.write(json.dumps({"key1": "value2", "key2": 43}) + "\n")
    f.write(json.dumps({"key1": "value3", "key2": 44}) + "\n")

ARGS = {
    "filename": temp_file
}
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 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

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 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 6 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-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

We introduce Lifelong ICL, a problem setting that challenges long-context language models (LMs) to learn a sequence of language tasks through in-context learning (ICL). We further introduce Task Haystack, an evaluation suite dedicated to assessing and diagnosing how long-context LMs utilizes contexts in Lifelong ICL. When given a task instruction and test inputs, long-context LMs are expected to leverage the relevant demonstrations in the Lifelong ICL prompt, avoid distraction and interference from other tasks, and achieve test accuracies that are not significantly worse than those of the Single-task ICL baseline. Task Haystack draws inspiration from the widely-adopted "needle-in-a-haystack" (NIAH) evaluation, but presents distinct new challenges. It requires models (1) to utilize the contexts at a deeper level, rather than resorting to simple copying and pasting; (2) to navigate through long streams of evolving topics and tasks, proxying the complexities and dynamism of contexts in real-world scenarios. Additionally, Task Haystack inherits the controllability of NIAH, providing model developers with tools and visualizations to identify model vulnerabilities effectively. We benchmark 14 long-context LMs using Task Haystack, finding that frontier models like GPT-4o still struggle with the setting, failing on 15% of cases on average. Most open-weight models further lack behind by a large margin, with failure rates reaching up to 61%. In our controlled analysis, we identify factors such as distraction and recency bias as contributors to these failure cases. Further, performance declines when task instructions are paraphrased at test time or when ICL demonstrations are repeated excessively, raising concerns about the robustness, instruction understanding, and true context utilization of long-context LMs. We release our code and data to encourage future research that investigates and addresses these limitations. 1 * Equal Contribution. 1 INK-USC/Lifelong-ICL https://inklab.usc.edu/lifelong-icl 38th Conference on Neural Information Processing Systems (NeurIPS 2024) Track on Datasets and Benchmarks.

For agents

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

get_harvested_code_for_paper("2407.16695")
get_code_for_paper("2407.16695")
have("2407.16695")

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

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

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

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

Connect an agent — have() is free.