SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2312.07540 · ICML · 2024

diff History for Neural Language Agents

Lerrel Pinto, Rob Fergus, Ulyana Piterbarg

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 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 0 have no contract verdict; 6 failures of our instrument; 1 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/2312.07540.json · badge: /api/ran/2312.07540.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
upiterbarg/diff_history canonical (classifier label)
classifier basis: census
6 ran · 1 no recorded run
FunctionStatusWhere it lives
encode_cot_instruction_example Ran
ran; our contract draft was wrong, not the code
upiterbarg/diff_history/instruction_encode_templates.py
code served (permissive licence) · get_code("b4edc5e72c592ef5")
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 numpy as np

torch.manual_seed(0)

ARGS = {
    'instruction': 'Solve the following math problem step by step.',
    'input': 'What is 2 + 2?',
    'cot_inputs': [
        'First, identify the numbers involved.',
        'Then, add them together.',
        'Finally, verify the result.'
    ],
    'cot_outputs': [
        'We have the numbers 2 and 2.',
        'Adding 2 + 2 gives us 4.',
        'The answer 4 is correct.'
    ],
    'output': 'The answer is 4.',
    'eos_token': '[END]'
}
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 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
encode_few_shot_example Ran
ran; our contract draft was wrong, not the code
upiterbarg/diff_history/instruction_encode_templates.py
code served (permissive licence) · get_code("96351a65183bb428")
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

torch.manual_seed(0)

instruction = "Classify the sentiment of the following text as positive or negative."

examplars = [
    {
        'input': 'I really loved this movie, it was fantastic!',
        'output': 'positive'
    },
    {
        'input': 'This product is terrible and broke immediately.',
        'output': 'negative'
    }
]

input_text = 'The weather today is absolutely beautiful and sunny.'

output_text = 'positive'

eos_token = '</s>'

ARGS = {
    'instruction': instruction,
    'examplars': examplars,
    'input': input_text,
    'output': output_text,
    'eos_token': eos_token
}
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
encode_instruction_example Ran
ran; our contract draft was wrong, not the code
upiterbarg/diff_history/instruction_encode_templates.py
code served (permissive licence) · get_code("f839fd4c6f96a26f")
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 random

ARGS = {
    'instruction': 'Write a Python function that adds two numbers',
    'input': 'a = 5, b = 3',
    'output': 'def add(a, b):\n    return a + b\n\nresult = add(5, 3)  # returns 8',
    'random_template': True,
    'eos_token': '<|endoftext|>'
}
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
encode_with_prompt_completion_format Ran
ran; our contract draft was wrong, not the code
upiterbarg/diff_history/finetune.py
pointer only (licence: MIT); the stored copy get_code serves, from clinicalml/co-llm, is pointer only (licence: NONE) · get_code("661419d69a095bfe")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from clinicalml/co-llm, and GitHub detected no licence in that repository 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.

form_prompt Ran
ran; our contract draft was wrong, not the code
upiterbarg/diff_history/nethack_experiments/format_interaction_histories.py
code served (permissive licence) · get_code("8657cb96e22ef006")
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 numpy as np

torch.manual_seed(0)

# Analyzing the function:
# - form_prompt takes 'data' and 'obs_preqs'
# - It iterates over keys: 'txt_blstats', 'txt_glyphs', 'txt_message', 'txt_inventory', 'txt_cursor'
# - For each key, it accesses data[key] and obs_preqs[key]
# - It formats them as '%s[\n%s\n]' % (obs_preqs[key], data[key])
# - This means both obs_preqs[key] and data[key] need to be string-convertible (or strings)

data = {
    'txt_blstats': 'blstats_content_here',
    'txt_glyphs': 'glyphs_content_here',
    'txt_message': 'message_content_here',
    'txt_inventory': 'inventory_content_here',
    'txt_cursor': 'cursor_content_here'
}

obs_preqs = {
    'txt_blstats': 'BLSTATS',
    'txt_glyphs': 'GLYPHS',
    'txt_message': 'MESSAGE',
    'txt_inventory': 'INVENTORY',
    'txt_cursor': 'CURSOR'
}

ARGS = {
    'data': data,
    'obs_preqs': obs_preqs
}
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 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
get_samples Ran
ran; our contract draft was wrong, not the code
upiterbarg/diff_history/nethack_experiments/format_interaction_histories.py
code served (permissive licence) · get_code("ac742238e5f3474d")
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 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 numpy as np
import os
import tempfile

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

# Create some mock episode files with naming convention: {name}_{ep_len}.npy
# The function expects filenames like "something_10.npy" where 10 is episode length
ep_data = [
    ("episode_10.npy", 10),
    ("episode_15.npy", 15),
    ("episode_20.npy", 20),
]

for fn, ep_len in ep_data:
    filepath = os.path.join(temp_dir, fn)
    # Create dummy files (they won't actually be read by this function)
    with open(filepath, 'w') as f:
        f.write("")

# Now set up the ARGS
ARGS = {
    "source_dir": temp_dir,
    "seq": 5,
    "nsamples": 3,
}
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 list, ndim 2, 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
encode_with_prompt_completion_format_observation_mask Not yet run
unverified (harvested, no recorded run)
upiterbarg/diff_history/finetune.py
code served (permissive licence) · get_code("93e1284e1779fc7d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 3 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 3 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
encode_with_prompt_completion_format 9 other papers
1 dated earlier, 8 later
2311.05657 (2023-11)
Agent Lumos: Unified and Modular Training for Open-Source Language Agents
2401.08565 (2024-01)
Tuning Language Models by Proxy
2401.10768 (2024-01)
Knowledge Verification to Nip Hallucination in the Bud
and 6 more not named here
encode_few_shot_example 3 other papers
3 later
2405.05008 (2024-05)
ADELIE: Aligning Large Language Models on Information Extraction
2405.14394 (2024-05)
Instruction Tuning With Loss Over Instructions
2410.16208 (2024-10)
Compute-Constrained Data Selection
encode_instruction_example 3 other papers
3 later
2405.05008 (2024-05)
ADELIE: Aligning Large Language Models on Information Extraction
2405.14394 (2024-05)
Instruction Tuning With Loss Over Instructions
2410.16208 (2024-10)
Compute-Constrained Data Selection

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

Neural Language Models (LMs) offer an exciting solution for general-purpose embodied control. However, a key technical issue arises when using an LM-based controller: environment observations must be converted to text, which coupled with history, results in long and verbose textual prompts. As a result, prior work in LM agents is limited to restricted domains with small observation size as well as minimal needs for interaction history or instruction finetuning. In this paper, we introduce diff history, a simple and highly effective solution to these issues. By applying the Unix diff command on consecutive text observations in the interaction histories used to prompt LM policies, we can both abstract away redundant information and focus the content of textual inputs on the salient changes in the environment. On NetHack, an unsolved video game that requires long-horizon reasoning for decision-making, LMs tuned with diff history match state-of-the-art performance for neural agents while needing 1800× fewer training examples compared to prior work. Even on the simpler BabyAI-Text environment with concise text observations, we find that although diff history increases the length of prompts, the representation it provides offers a 25% improvement in the efficiency of low-sample instruction finetuning. Further, we show that diff history scales favorably across different finetuning dataset sizes. We open-source our code and data to https://diffhistory.github.io.

For agents

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

get_harvested_code_for_paper("2312.07540")
get_code_for_paper("2312.07540")
have("2312.07540")

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

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

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

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

Connect an agent — have() is free.