| build_prompt |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/data_construction/4_build_sft/build_sft_dataset.py code served (permissive licence) · get_code("74944fb1c9af1d08") 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
ARGS = {
"question": "What is the sum of the first 10 positive integers?",
"ground_truth": "55",
"answer_a": "55",
"reasoning_a": "Using the formula for arithmetic series: sum = n(n+1)/2 = 10(11)/2 = 55. We add 1+2+3+...+10 which equals 55.",
"answer_b": "50",
"reasoning_b": "I counted all numbers from 1 to 10 and got approximately 50 by estimation.",
}
- 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
|
| detect_model_type |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/eval/abstention/eval_abstention.py code served (permissive licence) · get_code("b9d58aa1639207a0") 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
def detect_model_type(model_name: str) -> str:
"""Detect the model type.
Returns:
'it-thinking': instruct + thinking model (e.g. qwen3-8b-it-thinking) ,
uses system+user chat template; vLLM enables thinking by default.
'it': instruct model (e.g. qwen3-4b-instruct / it) ,
uses system+user chat template, no thinking.
'base': base model, uses plain User-Assistant text format.
"""
model_name_lower = model_name.lower()
if 'it-thinking' in model_name_lower:
return 'it-thinking'
instruct_keywords = ['instruct', '-it', '_it']
for keyword in instruct_keywords:
if keyword in model_name_lower:
return 'it'
if 'instruct' in model_name_lower or 'chat' in model_name_lower:
return 'it'
return 'base'
ARGS = {
'model_name': 'qwen3-8b-it-thinking'
}
- 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
|
| extract_answer_math |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/data_construction/1_rollout/rollout.py code served (permissive licence) · get_code("0f9fe639bed6c737") 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 extract_answer_math(s):
"""extractanswer"""
extracted_text = ''
def extract_boxed_content(text):
pattern = '\\\\boxed\\{'
matches = []
for match in re.finditer(pattern, text):
start_pos = match.end() - 1
brace_count = 0
content_start = start_pos + 1
for i in range(start_pos, len(text)):
if text[i] == '{':
brace_count += 1
elif text[i] == '}':
brace_count -= 1
if brace_count == 0:
matches.append(text[content_start:i])
break
return matches
all_matches = []
boxed_matches = extract_boxed_content(s)
all_matches.extend(boxed_matches)
answer_pattern = '<answer>(.*?)</answer>'
answer_matches = re.findall(answer_pattern, s, re.DOTALL | re.IGNORECASE)
all_matches.extend(answer_matches)
choice_pattern = '[Tt]he correct answer is:?\\s*([A-Ja-j])'
choice_matches = re.findall(choice_pattern, s, re.IGNORECASE)
all_matches.extend(choice_matches)
if all_matches:
extracted_text = all_matches[-1]
return extracted_text.strip()
ARGS = {
's': 'The problem is solved as follows: \\boxed{42} and <answer>final result</answer> The correct answer is: A'
}
- 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
|
| extract_answer_math |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/eval/math/eval_math.py code served (permissive licence) · get_code("ffcf6f704a28bb3b") 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 extract_answer_math(s):
extracted_text = ''
def extract_boxed_content(text):
pattern = '\\\\boxed\\{'
matches = []
for match in re.finditer(pattern, text):
start_pos = match.end() - 1
brace_count = 0
content_start = start_pos + 1
for i in range(start_pos, len(text)):
if text[i] == '{':
brace_count += 1
elif text[i] == '}':
brace_count -= 1
if brace_count == 0:
matches.append(text[content_start:i])
break
return matches
all_matches = []
boxed_matches = extract_boxed_content(s)
all_matches.extend(boxed_matches)
answer_pattern = '<answer>(.*?)</answer>'
answer_matches = re.findall(answer_pattern, s, re.DOTALL | re.IGNORECASE)
all_matches.extend(answer_matches)
choice_pattern = '[Tt]he correct answer is:?\\s*([A-Ja-j])'
choice_matches = re.findall(choice_pattern, s, re.IGNORECASE)
all_matches.extend(choice_matches)
if all_matches:
extracted_text = all_matches[-1]
return extracted_text.strip()
ARGS = {
's': 'The solution is \\boxed{42} and 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 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
|
| extract_boxed_content |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/data_construction/3_judge/judge_pairs.py code served (permissive licence) · get_code("5a65ce548f2db502") 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 re
def extract_boxed_content(text):
"""Extract every \\boxed{...} body from `text` in order of appearance."""
pattern = '\\\\boxed\\{'
matches = []
for m in re.finditer(pattern, text):
start_pos = m.end() - 1
brace_count = 0
content_start = start_pos + 1
for i in range(start_pos, len(text)):
if text[i] == '{':
brace_count += 1
elif text[i] == '}':
brace_count -= 1
if brace_count == 0:
matches.append(text[content_start:i])
break
return matches
# Test cases
text_with_boxed = r"Some text \boxed{answer1} more text \boxed{answer2} and \boxed{nested{braces}}"
ARGS = {
"text": text_with_boxed
}
- 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
|
| get_all_highest_confidence_answers |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/data_construction/4_build_sft/build_sft_dataset.py code served (permissive licence) · get_code("e5cec7c5865db846") 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 torch
# Construct judge_results dictionary with all required keys
judge_results = {
'all_judgments': [
'Yes, this is correct',
'No, this is incorrect',
'Yes, this is correct'
],
'all_analyses': [
'The reasoning is sound and well-supported',
'The logic contains a flaw',
'The reasoning is sound and well-supported'
],
'all_confidences': [
'Very High',
'Medium',
'Very High'
]
}
ARGS = {
'judge_results': judge_results
}
- 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 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
|
| get_model_size |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/data_construction/2_pair/build_pairs.py code served (permissive licence) · get_code("faa29ea87424c295") 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)
ARGS = {
'model_name': '14b-model'
}
- 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
|
| get_prompt |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/eval/utils/judge_math_answer_gpt.py code served (permissive licence) · get_code("04002d844af70af7") 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
ARGS = {
"question": "Solve for x: 2x + 3 = 7",
"gold": "x = 2",
"pred": "x = 2"
}
- 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
|
| get_prompt |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/eval/utils/math_equal.py code served (permissive licence) · get_code("a8eed4c1f2f2831b") 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
ARGS = {
"question": "What is the sum of 2 and 3?",
"gold": "5",
"pred": "2 + 3"
}
- 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
|
| get_task_type |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/eval/rag/eval_rag_conflicts.py code served (permissive licence) · get_code("41a2c29e0316585f") 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)
ANSWER_NORMAL_TYPES = {'No conflict', 'Conflict due to misinformation'}
ANSWER_OUTDATED_TYPES = {'Conflict due to outdated information'}
ABSTAIN_TYPES = {'Complementary information', 'Conflicting opinions and research outcomes'}
def get_task_type(conflict_type: str) -> str:
"""Map the 5 conflict_type values down to the 3 task labels."""
if conflict_type in ANSWER_OUTDATED_TYPES:
return 'answerable_outdated'
if conflict_type in ABSTAIN_TYPES:
return 'abstain'
if conflict_type in ANSWER_NORMAL_TYPES:
return 'answerable_normal'
return 'answerable_normal'
ARGS = {
'conflict_type': 'No conflict'
}
- 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
|
| is_instruct_model |
Ran ran, violated the contract we drafted |
Tsinghua-dhy/CPT/eval/math/eval_math.py code served (permissive licence) · get_code("5d63c771657aa174") 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
# The function only uses model_name as a string parameter
# It calls .lower() on it and checks if keywords are in it
# So we just need a valid string
ARGS = {
'model_name': 'meta-llama/Llama-2-7b-chat-hf'
}
- 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
|
| is_instruct_model |
Ran ran, violated the contract we drafted |
Tsinghua-dhy/CPT/eval/rag/eval_rag_conflicts.py code served (permissive licence) · get_code("a2cb58cb395f9e4b") 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)
ARGS = {
"model_name": "mistral-instruct-7b"
}
- 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_all_questions |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/data_construction/2_pair/build_pairs.py code served (permissive licence) · get_code("4afecbe3b89e8ab8") 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 tempfile
from pathlib import Path
from collections import defaultdict
# Create a temporary directory structure with test data
temp_dir = tempfile.TemporaryDirectory()
output_dir = Path(temp_dir.name)
# Create model directories and JSON files
model1_dir = output_dir / "model_alpha"
model1_dir.mkdir()
model2_dir = output_dir / "model_beta"
model2_dir.mkdir()
# Create sample rollout data for model_alpha
rollouts_alpha = [
{
"question": "What is the capital of France?",
"difficulty": "easy",
"answer": "Paris",
"question_idx": 0,
"pred_ans": "Paris"
},
{
"question": "What is 2+2?",
"difficulty": "easy",
"answer": "4",
"question_idx": 1,
"pred_ans": "4"
}
]
# Create sample rollout data for model_beta
rollouts_beta = [
{
"question": "What is the capital of France?",
"difficulty": "easy",
"answer": "Paris",
"question_idx": 0,
"pred_ans": "Paris"
},
{
"question": "What is 2+2?",
"difficulty": "easy",
"answer": "4",
"question_idx": 1,
"pred_ans": "" # Truncated case
}
]
# Write JSON files
with open(model1_dir / "rollouts.json", "w", encoding="utf-8") as f:
json.dump(rollouts_alpha, f)
with open(model2_dir / "rollouts.json", "w", encoding="utf-8") as f:
json.dump(rollouts_beta, f)
ARGS = {
"output_dir": output_dir
}
- 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
|
| normalize_judgment |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/data_construction/3_judge/judge_pairs.py code served (permissive licence) · get_code("bc1311386b177375") 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)
# The function normalize_judgment takes a single parameter 'raw' which should be
# a string (or None). It processes the string by checking for various keywords
# and returns a canonical label.
# Test cases to construct valid arguments:
test_cases = [
None,
"Path A is better",
" PATH A IS BETTER ",
"Path A and better",
"path b is better",
" Path B is BETTER ",
"path b and better",
"equally good",
" EQUALLY GOOD ",
"both are good",
"equally bad",
"both are bad",
"unknown response",
"",
]
# For the function signature: def normalize_judgment(raw):
# We need to provide a value for 'raw' parameter
# The function handles strings (or None), so we'll use a simple string example
ARGS = {
"raw": "Path A is better"
}
- 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
|
| normalize_rollout |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/data_construction/2_pair/build_pairs.py code served (permissive licence) · get_code("d4cd0d203051a63a") 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
torch.manual_seed(0)
# Analyze the function: normalize_rollout takes a rollout dict
# The function checks for 'pred_ans' key, gets it, strips whitespace, and checks if empty
# If empty, it sets 'pred_ans' to 'be truncate, No answer'
# The function returns a normalized copy of the dict
# Test case 1: rollout with empty pred_ans
rollout_empty = {
'pred_ans': '',
'other_key': 'some_value',
'score': 42
}
ARGS = {
'rollout': rollout_empty
}
- 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
|
| parse_judge_output |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/data_construction/3_judge/judge_pairs.py code served (permissive licence) · get_code("ce2f3b3913ae8706") 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
def extract_boxed_content(text):
"""Extract every \\boxed{...} body from `text` in order of appearance."""
pattern = '\\\\boxed\\{'
matches = []
for m in re.finditer(pattern, text):
start_pos = m.end() - 1
brace_count = 0
content_start = start_pos + 1
for i in range(start_pos, len(text)):
if text[i] == '{':
brace_count += 1
elif text[i] == '}':
brace_count -= 1
if brace_count == 0:
matches.append(text[content_start:i])
break
return matches
def normalize_judgment(raw):
"""Normalize the model output's judgment string to the canonical 4-way label."""
if raw is None:
return ''
s = raw.strip().lower()
if 'path a is better' in s or ('path a' in s and 'better' in s):
return 'Path A is better'
if 'path b is better' in s or ('path b' in s and 'better' in s):
return 'Path B is better'
if 'equally good' in s or 'both are good' in s:
return 'Both are equally good'
if 'equally bad' in s or 'both are bad' in s:
return 'Both are equally bad'
return ''
def parse_judge_output(text):
"""
parsemodel output, return (analysis, judgment).
Take the judgment from the last \\boxed{}; if absent, fall back to a regex scan of the whole text.
analysis = the text before \\boxed{} (with leading/trailing whitespace stripped).
"""
text = (text or '').strip()
if not text:
return ('', '')
boxed = extract_boxed_content(text)
judgment = normalize_judgment(boxed[-1]) if boxed else ''
if not judgment:
judgment = normalize_judgment(text)
if boxed:
last_box_pos = text.rfind('\\boxed{')
analysis = text[:last_box_pos].strip() if last_box_pos > 0 else text
else:
analysis = text
return (analysis, judgment)
# Test case 1: Text with boxed content
text_with_boxed = "This is my analysis of the two paths. \n\\boxed{Path A is better}"
# Test case 2: Text without boxed content but with judgment keyword
text_without_boxed = "After careful consideration, path b is better than path a."
# Test case 3: Empty string
text_empty = ""
# Test case 4: Complex text with multiple boxed sections
text_complex = "First analysis here.\n\\boxed{Both are equally good}\nMore text\n\\boxed{Path A is better}"
ARGS = {
'text': text_with_boxed
}
- 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
|
| process_text |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/data_construction/1_rollout/rollout.py code served (permissive licence) · get_code("13430c1445a0990c") 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
class DummyTokenizer:
"""Stand-in tokenizer with minimal interface."""
def __call__(self, text):
return {"input_ids": [101, 2054, 102]}
def encode(self, text):
return [101, 2054, 102]
# Create example dict with required 'question' key
example = {
'question': 'What is 2+2?',
'other_field': 'some_value'
}
# Create tokenizer instance
tokenizer = DummyTokenizer()
# Map all parameters to their values
ARGS = {
'example': example,
'tokenizer': tokenizer
}
- 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
|
| process_text |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/eval/math/eval_math.py code served (permissive licence) · get_code("7f580ad4df20e7bd") 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 torch.nn as nn
torch.manual_seed(0)
# Create a minimal tokenizer stand-in that has apply_chat_template method
class MinimalTokenizer:
def apply_chat_template(self, prompt_chat, add_generation_prompt=False, tokenize=False, enable_thinking=False):
# Simple implementation that concatenates the chat messages
result = ""
for msg in prompt_chat:
result += f"{msg['role']}: {msg['content']}\n"
return result
# Create example dict with required 'question' key
example = {
'question': 'What is 2 + 2?'
}
# Create tokenizer instance
tokenizer = MinimalTokenizer()
# Model short name (used for identification, not actually used in the function body)
model_short_name = "test_model"
ARGS = {
'example': example,
'model_short_name': model_short_name,
'tokenizer': tokenizer,
'use_chat_template': 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
|
| split_consensus_data |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/data_construction/4_build_sft/split_consensus.py code served (permissive licence) · get_code("14c46927d4562367") 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 tempfile
from pathlib import Path
# Create a temporary directory for output
temp_output_dir = tempfile.mkdtemp()
# Create a temporary input file with sample consensus data
temp_input_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.jsonl', encoding='utf-8')
# Generate sample data with consensus
sample_data = []
for i in range(21000): # Need enough data to split into sft(10000) + rl(10000) + test(500) + remaining(500)
item = {
'id': f'sample_{i}',
'prompt': f'This is a sample prompt {i}',
'response_a': f'Response A for sample {i}',
'response_b': f'Response B for sample {i}',
'difficulty': ['easy', 'medium', 'hard'][i % 3],
'pair_type': ['preference', 'tie', 'better_a', 'better_b'][i % 4],
'task_type': ['writing', 'math', 'coding', 'reasoning'][i % 4],
'judge_results': {
'has_consensus': True,
'final_judgment': f'Response A is better for sample {i}',
'judgment_difficulty': ['easy', 'medium', 'hard'][i % 3]
}
}
sample_data.append(item)
# Write sample data to file
for item in sample_data:
temp_input_file.write(json.dumps(item, ensure_ascii=False) + '\n')
temp_input_file.close()
ARGS = {
'input_file': temp_input_file.name,
'output_dir': temp_output_dir
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- tqdm — 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
|
| validate_datasets |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/eval/abstention/eval_abstention.py code served (permissive licence) · get_code("6f4528b6a787c430") 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
ARGS = {
'dataset_str': 'alcuna,bbq,squad2'
}
- 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 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
|
| validate_prompt_styles |
Ran ran; our contract draft was wrong, not the code |
Tsinghua-dhy/CPT/eval/abstention/eval_abstention.py code served (permissive licence) · get_code("fbe2f6cfb047b17e") 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
# Define ARGS dict with valid arguments for validate_prompt_styles
ARGS = {
'style_str': 'normal,abstention'
}
- 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
|
| compute_math_score |
Not yet run unverified (harvested, no recorded run) |
Tsinghua-dhy/CPT/eval/abstention/correctness_evaluator.py code served (permissive licence) · get_code("990b7ec66e5cee70") How it ran |
| process_text |
Not yet run unverified (harvested, no recorded run) |
Tsinghua-dhy/CPT/eval/rag/eval_rag_conflicts.py code served (permissive licence) · get_code("ba60eead339e8791") How it ran |