SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2510.22849 · NeurIPS · 2025

Once Upon an Input: Reasoning via Per-Instance Program Synthesis

Eric Wong, Neelay Velingker, Mayur Naik, Adam Stein

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (4 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 3 failures of our instrument; 1 no recorded run), measured 2026-11-23; 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/2510.22849.json · badge: /api/ran/2510.22849.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
adaminsky/pips community
Papers with Code archive
7 ran · 1 no recorded run
FunctionStatusWhere it lives
LLMModel Ran
ran on a synthesized input · constructed an object; no result was computed
adaminsky/pips/src/pips/core.py
code served (permissive licence) · get_code("282a3f570d2ec2e1")
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, LLMModel: 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 re
import json
from typing import Any, Dict, List, Tuple, Optional, Callable

class SamplingParams:
    def __init__(self, temperature=0.0, max_tokens=4096, top_p=0.9, n=1, stop=None):
        self.temperature = temperature
        self.max_tokens = max_tokens
        self.top_p = top_p
        self.n = n
        self.stop = stop

class MockLLMClient:
    """Mock client for testing."""
    def __init__(self):
        pass
    
    def create_chat_completion(self, messages, temperature, max_tokens, top_p, n, stop):
        """Mock implementation."""
        return {
            "choices": [
                {
                    "message": {
                        "content": "This is a mock response from the LLM model."
                    }
                }
            ]
        }

class Output:
    def __init__(self, text):
        self.text = text

class Outputs:
    def __init__(self, text):
        self.outputs = [Output(text)]

class TestLLMModel:
    """Test implementation of LLMModel for setup purposes."""
    
    def __init__(self, model_name: str):
        self.model_name = model_name
        self._client = None
        self._initialized = False
    
    def _ensure_initialized(self):
        if not self._initialized:
            self._initialize_client()
            self._initialized = True
    
    def _initialize_client(self):
        self._client = MockLLMClient()
    
    def _chat_impl(self, prompt: List[Dict], sampling_params: SamplingParams, use_tqdm=False):
        response = self._client.create_chat_completion(
            messages=prompt,
            temperature=sampling_params.temperature,
            max_tokens=sampling_params.max_tokens,
            top_p=sampling_params.top_p,
            n=sampling_params.n,
            stop=sampling_params.stop
        )
        text = response["choices"][0]["message"]["content"]
        return [Outputs(text)]
    
    def chat(self, prompt: List[Dict], sampling_params: SamplingParams, use_tqdm=False):
        self._ensure_initialized()
        return self._chat_impl(prompt, sampling_params, use_tqdm)
    
    def stream_chat(self, prompt: List[Dict], sampling_params: SamplingParams, emit_callback=None, interrupted_callback=None):
        result = self.chat(prompt, sampling_params, use_tqdm=False)
        full_response = result[0].outputs[0].text
        if emit_callback and full_response:
            words = re.findall(r'\S+|\s+', full_response)
            for word in words:
                if interrupted_callback and interrupted_callback():
                    break
                if emit_callback:
                    emit_callback(word)
        return result

ARGS = {
    "model_name": "test-model-v1",
}
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 LLMModel — 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 LLMModel 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
OpenAIModel Ran
ran on a synthesized input · constructed an object; no result was computed
adaminsky/pips/src/pips/core.py
code served (permissive licence) · get_code("50d9e1b62e745597")
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, OpenAIModel: 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
from typing import Optional

# Mock the OpenAI API key in environment
os.environ['OPENAI_API_KEY'] = 'sk-test-key-12345'

ARGS = {
    'model_name': 'gpt-4',
    'api_key': 'sk-test-key-12345'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
openai — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type OpenAIModel — 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 OpenAIModel 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
RawInput Ran
ran on a synthesized input · constructed an object; no result was computed
adaminsky/pips/src/pips/core.py
code served (permissive licence) · get_code("f2c47b3ebe7a993b")
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, RawInput: 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 numpy as np
from PIL import Image
from dataclasses import dataclass
from typing import Optional

torch.manual_seed(0)

# Create a small test image (4x3 RGB)
test_image = Image.new('RGB', (4, 3), color='red')

# Create a test text input
test_text = "This is a test input"

ARGS = {
    "image_input": test_image,
    "text_input": test_text,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type RawInput — 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 RawInput 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
SamplingParams Ran
ran on a synthesized input · constructed an object; no result was computed
adaminsky/pips/src/pips/core.py
code served (permissive licence) · get_code("b532f5885353756d")
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, SamplingParams: 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 numpy as np

torch.manual_seed(0)

# SamplingParams constructor parameters
ARGS = {
    "temperature": 0.7,
    "max_tokens": 2048,
    "top_p": 0.95,
    "n": 3,
    "stop": ["<end>", "<stop>"]
}
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 SamplingParams — 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 SamplingParams 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
img2base64 Ran
ran; our contract draft was wrong, not the code
adaminsky/pips/src/pips/core.py
code served (permissive licence) · get_code("1f829c4cbf667fdc")
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.

from PIL import Image
import torch

# Create a small PIL Image for testing
# The function expects a PIL Image with mode and conversion capability
test_image = Image.new('RGBA', (50, 60), color=(255, 0, 0, 255))

ARGS = {
    'img': test_image
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, 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
python_eval Ran
ran; our contract draft was wrong, not the code
adaminsky/pips/src/pips/core.py
code served (permissive licence) · get_code("02d2f1dfe6746ca8")
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, 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)

# Simple Python code to execute
simple_code = """
x = 5
y = 10
answer = x + y
"""

# Code with context - sets up variables that code depends on
code_context = """
import math
PI = 3.14159
"""

# Code that uses the context
code_with_context = """
radius = 2
answer = PI * radius * radius
"""

# Code that produces output
code_with_output = """
print('Hello, World!')
answer = 42
"""

# Code that raises an error
error_code = """
answer = 1 / 0
"""

ARGS = {
    "code": simple_code,
    "code_context": None,
    "max_execution_time": 5
}
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 tuple, ndim 1, dtype family float — a tuple 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
run_with_timeout Ran
ran; our contract draft was wrong, not the code
adaminsky/pips/src/pips/core.py
code served (permissive licence) · get_code("b3efff0266ee76d0")
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, 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 multiprocessing
import torch
import torch.nn as nn

torch.manual_seed(0)

# Simple code to execute
code = """
answer = 42
print("Hello from executed code")
"""

# Optional code context
code_context = """
import math
x = 10
"""

# Timeout value in seconds
timeout = 5

ARGS = {
    'code': code,
    'timeout': timeout,
    'code_context': code_context
}
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, ndim 1, dtype family float — a tuple 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
PIPSSolver Not yet run
unverified (harvested, no recorded run)
adaminsky/pips/src/pips/core.py
code served (permissive licence) · get_code("a2e87ede6b1a1878")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 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 8 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) excel at zero-shot inference but continue to struggle with complex, multi-step reasoning. Recent methods that augment LLMs with intermediate reasoning steps such as Chain of Thought (CoT) and Program of Thought (PoT) improve performance but often produce undesirable solutions, especially in algorithmic domains. We introduce Per-Instance Program Synthesis (PIPS), a method that generates and refines programs at the instance-level using structural feedback without relying on task-specific guidance or explicit test cases. To further improve performance, PIPS incorporates a confidence metric that dynamically chooses between direct inference and program synthesis on a per-instance basis. Experiments across three frontier LLMs and 30 benchmarks including all tasks of Big Bench Extra Hard (BBEH), visual question answering tasks, relational reasoning tasks, and mathematical reasoning tasks show that PIPS improves the absolute harmonic mean accuracy by up to 8.6% and 9.4% compared to PoT and CoT respectively, and reduces undesirable program generations by 65.1% on the algorithmic tasks compared to PoT with Gemini-2.0-Flash. 2 * These authors contributed equally to this work. 2 Code for experiments and a demo is open-sourced at https://github.com/adaminsky/pips.

For agents

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

get_harvested_code_for_paper("2510.22849")
get_code_for_paper("2510.22849")
have("2510.22849")

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

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

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

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

Connect an agent — have() is free.