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