| apply_spurious_features_at_level |
Ran ran; our contract draft was wrong, not the code |
cmoyacal/tie-training/src/llm/hotel_generator_lib.py code served (permissive licence) · get_code("8cbaf39dec40bdfe") 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 Hotel. 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.
class Hotel:
def __init__(self):
self.street_number = 0
self.floor_number = 0
self.building_age = 0
self.renovation_year = 0
self.hotel_chain_tier = ''
self.lobby_size_sqft = 0
self.employee_count = 0
hotel_instance = Hotel()
ARGS = {
'hotel': hotel_instance,
'utility_level': 0.75,
'correlation_mode': 'normal'
}
- 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 Hotel — a Hotel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Hotel 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
|
| assign_tie_label |
Ran ran; our contract draft was wrong, not the code |
cmoyacal/tie-training/src/llm/hotel_data_pipeline.py code served (permissive licence) · get_code("67cd10e7a19784ff") 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 random
import math
# Set seed for reproducibility
random.seed(0)
# The function assign_tie_label takes:
# - util_a: float
# - util_b: float
# - label_mode: str
# - beta: float (default=1.0)
# and returns a PreferenceLabel (which is a string 'A' or 'B' based on the implementation)
ARGS = {
'util_a': 0.75,
'util_b': 0.72,
'label_mode': 'bt',
'beta': 1.0
}
- 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
|
| construct_tie_pair |
Ran ran; our contract draft was wrong, not the code |
cmoyacal/tie-training/src/llm/hotel_data_pipeline.py code served (permissive licence) · get_code("60586d4f1aaa5bf3") 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 copy
import random
# Set seed for reproducibility
random.seed(0)
class MockHotel:
"""Minimal hotel object with required attributes"""
def __init__(self):
self.features = {"price": 100, "rating": 4.5, "location": "downtown"}
self.spurious_feature = 0.5
class MockHotelDatasetGenerator:
"""Stand-in for HotelDatasetGenerator with required methods"""
def __init__(self, spurious_correlation_strength=0.0):
self.spurious_correlation_strength = spurious_correlation_strength
def modify_hotel_slightly(self, hotel):
"""Modify hotel slightly by adjusting a feature"""
modified = copy.deepcopy(hotel)
modified.features["price"] *= 0.95
return modified
def calculate_true_utility(self, hotel, context):
"""Calculate utility for a hotel given context"""
return 0.8 + random.random() * 0.1
class MockOrigModule:
"""Stand-in for the 'orig' module/object containing required methods"""
def HotelDatasetGenerator(self, spurious_correlation_strength=0.0):
return MockHotelDatasetGenerator(spurious_correlation_strength)
def decorrelate_spurious_features_in_pair(self, hotel_a, hotel_b, correlation_mode, strategy, util_a, util_b):
"""Decorrelate spurious features and return tracking dict"""
tracking = {
"correlation_mode": correlation_mode,
"strategy": strategy,
"util_a": util_a,
"util_b": util_b,
"decorrelated": True
}
return hotel_a, hotel_b, tracking
# Create mock objects
winner_hotel = MockHotel()
orig = MockOrigModule()
ARGS = {
"winner_hotel": winner_hotel,
"construction": "near-tie",
"spurious_strategy": "decorrelated_mixture",
"correlation_mode": "positive",
"orig": orig,
"spurious_strength": 0.7
}
- 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
|
| decorrelate_spurious_features_in_pair |
Ran ran on a synthesized input |
cmoyacal/tie-training/src/llm/hotel_generator_lib.py code served (permissive licence) · get_code("86659570ce4fb2fd") 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 random
class Hotel:
"""Minimal Hotel class with attributes used by the functions."""
def __init__(self):
self.street_number = 500
self.floor_number = 5
self.building_age = 25
self.renovation_year = 2010
self.hotel_chain_tier = 'Standard'
self.lobby_size_sqft = 2000
self.employee_count = 50
random.seed(0)
hotel_a = Hotel()
hotel_b = Hotel()
ARGS = {
'hotel_a': hotel_a,
'hotel_b': hotel_b,
'correlation_mode': 'normal',
'strategy': 'decorrelated_spurious',
'util_a': 0.5,
'util_b': 0.3,
}
- 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
|
| detect_format |
Ran ran; our contract draft was wrong, not the code |
cmoyacal/tie-training/src/llm/concat_for_training.py code served (permissive licence) · get_code("24fcde069cc5c118") 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
import numpy as np
# Test case 1: DPO format row
dpo_row = {
'prompt': 'What is 2+2?',
'chosen': 'The answer is 4.',
'rejected': 'The answer is 5.'
}
# Test case 2: Pool format row
pool_row = {
'prompt': 'Summarize this text.',
'response_a': 'A brief summary.',
'response_b': 'Another summary.'
}
# The function takes a single parameter: row (a Dict)
# We'll test with the DPO format as the main test case
ARGS = {
'row': dpo_row
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| format_dpo_example |
Ran ran; our contract draft was wrong, not the code |
cmoyacal/tie-training/src/llm/hotel_generator_lib.py code served (permissive licence) · get_code("a88f47f9da244e5f") 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 random
from enum import Enum
class PreferenceLabel(Enum):
A_BETTER = 'A'
B_BETTER = 'B'
ARGS = {
'context_prompt': 'You are helping a user choose between two options.',
'option_a_text': 'This is option A: a clear and concise solution.',
'option_b_text': 'This is option B: a detailed and comprehensive solution.',
'util_a': 0.75,
'util_b': 0.65,
'label': PreferenceLabel.A_BETTER
}
- 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_strict_with_tracking |
Ran ran; our contract draft was wrong, not the code |
cmoyacal/tie-training/src/llm/hotel_data_pipeline.py code served (permissive licence) · get_code("1f9707eb1519f09f") 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. 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 dataclasses import dataclass
from enum import Enum
from typing import Dict, List, Optional, Tuple
class PreferenceLabel(Enum):
A_BETTER = "a_better"
B_BETTER = "b_better"
@dataclass
class Hotel:
name: str
price: float
star_rating: float
distance_to_center: float
__dataclass_fields__ = {
'name': None,
'price': None,
'star_rating': None,
'distance_to_center': None,
}
def to_description(self) -> str:
return f"{self.name}: ${self.price}, {self.star_rating} stars, {self.distance_to_center}km from center"
class HotelDatasetGenerator:
def __init__(self, spurious_correlation_strength: float = 0.5):
self.spurious_correlation_strength = spurious_correlation_strength
self.counter = 0
def generate_hotel_pair(self, context: Dict, correlation_mode: str) -> Tuple[Hotel, Hotel, PreferenceLabel, Dict]:
self.counter += 1
hotel_a = Hotel(
name=f"Hotel A {self.counter}",
price=100.0 + self.counter,
star_rating=4.0,
distance_to_center=1.5
)
hotel_b = Hotel(
name=f"Hotel B {self.counter}",
price=80.0 + self.counter,
star_rating=3.5,
distance_to_center=2.0
)
label = PreferenceLabel.A_BETTER if self.counter % 2 == 0 else PreferenceLabel.B_BETTER
pair_tracking = {
'correlation_mode': correlation_mode,
'pair_index': self.counter,
'generated': True
}
return hotel_a, hotel_b, label, pair_tracking
def calculate_true_utility(self, hotel: Hotel, context: Dict) -> float:
utility = hotel.star_rating * 10 - (hotel.price / 10) - hotel.distance_to_center
return utility
def format_dpo_example(self, context_prompt: str, option_a_text: str, option_b_text: str, util_a: float, util_b: float, label: PreferenceLabel) -> Optional[Dict]:
return {
'prompt': context_prompt,
'chosen': option_a_text if label == PreferenceLabel.A_BETTER else option_b_text,
'rejected': option_b_text if label == PreferenceLabel.A_BETTER else option_a_text,
'metadata': {
'util_a': util_a,
'util_b': util_b,
'label': label.value
}
}
class OrigModule:
PreferenceLabel = PreferenceLabel
HotelDatasetGenerator = HotelDatasetGenerator
@staticmethod
def format_dpo_example(context_prompt: str, option_a_text: str, option_b_text: str, util_a: float, util_b: float, label: PreferenceLabel) -> Optional[Dict]:
return {
'prompt': context_prompt,
'chosen': option_a_text if label == PreferenceLabel.A_BETTER else option_b_text,
'rejected': option_b_text if label == PreferenceLabel.A_BETTER else option_a_text,
'metadata': {
'util_a': util_a,
'util_b': util_b,
'label': label.value
}
}
ARGS = {
'n': 4,
'correlation_strength': 0.7,
'correlation_mode': 'price_spurious',
'force_balance': True,
'orig': OrigModule()
}
- 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 — a tuple output has no array shape of its own; none is 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_jsonl |
Ran ran; our contract draft was wrong, not the code |
cmoyacal/tie-training/src/llm/concat_for_training.py code served (permissive licence) · get_code("4ea2119c8445dd18") 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
import tempfile
import os
# Create a temporary JSONL file with test data
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test.jsonl")
# Write valid JSONL data
with open(temp_file, 'w') as f:
f.write(json.dumps({"key1": "value1", "key2": 42}) + "\n")
f.write(json.dumps({"key1": "value2", "key2": 43}) + "\n")
f.write(json.dumps({"key1": "value3", "key2": 44}) + "\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_tie |
Ran ran; our contract draft was wrong, not the code |
cmoyacal/tie-training/src/llm/concat_for_training.py code served (permissive licence) · get_code("6249b1c3fbd6ba94") 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
import numpy as np
from typing import Dict, List
torch.manual_seed(0)
# Test case 1: DPO format
dpo_row = {
'prompt': 'What is the capital of France?',
'chosen': 'Paris is the capital of France.',
'rejected': 'London is the capital of France.',
'extra_field_1': 'some_value',
'extra_field_2': 42
}
# Test case 2: Pool format
pool_row = {
'prompt': 'Explain machine learning',
'response_a': 'ML is a subset of AI that learns from data.',
'response_b': 'Machine learning is when computers learn patterns.',
'model_name': 'gpt-3',
'timestamp': 1234567890
}
# We'll test with the DPO format row and keep_extra=True
ARGS = {
'row': dpo_row,
'keep_extra': True
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|