Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
json
Languages:
English
Size:
10K - 100K
License:
File size: 3,549 Bytes
9b7942a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | """Frozen release evaluation renderer, created after model selection."""
import argparse
import hashlib
import json
import random
from pathlib import Path
from .common import POLICY, SCHEMA, digest, save_json
from .data import COMPONENTS, labels, make_situation
SEED = 314159
VERSION = 'release-final-v1'
def render_final(s, rng):
lines = [
f"Current verification: {'passes' if s['latest_pass'] else 'does not pass'}; formal acceptance: {'on file' if s['accepted'] else 'absent'}.",
f"Temporary obstruction: {'removed' if s['blocker_cleared'] else 'remains'}; an unchanged retry: {'has already failed' if s['retry_failed'] else 'has not been run'}.",
f"Reversal of the proposed change is {'allowed' if s['rollback'] else 'not allowed'}.",
]
order = list(range(4)); rng.shuffle(order)
for index in order:
outcome = 'could no longer be reproduced' if s['cleared'][index] else 'remained reproducible'
lines.append(f"Independent control from the original snapshot, replacing only {COMPONENTS[index]}: the original fault {outcome}.")
rng.shuffle(lines)
header = (f"Case review for {s['task']}: the initial run recorded {s['passed']} successful checks and "
f"{s['failed']} failures with {s['error']}. A recent edit concerned {s['recent']}; this is contextual, not causal evidence.")
return header + '\nEvery control below starts independently from the same original failing snapshot.\n' + '\n'.join(lines)
def generate(root='data/final-v1', source_root='data/diversity-v2', size=2000, seed=SEED):
root = Path(root)
if root.exists():
raise ValueError(f'Release final set already exists: {root}')
source_root = Path(source_root)
seen = set()
for split in ['train', 'validation', 'calibration', 'test']:
seen.update(json.loads(line)['id'] for line in (source_root / f'{split}.jsonl').read_text().splitlines())
rng = random.Random(seed)
rows = []
while len(rows) < size:
situation = make_situation(rng)
identifier = hashlib.sha256(json.dumps(situation, sort_keys=True).encode()).hexdigest()
if identifier in seen:
continue
seen.add(identifier)
rows.append({
'id': identifier,
'state': render_final(situation, rng),
'labels': labels(situation),
'latent': situation,
'provenance': {'generator': VERSION, 'split': 'test', 'renderer': 'case_review', 'seed': seed},
})
root.mkdir(parents=True)
(root / 'test.jsonl').write_text(''.join(json.dumps(row) + '\n' for row in rows))
spec = {
'version': VERSION,
'seed': seed,
'test': size,
'renderer': 'case_review',
'created_after_model_selection': True,
'source_exclusion_manifest_sha256': digest(source_root / 'manifest.json'),
}
save_json(root / 'spec.json', spec)
save_json(root / 'manifest.json', {
'spec': spec,
'schema': SCHEMA,
'policy': POLICY,
'sha256': {'test.jsonl': digest(root / 'test.jsonl')},
})
print(json.dumps(spec))
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--output', default='data/final-v1')
parser.add_argument('--source-root', default='data/diversity-v2')
parser.add_argument('--size', type=int, default=2000)
parser.add_argument('--seed', type=int, default=SEED)
args = parser.parse_args()
generate(args.output, args.source_root, args.size, args.seed)
|