| ab_probs_from_logprobs |
Ran ran, honoured the contract we drafted |
obedjunias19/structured-compositional-reasoning/utils/scoring.py code served (permissive licence) · get_code("e8ef74df2fd8af3f") 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 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 math
class LogprobEntry:
def __init__(self, logprob_value, decoded_token_str):
self.logprob = logprob_value
self.decoded_token = decoded_token_str
class StepLogprobs:
def __init__(self):
self.data = {
0: LogprobEntry(math.log(0.3), " A"),
1: LogprobEntry(math.log(0.5), " B"),
2: LogprobEntry(math.log(0.2), " C"),
}
def items(self):
return self.data.items()
class OutputSequence:
def __init__(self):
self.logprobs = [StepLogprobs()]
class CompletionOutput:
def __init__(self):
self.outputs = [OutputSequence()]
output = CompletionOutput()
ARGS = {
"output": output
}
- 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 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
|
| build_lcsqa_direct_prompt |
Ran ran; our contract draft was wrong, not the code |
obedjunias19/structured-compositional-reasoning/lcsqa/run_direct_prompting.py code served (permissive licence) · get_code("2d2e921a306c7df7") 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 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
# The function build_lcsqa_direct_prompt expects:
# - row: a dict with keys 'qa_type', 'question', 'A', 'B', 'C', 'D'
# - n_shot: an integer in (0, 1, 2, 3)
FEWSHOT_POOL = {'AND': ['Question: Sammy wanted to go to where the people were. Where might he go?\nA. social venues AND quiet retreats\nB. local events AND social venues\nC. sports arenas AND quiet retreats\nD. sports arenas AND train platforms\n\nAnswer: B', 'Question: The fox walked from the city into the forest, what was it looking for?\nA. suitable prey AND shelter from disturbances\nB. urban garden AND farm fields\nC. natural habitat AND farm fields\nD. suitable prey AND neighborhood pets\n\nAnswer: A', 'Question: What home entertainment equipment requires cable?\nA. wireless speaker AND portable projector\nB. television AND home theater system\nC. wireless speaker AND gaming console\nD. digital frame AND portable projector\n\nAnswer: B'], 'OR': ['Question: Sammy wanted to go to where the people were. Where might he go?\nA. quiet retreats OR empty parks\nB. local events OR empty parks\nC. sports arenas OR empty parks\nD. train platforms OR empty parks\n\nAnswer: B', 'Question: The forgotten leftovers had gotten quite old, he found it covered in mold in the back of his what?\nA. living room OR dining area\nB. utility drawer OR kitchen counter\nC. living room OR utility drawer\nD. cold storage OR utility drawer\n\nAnswer: D', 'Question: The fox walked from the city into the forest, what was it looking for?\nA. natural habitat OR urban garden\nB. farm fields OR city park\nC. suitable prey OR neighborhood pets\nD. urban garden OR farm fields\n\nAnswer: C'], 'NEITHER': ['Question: Sammy wanted to go to where the people were. Where might he go?\nA. NEITHER local events NOR train platforms\nB. NEITHER sports arenas NOR train platforms\nC. NEITHER social venues NOR sports arenas\nD. NEITHER social venues NOR quiet retreats\n\nAnswer: B', 'Question: The forgotten leftovers had gotten quite old, he found it covered in mold in the back of his what?\nA. NEITHER cold storage NOR dining area\nB. NEITHER sealed container NOR living room\nC. NEITHER food cabinet NOR utility drawer\nD. NEITHER living room NOR utility drawer\n\nAnswer: D', 'Question: The only baggage the woman checked was a drawstring bag, where was she heading with it?\nA. NEITHER family gathering NOR local gathering\nB. NEITHER airport travel NOR local gathering\nC. NEITHER local gathering NOR short trip\nD. NEITHER business engagement NOR local gathering\n\nAnswer: C'], 'Mixed': ['Question: The fox walked from the city into the forest, what was it looking for?\nA. natural habitat AND shelter from disturbances\nB. farm fields OR neighborhood pets\nC. city park AND neighborhood pets\nD. farm fields AND neighborhood pets\n\nAnswer: A', 'Question: Google Maps and other highway and street GPS services have replaced what?\nA. historical navigation logs AND tourist information centers\nB. NEITHER printed road maps NOR route planning software\nC. manual navigation techniques AND tourist information centers\nD. manual navigation techniques AND route planning software\n\nAnswer: D', 'Question: Sammy wanted to go to where the people were. Where might he go?\nA. sports arenas AND train platforms\nB. NEITHER local events NOR social venues\nC. local events AND social venues\nD. quiet retreats OR empty parks\n\nAnswer: C']}
row = {
'qa_type': 'AND',
'question': 'What is a common place to find books?',
'A': 'library AND bookstore',
'B': 'home AND office',
'C': 'school AND park',
'D': 'restaurant AND gym'
}
n_shot = 2
ARGS = {
'row': row,
'n_shot': n_shot
}
- 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 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
|
| clean_text |
Ran ran; our contract draft was wrong, not the code |
obedjunias19/structured-compositional-reasoning/lsata/run_structured_inference.py code served (permissive licence) · get_code("b26dd53b8f714434") 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 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 re
def clean_text(text: str) -> str:
text = re.sub('<[^>]+>', ' ', text)
text = re.sub('\\s*Multi Label Question:\\s*', '', text, flags=re.IGNORECASE)
text = re.sub('\\s+', ' ', text).strip()
return text
ARGS = {
'text': '<p>This is a test</p> Multi Label Question: some text with spaces'
}
- 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 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
|
| compute_metrics |
Ran ran; our contract draft was wrong, not the code |
obedjunias19/structured-compositional-reasoning/utils/metrics.py code served (permissive licence) · get_code("ea8d26f4f608c139") 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 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.
from collections import defaultdict
from typing import Any
torch_imported = False
try:
import torch
torch_imported = True
except ImportError:
pass
# Construct valid arguments for compute_metrics
results = [
{
'qa_type': 'multiple_choice',
'gold': 'A',
'preds': {
'mode1': 'A',
},
'option_scores': {
'mode1': {'A': 0.9, 'B': 0.7, 'C': 0.5, 'D': 0.3}
}
},
{
'qa_type': 'multiple_choice',
'gold': 'B',
'preds': {
'mode1': 'B',
},
'option_scores': {
'mode1': {'A': 0.4, 'B': 0.8, 'C': 0.6, 'D': 0.2}
}
},
{
'qa_type': 'true_false',
'gold': 'True',
'preds': {
'mode1': 'True',
},
'option_scores': {
'mode1': {'True': 0.95, 'False': 0.05}
}
},
{
'qa_type': 'true_false',
'gold': 'False',
'preds': {
'mode1': 'True',
},
'option_scores': {
'mode1': {'True': 0.6, 'False': 0.4}
}
},
]
ARGS = {
'results': results,
'mode': 'mode1',
}
- 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
|
| example_to_record |
Ran ran; our contract draft was wrong, not the code |
obedjunias19/structured-compositional-reasoning/lcsqa/run_structured_inference.py code served (permissive licence) · get_code("763d1a8213cfec3e") 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 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 re
from dataclasses import dataclass
from typing import Any
_OPTION_KEYS = ['A', 'B', 'C', 'D']
@dataclass(frozen=True)
class LcsqaExample:
question_id: str
question: str
choices: list[str]
label: int
qa_type: str
def _parse_choice(choice: str) -> dict:
m = re.match('^NEITHER\\s+(.+?)\\s+NOR\\s+(.+)$', choice, re.IGNORECASE)
if m:
return {'operator': 'NEITHER', 'a1': m.group(1).strip(), 'a2': m.group(2).strip()}
m = re.match('^(.+?)\\s+OR\\s+(.+)$', choice)
if m:
return {'operator': 'OR', 'a1': m.group(1).strip(), 'a2': m.group(2).strip()}
m = re.match('^(.+?)\\s+AND\\s+(.+)$', choice)
if m:
return {'operator': 'AND', 'a1': m.group(1).strip(), 'a2': m.group(2).strip()}
raise ValueError(f'cannot parse choice: {choice!r}')
def example_to_record(ex: LcsqaExample) -> dict[str, Any]:
options = {key: _parse_choice(c) for key, c in zip(_OPTION_KEYS, ex.choices)}
return {'question_id': ex.question_id, 'question': ex.question, 'options': options, 'answer': _OPTION_KEYS[ex.label], 'qa_type': ex.qa_type}
# Construct a valid LcsqaExample
example = LcsqaExample(
question_id="q001",
question="What is the capital of France?",
choices=[
"Paris AND London",
"Berlin OR Munich",
"Rome AND Venice",
"NEITHER Madrid NOR Barcelona"
],
label=0,
qa_type="geography"
)
ARGS = {
'ex': example
}
- 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
|
| extract_json_object |
Ran ran; our contract draft was wrong, not the code |
obedjunias19/structured-compositional-reasoning/utils/prompting.py code served (permissive licence) · get_code("90f6d6d8b0329d43") 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 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 re
from typing import Any
# Test cases for extract_json_object function
ARGS = {
"raw_text": '{"key": "value", "number": 42}'
}
# Additional test cases to verify the setup works correctly
test_cases = [
# Simple valid JSON object
'{"name": "test"}',
# JSON with markdown code fence
'```json\n{"status": "ok"}\n```',
# JSON object with trailing commas (should be fixed)
'{"a": 1, "b": 2,}',
# Text with embedded JSON object
'Here is some text {"embedded": true} and more text',
# Multiple JSON objects (should find the first valid one)
'prefix {"first": 1} {"second": 2} suffix',
# JSON with control characters (should be replaced)
'{"text": "hello\x00world"}',
]
# We'll use the first simple test case
ARGS = {
"raw_text": '{"key": "value", "number": 42, "nested": {"inner": true}}'
}
- 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
|
| generate_and_combinations |
Ran ran; our contract draft was wrong, not the code |
obedjunias19/structured-compositional-reasoning/lsata/run_structured_inference.py code served (permissive licence) · get_code("2960c8eb596b39e9") 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 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 itertools
def generate_and_combinations(correct, incorrect):
valid = [f'{c1} AND {c2}' for c1, c2 in itertools.combinations(correct, 2)]
invalid = [f'{c} AND {i}' for c in correct for i in incorrect] + [f'{i1} AND {i2}' for i1, i2 in itertools.combinations(incorrect, 2)]
return {'correct': valid, 'incorrect': invalid}
ARGS = {
'correct': ['statement_A', 'statement_B', 'statement_C'],
'incorrect': ['wrong_X', 'wrong_Y']
}
- 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
|
| generate_or_combinations |
Ran ran; our contract draft was wrong, not the code |
obedjunias19/structured-compositional-reasoning/lsata/run_structured_inference.py code served (permissive licence) · get_code("bd042bf24358fdd4") 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 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 itertools
def generate_or_combinations(correct, incorrect):
valid = [f'{c1} OR {c2}' for c1, c2 in itertools.combinations(correct, 2)]
valid += [f'{c} OR {i}' for c in correct for i in incorrect]
invalid = [f'{i1} OR {i2}' for i1, i2 in itertools.combinations(incorrect, 2)]
return {'correct': valid, 'incorrect': invalid}
# Setup code
correct = ['statement_A', 'statement_B', 'statement_C']
incorrect = ['wrong_1', 'wrong_2']
ARGS = {
'correct': correct,
'incorrect': incorrect
}
- 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
|
| llm_engine_kwargs |
Ran ran; our contract draft was wrong, not the code |
obedjunias19/structured-compositional-reasoning/utils/vllm_utils.py code served (permissive licence) · get_code("9703e58cf69dd71a") 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 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)
ARGS = {
'model': 'meta-llama/Llama-2-7b-hf',
'max_model_len': 2048,
'trust_remote_code': False,
}
- 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
|
| load_run_log_list |
Ran ran; our contract draft was wrong, not the code |
obedjunias19/structured-compositional-reasoning/utils/logging_utils.py code served (permissive licence) · get_code("09c2c14eb8cb649b") 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 json
from pathlib import Path
import tempfile
import os
# Create a temporary file with JSONL content
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "run_log.jsonl")
# Write sample JSONL data
with open(temp_file, 'w', encoding='utf-8') as f:
f.write(json.dumps({"step": 1, "loss": 0.5, "accuracy": 0.9}) + '\n')
f.write(json.dumps({"step": 2, "loss": 0.4, "accuracy": 0.92}) + '\n')
f.write(json.dumps({"step": 3, "loss": 0.3, "accuracy": 0.95}) + '\n')
ARGS = {
"path": 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
|
| normalize_label |
Ran ran; our contract draft was wrong, not the code |
obedjunias19/structured-compositional-reasoning/lcsqa/run_direct_prompting.py code served (permissive licence) · get_code("62cec6369fe909ac") 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 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 pandas as pd
LABELS = ['A', 'B', 'C', 'D']
def normalize_label(value):
if pd.isna(value):
return None
value = str(value).strip().upper()
return value if value in LABELS else None
# Test with various input types
ARGS = {
'value': 'a'
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- pandas — 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
|
| parse_mcq_answer |
Ran ran; our contract draft was wrong, not the code |
obedjunias19/structured-compositional-reasoning/lsata/run_direct_prompting.py code served (permissive licence) · get_code("edfda541583cea9b") 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 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 re
LABELS = ['A', 'B', 'C', 'D']
def parse_mcq_answer(text):
"""
Parse an A/B/C/D answer conservatively, prioritizing explicit final-answer
markers and only using line-level fallbacks near the end of the generation.
Returns:
(label, parse_method)
"""
if text is None or not str(text).strip():
return (None, 'empty')
text = str(text).strip()
patterns = [('final_answer', 'FINAL\\s*(?:ANSWER|CHOICE)\\s*(?:IS\\s*)?[:=\\-]?\\s*[\\(\\[\\{`*_]*([ABCD])(?=[\\)\\]\\}`*_.:,\\s]|$)'), ('boxed', '\\\\boxed\\s*\\{\\s*([ABCD])\\s*\\}'), ('explicit_answer', '(?:THE\\s+)?(?:CORRECT\\s+)?(?:ANSWER|CHOICE)\\s*(?:IS\\s*)?[:=\\-]?\\s*[\\(\\[\\{`*_]*([ABCD])(?=[\\)\\]\\}`*_.:,\\s]|$)'), ('option_phrase', '(?:SELECT|CHOOSE|OPTION)\\s*[:=\\-]?\\s*[\\(\\[\\{`*_]*([ABCD])(?=[\\)\\]\\}`*_.:,\\s]|$)')]
for method, pattern in patterns:
matches = re.findall(pattern, text, flags=re.IGNORECASE)
if matches:
return (matches[-1].upper(), method)
cleaned_whole = re.sub('[\\s\\(\\)\\[\\]\\{\\}`*_.:,\\-]+', '', text).upper()
if cleaned_whole in LABELS:
return (cleaned_whole, 'answer_only')
lines = [line.strip() for line in text.splitlines() if line.strip()]
for line in reversed(lines[-4:]):
cleaned_line = re.sub('^(?:FINAL\\s*)?(?:ANSWER|CHOICE|OPTION)?\\s*(?:IS\\s*)?[:=\\-]?\\s*', '', line, flags=re.IGNORECASE)
cleaned_line = re.sub('[\\s\\(\\)\\[\\]\\{\\}`*_.:,\\-]+', '', cleaned_line).upper()
if cleaned_line in LABELS:
return (cleaned_line, 'last_line')
return (None, 'unparsed')
# Test cases with various text inputs
ARGS = {
'text': 'The correct answer is: B'
}
- 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 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
|
| parse_verbalized_confidence |
Ran ran, honoured the contract we drafted |
obedjunias19/structured-compositional-reasoning/utils/scoring.py code served (permissive licence) · get_code("04c5b0ad60792775") 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 float, 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 re
_NUMBER_RE = re.compile('(\\d+(?:\\.\\d+)?)')
def parse_verbalized_confidence(raw_text: str) -> float:
match = _NUMBER_RE.search(raw_text)
if not match:
return 0.0
return max(0.0, min(10.0, float(match.group(1))))
ARGS = {
"raw_text": "The confidence level is 7.5 out of 10"
}
- 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 float, 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
|
| read_prompt |
Ran ran; our contract draft was wrong, not the code |
obedjunias19/structured-compositional-reasoning/utils/prompting.py code served (permissive licence) · get_code("dfd6f1e61da0bede") 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 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 tempfile
from pathlib import Path
# Create a temporary file with some test content
with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt', encoding='utf-8') as f:
f.write("This is a test prompt content.\nWith multiple lines.")
temp_path = f.name
ARGS = {
'path': temp_path
}
- 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 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
|
| render_prompt |
Ran ran; our contract draft was wrong, not the code |
obedjunias19/structured-compositional-reasoning/utils/prompting.py code served (permissive licence) · get_code("948281f768f45354") 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 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
torch.manual_seed(0)
# Analyze the function:
# - template: str - a string with placeholders like {{key}}
# - **kwargs: dict of key-value pairs to substitute into the template
# The function replaces {{key}} patterns with str(value) for each key-value pair in kwargs
ARGS = {
'template': 'Hello {{name}}, you have {{count}} messages and your score is {{score}}.',
'name': 'Alice',
'count': 42,
'score': 3.14
}
- 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 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
|
| sample_stratified |
Ran ran; our contract draft was wrong, not the code |
obedjunias19/structured-compositional-reasoning/lcsqa/run_structured_inference.py code served (permissive licence) · get_code("a0338840ffebdbf5") 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
from dataclasses import dataclass
torch.manual_seed(0)
SAMPLE_QA_TYPES = ['AND', 'OR', 'NEITHER', 'Mixed']
@dataclass(frozen=True)
class LcsqaExample:
question_id: str
question: str
choices: list[str]
label: int
qa_type: str
# Create a list of LcsqaExample instances with enough samples for each qa_type
# We need at least samples_per_operator + sample_offset examples per type
examples = []
for qa_type in SAMPLE_QA_TYPES:
for i in range(300): # 300 examples per type (more than needed for offset + samples)
example = LcsqaExample(
question_id=f"{qa_type}_q{i}",
question=f"What is the answer for {qa_type} question {i}?",
choices=[f"choice_{j}" for j in range(4)],
label=i % 4,
qa_type=qa_type
)
examples.append(example)
ARGS = {
'examples': examples,
'samples_per_operator': 250,
'sample_offset': 0,
}
- 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
|
| solve_hard_gate |
Ran ran; our contract draft was wrong, not the code |
obedjunias19/structured-compositional-reasoning/utils/ilp.py code served (permissive licence) · get_code("6d320dfada8abc5b") 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 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 numpy as np
ARGS = {
'options': {
'A': {
'operator': 'AND',
'a1': 'atomic_1',
'a2': 'atomic_2'
},
'B': {
'operator': 'OR',
'a1': 'atomic_2',
'a2': 'atomic_3'
},
'C': {
'operator': 'NEITHER',
'a1': 'atomic_1',
'a2': 'atomic_3'
}
},
'atomics': ['atomic_1', 'atomic_2', 'atomic_3'],
'constraints': ['constraint_1', 'constraint_2'],
't': {
'atomic_1': {'constraint_1': 0.8, 'constraint_2': 0.6},
'atomic_2': {'constraint_1': 0.9, 'constraint_2': 0.7},
'atomic_3': {'constraint_1': 0.5, 'constraint_2': 0.4}
},
'f': {
'atomic_1': {'constraint_1': 0.2, 'constraint_2': 0.4},
'atomic_2': {'constraint_1': 0.1, 'constraint_2': 0.3},
'atomic_3': {'constraint_1': 0.5, 'constraint_2': 0.6}
}
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, scipy — 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
|
| select_answer |
Not yet run unverified (harvested, no recorded run) |
obedjunias19/structured-compositional-reasoning/utils/ilp.py code served (permissive licence) · get_code("b7d08b342cf1515d") How it ran |
| true_prob_from_logprobs |
Not yet run unverified (harvested, no recorded run) |
obedjunias19/structured-compositional-reasoning/utils/scoring.py code served (permissive licence) · get_code("eec6c2c05053320d") How it ran |