SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2503.22832 · 2025

L0-Reasoning Bench: Evaluating Procedural Correctness in Language Models via Simple Program Execution

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 (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 0 failures of our instrument; 0 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/2503.22832.json · badge: /api/ran/2503.22832.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
SimengSun/L0-reasoning-bench canonical (classifier label)
classifier basis not recorded on the link
6 ran · 0 no recorded run
FunctionStatusWhere it lives
disassemble_bytecode Ran
ran on a synthesized input
SimengSun/L0-reasoning-bench/src/generators/tracer.py
code served (permissive licence) · get_code("a792b767fa29dc73")
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 LineCategories. 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 dis
from collections import defaultdict
from typing import NamedTuple

class LineCategories(NamedTuple):
    loaded_variables: dict
    stored_variables: dict
    is_pop_or_append: dict

def disassemble_bytecode(func):
    is_pop_or_append = defaultdict(lambda: False)
    loaded_variables = defaultdict(list)
    stored_variables = defaultdict(list)
    starts_line = 0
    for b in list(dis.Bytecode(func)):
        if b.starts_line is not None:
            starts_line = b.starts_line
        if 'LOAD_FAST' in b.opname:
            loaded_variables[starts_line].append(b.argval)
        if 'STORE_FAST' in b.opname:
            stored_variables[starts_line].append(b.argval)
        try:
            if 'LOAD_ATTR' in b.opname and b.argval in ('pop', 'append'):
                is_pop_or_append[starts_line] = True
        except:
            try:
                if 'LOAD_METHOD' in b.opname and b.argval in ('pop', 'append'):
                    is_pop_or_append[starts_line] = True
            except:
                raise Exception(f'Error analyzing bytecode for line {starts_line}: {b}')
    return LineCategories(loaded_variables=loaded_variables, stored_variables=stored_variables, is_pop_or_append=is_pop_or_append)


def example_function():
    x = 5
    y = [1, 2, 3]
    y.append(4)
    z = y.pop()
    return x + z


ARGS = {
    'func': example_function
}
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 LineCategories — a LineCategories output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LineCategories output the recorded ndim 1 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
extract_function_args Ran
ran on a synthesized input
SimengSun/L0-reasoning-bench/src/generators/generator.py
code served (permissive licence) · get_code("e8bc1626885dad26")
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)

# Analyze the function: extract_function_args takes a single parameter 'program'
# which should be a string containing a Python function definition.
# The function splits by newlines, checks the first line starts with 'def function(',
# extracts the arguments from the function signature, and returns them as a list.

# Valid test case: a program string with a proper function definition
program_valid = """def function(x, y, z):
    return x + y + z"""

# Another valid test case with no arguments
program_no_args = """def function():
    pass"""

# Another valid test case with single argument
program_single_arg = """def function(data):
    return data * 2"""

# Test case with complex arguments (spaces, defaults are ok in the string)
program_complex = """def function(input_tensor, model, batch_size):
    return input_tensor.shape"""

ARGS = {
    "program": program_valid
}
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
filter_trace Ran
ran on a synthesized input
SimengSun/L0-reasoning-bench/src/generators/tracer.py
code served (permissive licence) · get_code("71ddff6c85c17c24")
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 dis
from collections import defaultdict
from typing import NamedTuple

class TraceLine(NamedTuple):
    line_number: int
    step_counter: int
    variable_state: dict
    event: str = ''

class LineCategories(NamedTuple):
    loaded_variables: dict
    stored_variables: dict
    is_pop_or_append: dict

def disassemble_bytecode(func):
    is_pop_or_append = defaultdict(lambda: False)
    loaded_variables = defaultdict(list)
    stored_variables = defaultdict(list)
    starts_line = 0
    for b in list(dis.Bytecode(func)):
        if b.starts_line is not None:
            starts_line = b.starts_line
        if 'LOAD_FAST' in b.opname:
            loaded_variables[starts_line].append(b.argval)
        if 'STORE_FAST' in b.opname:
            stored_variables[starts_line].append(b.argval)
        try:
            if 'LOAD_ATTR' in b.opname and b.argval in ('pop', 'append'):
                is_pop_or_append[starts_line] = True
        except:
            try:
                if 'LOAD_METHOD' in b.opname and b.argval in ('pop', 'append'):
                    is_pop_or_append[starts_line] = True
            except:
                raise Exception(f'Error analyzing bytecode for line {starts_line}: {b}')
    return LineCategories(loaded_variables=loaded_variables, stored_variables=stored_variables, is_pop_or_append=is_pop_or_append)

def filter_trace(trace_lines, func):
    trace_line_categories = disassemble_bytecode(func)
    ret = [trace_lines[0]]
    for t in trace_lines[1:]:
        line_number = t.line_number
        print_loaded_lists = trace_line_categories.is_pop_or_append[line_number]
        print_all = t.event == 'return'
        ret.append(TraceLine(line_number=t.line_number, step_counter=t.step_counter, variable_state={k: v for k, v in t.variable_state.items() if k in trace_line_categories.stored_variables[t.line_number] or (print_loaded_lists and k in trace_line_categories.loaded_variables[t.line_number]) or print_all}, event=t.event))
    return ret


# Create a simple test function that can be analyzed
def sample_function(x, y):
    result = []
    result.append(x)
    result.pop()
    z = x + y
    return z


# Create trace lines with variable states
trace_lines = [
    TraceLine(line_number=2, step_counter=0, variable_state={'x': 1, 'y': 2}, event='call'),
    TraceLine(line_number=3, step_counter=1, variable_state={'x': 1, 'y': 2, 'result': []}, event=''),
    TraceLine(line_number=4, step_counter=2, variable_state={'x': 1, 'y': 2, 'result': [1]}, event=''),
    TraceLine(line_number=5, step_counter=3, variable_state={'x': 1, 'y': 2, 'result': []}, event=''),
    TraceLine(line_number=6, step_counter=4, variable_state={'x': 1, 'y': 2, 'result': [], 'z': 3}, event=''),
    TraceLine(line_number=7, step_counter=5, variable_state={'x': 1, 'y': 2, 'result': [], 'z': 3}, event='return'),
]

ARGS = {
    'trace_lines': trace_lines,
    'func': sample_function,
}
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 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
generate_trace Ran
ran on a synthesized input
SimengSun/L0-reasoning-bench/src/generators/tracer.py
code served (permissive licence) · get_code("fcdb1a6da02ce36b")
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 sys
import copy
from typing import NamedTuple

class TraceLine(NamedTuple):
    line_number: int
    step_counter: int
    variable_state: dict
    event: str = ''

class MaxStepsException(Exception):
    pass

class ProgramTracer:
    """trace a single call to a function with name function name"""

    def __init__(self, function_name, max_steps):
        self.function_name = function_name
        self.max_steps = max_steps
        self.run_trace = []
        self.last_line_executed = None
        self.step_counter = 0
        self._in_function = False

    def named_function_tracer(self):

        def _trace_named_func(frame, event, arg):
            nonlocal self
            if event == 'exception':
                return None
            if event == 'call':
                assert frame.f_code.co_name == self.function_name
                self.step_counter = 0
                self._in_function = True
                local_vars = copy.deepcopy(frame.f_locals)
                self.new_trace_line(self.step_counter, frame.f_lineno, local_vars, event=event)
                self.step_counter += 1
                return _trace_named_func
            elif event in ('return', 'line') and self._in_function:
                local_vars = copy.deepcopy(frame.f_locals)
                self.new_trace_line(self.step_counter, frame.f_lineno, local_vars, event=event)
                self.step_counter += 1
                if self.step_counter > self.max_steps:
                    raise MaxStepsException(self.step_counter)
                return _trace_named_func
        return _trace_named_func

    def new_trace_line(self, step_counter, line_number, local_vars, event):
        self.run_trace.append(TraceLine(step_counter=step_counter, line_number=line_number, variable_state=local_vars, event=event))

def generate_trace(func, input_values, max_steps=200):
    pt = ProgramTracer(func.__name__, max_steps=max_steps)
    old_trace = sys.gettrace()
    sys.settrace(pt.named_function_tracer())
    try:
        func(**input_values)
    except MaxStepsException as e:
        pass
    except Exception as e:
        return None
    finally:
        sys.settrace(old_trace)
    return pt.run_trace


def simple_function(x, y):
    """A simple function to trace"""
    z = x + y
    return z


ARGS = {
    'func': simple_function,
    'input_values': {'x': 5, 'y': 10},
    'max_steps': 200
}
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 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
is_arg_used Ran
ran on a synthesized input
SimengSun/L0-reasoning-bench/src/generators/generator.py
code served (permissive licence) · get_code("ab69c6df9a3fcc99")
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

torch.manual_seed(0)

# The function is_arg_used checks if an argument name appears in program code string
# It takes:
# - arg: a string representing an argument name
# - program_code: a string containing Python code

# Test cases that cover the logic:
# 1. arg with 'lst' in the name - checks if arg appears anywhere
# 2. regular arg - checks if arg appears with space before, or parenthesis, or bracket before

# Valid program code examples
program_code_example_1 = """
def my_function(batch_lst, x, y):
    result = batch_lst[0]
    return (x) + [y]
"""

program_code_example_2 = """
def process(data):
    items = []
    value = data
    return (value) + [value]
"""

# Test arguments
arg_with_lst = "batch_lst"
arg_regular_1 = "x"
arg_regular_2 = "y"
arg_regular_3 = "data"
arg_regular_4 = "value"

ARGS = {
    "arg": "x",
    "program_code": program_code_example_1
}
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
load_yaml_config Ran
ran on a synthesized input
SimengSun/L0-reasoning-bench/src/evaluators/launcher.py
code served (permissive licence) · get_code("2f07660b55ff5be0")
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 SimpleNamespace. 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 types import SimpleNamespace

# The function load_yaml_config takes config_data and recursively converts
# dicts to SimpleNamespace objects, preserving non-dict values.
# We need to create a nested dict structure to test this functionality.

config_data = {
    "model": {
        "name": "test_model",
        "layers": 3,
        "hidden_dim": 128
    },
    "training": {
        "batch_size": 32,
        "learning_rate": 0.001,
        "epochs": 10
    },
    "data": {
        "train_path": "/path/to/train",
        "val_path": "/path/to/val",
        "preprocessing": {
            "normalize": True,
            "scale": 0.5
        }
    },
    "seed": 42,
    "debug": False
}

ARGS = {
    "config_data": config_data
}
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 SimpleNamespace — a SimpleNamespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SimpleNamespace 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

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-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

Complex reasoning tasks often rely on the ability to consistently and accurately apply simple rules across incremental steps, a foundational capability which we term "level-0" reasoning. To systematically evaluate this capability, we introduce L0-Bench, a language model benchmark for testing procedural correctness -- the ability to generate correct reasoning processes, complementing existing benchmarks that primarily focus on outcome correctness. Given synthetic Python functions with simple operations, L0-Bench grades models on their ability to generate step-by-step, error-free execution traces. The synthetic nature of L0-Bench enables systematic and scalable generation of test programs along various axes (e.g., number of trace steps). We evaluate a diverse array of recent closed-source and open-weight models on a baseline test set. All models exhibit degradation as the number of target trace steps increases, while larger models and reasoning-enhanced models better maintain correctness over multiple steps. Additionally, we use L0-Bench to explore test-time scaling along three dimensions: input context length, number of solutions for majority voting, and inference steps. Our results suggest substantial room to improve "level-0" reasoning and potential directions to build more reliable reasoning systems.

For agents

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

get_harvested_code_for_paper("2503.22832")
get_code_for_paper("2503.22832")
have("2503.22832")

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

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

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

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

Connect an agent — have() is free.