Datasets:
Add reproducible RL experiment filters and generated CalibForge summary
Browse files- calibforge_v1.1/README.md +57 -29
- calibforge_v1.1/filter_tasks.py +226 -0
- calibforge_v1.1/results.parquet +2 -2
calibforge_v1.1/README.md
CHANGED
|
@@ -1,36 +1,20 @@
|
|
| 1 |
# CalibForge v1.1
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
|
| 6 |
|
| 7 |
-
|
| 8 |
-
- `results.parquet`: 5,431 task records with check outcomes, judge verdicts and weak/strong pass@4 results. The 47 build failures remain in the results but have no payload in this export.
|
| 9 |
-
- `cached_images/manifest.json` and its referenced image files: task environments, pinned download references and checksums. The same index is embedded in the task Parquet for the standard pipeline loader.
|
| 10 |
-
- `runtime-manifest.json`: task-to-runtime mapping, pinned references and checksums. Download its referenced SquashFS files and sidecars from the shared repository-level `runtimes/` directory.
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
All **1,176 referenced runtimes** are available on main and their published identities were verified against the local checksum-verified cache. Matching published environment images cover **5,375 of 5,384 payloads**. The **nine missing image mappings** are listed in `cached_images/manifest.json`; these tasks are not ready to run from this release alone. This is separate from the 47 recorded build failures.
|
| 17 |
-
|
| 18 |
-
The current required-check columns classify **5,081** records as passed/warning/not-applicable, **333** as failed and **17** as incomplete. See the per-check table below. AI detection is intentionally excluded by user policy.
|
| 19 |
-
|
| 20 |
-
## Repairs and evaluations
|
| 21 |
-
|
| 22 |
-
The payloads include 66 accepted agent-editable-test repairs and four accepted repository-history repairs, all matched to their current result hashes. Earlier LLM-judge and teacher outcomes are retained only for unchanged task hashes. Evaluations of the 70 changed payloads are cleared rather than inherited from old versions.
|
| 23 |
-
|
| 24 |
-
Fresh Qwen3.8-27B and GLM-5.3-Flash judge runs and Qwen3.5-35B-A3B / GLM-5.3-Flash pass@4 runs were submitted for the 66 repaired tasks whose prerequisite checks are complete and nonfailing. Four repaired tasks remain blocked by failed or incomplete prerequisite checks. Slurm jobs: judge-qwen 1318351, judge-glm 1318353, passk-target 1318356, passk-teacher 1318357. Submitted jobs have no new results in this snapshot.
|
| 25 |
-
|
| 26 |
-
The existing pass@4 runs used resource calibration. The new submissions preserve each task's declared CPU, memory and storage limits and disable resource increases. Both use the recorded simulated network policy; this is not a strict offline-isolation claim. `resources_recommended` records historical measurements, not permission to change declared limits.
|
| 27 |
-
|
| 28 |
-
| Evaluation | At least one success | Complete unsolved | Inconclusive | Not run / needs rerun |
|
| 29 |
-
| --- | ---: | ---: | ---: | ---: |
|
| 30 |
-
| Weak model (Qwen3.5-35B-A3B) | 2866 | 2110 | 28 | 427 |
|
| 31 |
-
| Strong teacher (GLM-5.3-Flash) | 3847 | 1154 | 3 | 427 |
|
| 32 |
-
|
| 33 |
-
## Validation checks
|
| 34 |
|
| 35 |
| Rule | Total tasks | Passed | Failed | Warning | Automatically repaired | Unresolved | Not applicable | Repair not recorded |
|
| 36 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
|
@@ -66,6 +50,50 @@ The existing pass@4 runs used resource calibration. The new submissions preserve
|
|
| 66 |
| verifier_paths | 5431 | 5143 (94.7%) | 225 (4.1%) | 0 (0.0%) | 0 (0.0%) | 63 (1.2%) | 0 (0.0%) | 0 (0.0%) |
|
| 67 |
| verifier_tamper | 5431 | 4168 (76.7%) | 0 (0.0%) | 1214 (22.4%) | 3741 (68.9%) | 49 (0.9%) | 0 (0.0%) | 538 (9.9%) |
|
| 68 |
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
-
|
|
|
|
| 1 |
# CalibForge v1.1
|
| 2 |
|
| 3 |
+
| Tasks in payload | Result records | Validation passed¹ | Failed | Incomplete |
|
| 4 |
+
| --- | --- | --- | --- | --- |
|
| 5 |
+
| 5384 | 5431 | 5081 | 333 | 17 |
|
| 6 |
|
| 7 |
+
¹ Includes warnings and not-applicable checks. The task file is unfiltered; use the filter below. AI detection is intentionally excluded by user policy.
|
| 8 |
|
| 9 |
+
## Recorded pass@4 results
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
| Model | At least one success | Complete unsolved | Incomplete / not run |
|
| 12 |
+
| --- | --- | --- | --- |
|
| 13 |
+
| Qwen3.5-35B-A3B | 2866 | 2110 | 455 |
|
| 14 |
+
| GLM-5.3-Flash | 3847 | 1154 | 430 |
|
| 15 |
|
| 16 |
+
<details>
|
| 17 |
+
<summary>Validation results by check</summary>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
| Rule | Total tasks | Passed | Failed | Warning | Automatically repaired | Unresolved | Not applicable | Repair not recorded |
|
| 20 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
|
|
|
| 50 |
| verifier_paths | 5431 | 5143 (94.7%) | 225 (4.1%) | 0 (0.0%) | 0 (0.0%) | 63 (1.2%) | 0 (0.0%) | 0 (0.0%) |
|
| 51 |
| verifier_tamper | 5431 | 4168 (76.7%) | 0 (0.0%) | 1214 (22.4%) | 3741 (68.9%) | 49 (0.9%) | 0 (0.0%) | 538 (9.9%) |
|
| 52 |
|
| 53 |
+
</details>
|
| 54 |
+
|
| 55 |
+
## Files
|
| 56 |
+
|
| 57 |
+
`tasks.parquet` contains task archives; `results.parquet` contains checks, judge verdicts and evaluations. `cached_images/` contains environment images and their index. `runtime-manifest.json` maps tasks to the shared `runtimes/` files. `filter_tasks.py` creates selected task/results pairs.
|
| 58 |
+
|
| 59 |
+
All 1,176 referenced runtimes are published. Nine task environment images remain unavailable; their IDs are listed in the image manifest.
|
| 60 |
+
|
| 61 |
+
## Filtering
|
| 62 |
+
|
| 63 |
+
Install `pyarrow` and put `filter_tasks.py`, `tasks.parquet` and `results.parquet` in the same directory. By default, the script requires all recorded default-training validation checks through leakage to pass, warn or be not applicable. Failed, missing and incomplete checks are excluded. Task IDs and payload hashes must match. No pass@k filter is applied.
|
| 64 |
+
|
| 65 |
+
```bash
|
| 66 |
+
# Deterministic validation and leakage checks only
|
| 67 |
+
python filter_tasks.py --out validated
|
| 68 |
+
|
| 69 |
+
# Also require every adjusted-rubric criterion to pass for one judge
|
| 70 |
+
python filter_tasks.py --judge qwen --out clean-qwen
|
| 71 |
+
|
| 72 |
+
# Allow one named criterion to fail; retain all other judge requirements
|
| 73 |
+
python filter_tasks.py --judge glm \
|
| 74 |
+
--allow-fail VERIFIER-ACCEPTS-INCOMPLETE --out glm-with-incomplete
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
`--criteria` optionally selects which judge criteria to enforce; the default is all eight. Judge models are evaluated separately. Missing verdicts are excluded; if repeated reviews disagree, any fail counts as a fail.
|
| 78 |
+
|
| 79 |
+
## Proposed RL experiment
|
| 80 |
+
|
| 81 |
+
**Experiment 2.1:** train separate RL runs on three datasets for each judge: **clean**, **clean + VERIFIER-ACCEPTS-INCOMPLETE-only**, and **clean + VERIFIER-ACCEPTS-SHORTCUTS-only**. Clean tasks pass every selected judge criterion. An “only” addition fails that criterion and passes the other seven; tasks failing both are excluded. Each augmented dataset contains the same clean core. Judges are Qwen3.8-27B and GLM-5.3-Flash.
|
| 82 |
+
|
| 83 |
+
| Judge | Clean | Clean + incomplete-only | Clean + shortcuts-only |
|
| 84 |
+
| --- | --- | --- | --- |
|
| 85 |
+
| Qwen | 1,545 | 2,093 | 2,043 |
|
| 86 |
+
| GLM | 1,275 | 1,783 | 1,570 |
|
| 87 |
+
|
| 88 |
+
**Hypothesis:** relative to clean-only training, adding incomplete-only tasks improves held-out performance, while adding shortcuts-only tasks reduces it. This is a proposed hypothesis, not a measured result. Keep the model, evaluation set, seeds and training budget matched across conditions. Because the added groups differ in size, use a size-matched comparison as a control for data quantity.
|
| 89 |
+
|
| 90 |
+
```bash
|
| 91 |
+
python filter_tasks.py --judge qwen --experiment-2 --out experiment2/qwen
|
| 92 |
+
python filter_tasks.py --judge glm --experiment-2 --out experiment2/glm
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
Each command writes `clean/`, `clean-plus-incomplete/` and `clean-plus-shortcuts/`, each with `tasks.parquet` and `results.parquet`, plus a selection record. Counts use current, version-matched results; repaired tasks without fresh judge verdicts are excluded.
|
| 96 |
+
|
| 97 |
+
## Task resources
|
| 98 |
|
| 99 |
+
`task.toml` retains declared resource limits. Calibrated recommendations are in `resources_recommended` in the results; filtering preserves task payloads. The 66 eligible repaired tasks have fresh judge and calibrated pass@4 runs queued, so their new evaluations are not yet included.
|
calibforge_v1.1/filter_tasks.py
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Filter a task/results Parquet pair; usable standalone with only pyarrow installed.
|
| 2 |
+
|
| 3 |
+
Example: python filter_tasks.py --judge qwen --experiment-2 --out experiment2/qwen
|
| 4 |
+
No pass@k filter is applied. Warnings stay; missing/incomplete checks do not pass.
|
| 5 |
+
"""
|
| 6 |
+
import argparse
|
| 7 |
+
from collections import Counter
|
| 8 |
+
import hashlib
|
| 9 |
+
import io
|
| 10 |
+
import json
|
| 11 |
+
from pathlib import Path
|
| 12 |
+
import tarfile
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
# Recorded default-training checks through deterministic validation and leakage.
|
| 16 |
+
# Upstream-only conventions and AI detection (user policy) are intentionally absent.
|
| 17 |
+
REQUIRED_CHECKS = (
|
| 18 |
+
'agent_editable_test', 'artifact_efficiency', 'build', 'compose-host-binds',
|
| 19 |
+
'declared_internet_access', 'declared_workdir', 'do_not_modify',
|
| 20 |
+
'dockerfile-platform', 'dockerfile-references', 'dockerfile-sanity',
|
| 21 |
+
'instruction-suffix', 'no-cheat-dir', 'no_behavioural_tests', 'nop',
|
| 22 |
+
'nop_determinism', 'nproc', 'pip-pinning', 'python_missing_imports',
|
| 23 |
+
'reference', 'reference_determinism', 'reference_leaks', 'repository_history',
|
| 24 |
+
'repository_timestamps', 'resource-sizes', 'script_execution_coverage',
|
| 25 |
+
'task-absolute-path', 'task-timeout', 'task-toml-schema',
|
| 26 |
+
'test-file-references', 'verifier_paths', 'verifier_tamper',
|
| 27 |
+
)
|
| 28 |
+
JUDGE_CRITERIA = (
|
| 29 |
+
'ANSWER-LEAK', 'INSTR-AMBIGUOUS', 'INSTR-ENV-MISMATCH',
|
| 30 |
+
'INSTR-VERIFIER-CONTRADICTION', 'INSTR-VERIFIER-UNSTATED-REQUIREMENT',
|
| 31 |
+
'TASK-TRIVIAL', 'VERIFIER-ACCEPTS-INCOMPLETE', 'VERIFIER-ACCEPTS-SHORTCUTS',
|
| 32 |
+
)
|
| 33 |
+
JUDGES = {'qwen': 'Qwen/Qwen3.8-27B', 'glm': 'zai-org/GLM-5.3-Flash'}
|
| 34 |
+
ACCEPTED = {'pass', 'warning', 'not_applicable'}
|
| 35 |
+
EXPERIMENT = {
|
| 36 |
+
'clean': set(),
|
| 37 |
+
'clean-plus-incomplete': {'VERIFIER-ACCEPTS-INCOMPLETE'},
|
| 38 |
+
'clean-plus-shortcuts': {'VERIFIER-ACCEPTS-SHORTCUTS'},
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def status(value):
|
| 43 |
+
return value.get('status') if isinstance(value, dict) else value
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def baseline_issues(row, checks=REQUIRED_CHECKS):
|
| 47 |
+
return {key: status(row.get(key)) or 'missing' for key in checks
|
| 48 |
+
if status(row.get(key)) not in ACCEPTED}
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def judge_failures(row, judge, criteria=JUDGE_CRITERIA):
|
| 52 |
+
"""Return failed criteria, or None when any required review is unresolved.
|
| 53 |
+
|
| 54 |
+
If several reviews exist, any fail counts as a fail. Unknown/missing verdicts
|
| 55 |
+
exclude the task even when another review passed. Other models never vote.
|
| 56 |
+
"""
|
| 57 |
+
failed = set()
|
| 58 |
+
for criterion in criteria:
|
| 59 |
+
cell = row.get(criterion) or {}
|
| 60 |
+
reviews = dict(cell.get('verdicts') or {}).get(JUDGES.get(judge, judge), [])
|
| 61 |
+
if not reviews or any(v not in ACCEPTED | {'fail'} for v in reviews):
|
| 62 |
+
return None
|
| 63 |
+
if 'fail' in reviews:
|
| 64 |
+
failed.add(criterion)
|
| 65 |
+
return failed
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
def select(rows, judge=None, allow_fail=(), criteria=JUDGE_CRITERIA):
|
| 69 |
+
allowed = set(allow_fail)
|
| 70 |
+
if allowed - set(criteria):
|
| 71 |
+
raise ValueError('Allowed failure must be one of the selected judge criteria')
|
| 72 |
+
selected, reasons = {}, Counter()
|
| 73 |
+
seen = set()
|
| 74 |
+
for row in rows:
|
| 75 |
+
name = row['task_id']
|
| 76 |
+
if name in seen:
|
| 77 |
+
raise ValueError(f'Duplicate result task ID: {name}')
|
| 78 |
+
seen.add(name)
|
| 79 |
+
issues = baseline_issues(row)
|
| 80 |
+
if issues:
|
| 81 |
+
reasons['validation_failed' if 'fail' in issues.values() else 'validation_incomplete'] += 1
|
| 82 |
+
continue
|
| 83 |
+
if judge:
|
| 84 |
+
failures = judge_failures(row, judge, criteria)
|
| 85 |
+
if failures is None:
|
| 86 |
+
reasons['judge_incomplete'] += 1
|
| 87 |
+
continue
|
| 88 |
+
if failures - allowed:
|
| 89 |
+
reasons['judge_failed_other_criteria'] += 1
|
| 90 |
+
continue
|
| 91 |
+
selected[name] = row
|
| 92 |
+
return selected, dict(reasons)
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
def payload_hash(binary):
|
| 96 |
+
files = {}
|
| 97 |
+
with tarfile.open(fileobj=io.BytesIO(binary), mode='r:*') as archive:
|
| 98 |
+
for member in archive:
|
| 99 |
+
name = Path(member.name).as_posix()
|
| 100 |
+
if Path(name).is_absolute() or '..' in Path(name).parts:
|
| 101 |
+
raise ValueError('Unsafe task archive path')
|
| 102 |
+
if member.isfile():
|
| 103 |
+
if name in files:
|
| 104 |
+
raise ValueError('Duplicate task archive path')
|
| 105 |
+
files[name] = archive.extractfile(member).read()
|
| 106 |
+
elif not member.isdir():
|
| 107 |
+
raise ValueError('Unsupported task archive member')
|
| 108 |
+
digest = hashlib.sha256()
|
| 109 |
+
for name, data in sorted(files.items()):
|
| 110 |
+
name = name.encode()
|
| 111 |
+
digest.update(len(name).to_bytes(8, 'big') + name)
|
| 112 |
+
digest.update(len(data).to_bytes(8, 'big') + data)
|
| 113 |
+
return digest.hexdigest()
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
def subset_metadata(metadata, ids):
|
| 117 |
+
metadata = dict(metadata or {})
|
| 118 |
+
if b'ot.images.v1' in metadata:
|
| 119 |
+
manifest = json.loads(metadata[b'ot.images.v1'])
|
| 120 |
+
manifest['tasks'] = {k: v for k, v in manifest['tasks'].items() if k in ids}
|
| 121 |
+
bundles = {e['bundle'] for t in manifest['tasks'].values() for e in t['environments']}
|
| 122 |
+
manifest['bundles'] = {k: v for k, v in manifest['bundles'].items() if k in bundles}
|
| 123 |
+
manifest['missing'] = [r for r in manifest.get('missing', []) if r.get('task') in ids]
|
| 124 |
+
metadata[b'ot.images.v1'] = json.dumps(manifest, separators=(',', ':')).encode()
|
| 125 |
+
return metadata
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
def export(tasks, results, out, judge=None, allow_fail=(), experiment2=False,
|
| 129 |
+
criteria=JUDGE_CRITERIA):
|
| 130 |
+
import pyarrow as pa
|
| 131 |
+
import pyarrow.parquet as pq
|
| 132 |
+
tasks, results, out = Path(tasks), Path(results), Path(out)
|
| 133 |
+
if experiment2 and (not judge or allow_fail):
|
| 134 |
+
raise ValueError('--experiment-2 requires --judge and cannot use --allow-fail')
|
| 135 |
+
if allow_fail and not judge:
|
| 136 |
+
raise ValueError('--allow-fail requires --judge')
|
| 137 |
+
table = pq.read_table(results)
|
| 138 |
+
absent = set(REQUIRED_CHECKS) - set(table.column_names)
|
| 139 |
+
if absent:
|
| 140 |
+
raise ValueError('Missing required validation columns: ' + ', '.join(sorted(absent)))
|
| 141 |
+
if judge and set(criteria) - set(table.column_names):
|
| 142 |
+
raise ValueError('Unknown judge criteria: ' + ', '.join(sorted(set(criteria) - set(table.column_names))))
|
| 143 |
+
rows = table.to_pylist()
|
| 144 |
+
if judge:
|
| 145 |
+
available = {model for row in rows for criterion in criteria
|
| 146 |
+
for model in dict((row.get(criterion) or {}).get('verdicts') or {})}
|
| 147 |
+
if JUDGES.get(judge, judge) not in available:
|
| 148 |
+
raise ValueError('No verdicts for judge ' + judge + '; available: ' + ', '.join(sorted(available)))
|
| 149 |
+
variants = EXPERIMENT if experiment2 else {'selected': set(allow_fail)}
|
| 150 |
+
groups = {name: select(rows, judge, allowed, criteria) for name, allowed in variants.items()}
|
| 151 |
+
source = pq.ParquetFile(tasks)
|
| 152 |
+
schemas, writers, paths = {}, {}, {}
|
| 153 |
+
for name, (selected, _) in groups.items():
|
| 154 |
+
folder = out / name if experiment2 else out
|
| 155 |
+
if (folder / 'tasks.parquet').exists() or (folder / 'results.parquet').exists():
|
| 156 |
+
raise FileExistsError(f'Output already exists: {folder}')
|
| 157 |
+
folder.mkdir(parents=True, exist_ok=True)
|
| 158 |
+
paths[name] = folder
|
| 159 |
+
schemas[name] = source.schema_arrow.with_metadata(subset_metadata(source.schema_arrow.metadata, set(selected)))
|
| 160 |
+
writers[name] = pq.ParquetWriter(folder / 'tasks.parquet.partial', schemas[name])
|
| 161 |
+
seen, written = set(), {name: set() for name in groups}
|
| 162 |
+
try:
|
| 163 |
+
for batch in source.iter_batches(batch_size=16):
|
| 164 |
+
outputs = {name: [] for name in groups}
|
| 165 |
+
for row in batch.to_pylist():
|
| 166 |
+
task = row['path']
|
| 167 |
+
if task in seen:
|
| 168 |
+
raise ValueError(f'Duplicate task payload: {task}')
|
| 169 |
+
seen.add(task)
|
| 170 |
+
matches = [name for name, (selected, _) in groups.items() if task in selected]
|
| 171 |
+
if not matches:
|
| 172 |
+
continue
|
| 173 |
+
digest = payload_hash(row['task_binary'])
|
| 174 |
+
if row.get('content_sha256') and row['content_sha256'] != digest:
|
| 175 |
+
raise ValueError(f'Task content hash mismatch: {task}')
|
| 176 |
+
for name in matches:
|
| 177 |
+
if groups[name][0][task].get('content_sha256') != digest:
|
| 178 |
+
raise ValueError(f'Results describe another task version: {task}')
|
| 179 |
+
outputs[name].append(row)
|
| 180 |
+
written[name].add(task)
|
| 181 |
+
for name, output in outputs.items():
|
| 182 |
+
if output:
|
| 183 |
+
writers[name].write_table(pa.Table.from_pylist(output, schema=schemas[name]))
|
| 184 |
+
for name, (selected, _) in groups.items():
|
| 185 |
+
if set(selected) - written[name]:
|
| 186 |
+
raise ValueError(f'{name}: selected results have no task payload')
|
| 187 |
+
finally:
|
| 188 |
+
for writer in writers.values():
|
| 189 |
+
writer.close()
|
| 190 |
+
def file_identity(path):
|
| 191 |
+
with path.open('rb') as stream:
|
| 192 |
+
return {'path': str(path), 'sha256': hashlib.file_digest(stream, 'sha256').hexdigest()}
|
| 193 |
+
summary = {'inputs': {'tasks': file_identity(tasks), 'results': file_identity(results)},
|
| 194 |
+
'judge': JUDGES.get(judge, judge), 'validation_checks': list(REQUIRED_CHECKS),
|
| 195 |
+
'judge_criteria': list(criteria) if judge else [], 'passk_filter': None,
|
| 196 |
+
'warnings_retained': True, 'incomplete_excluded': True, 'groups': {}}
|
| 197 |
+
for name, (selected, excluded) in groups.items():
|
| 198 |
+
folder = paths[name]
|
| 199 |
+
pq.write_table(pa.Table.from_pylist([selected[n] for n in sorted(written[name])], schema=table.schema),
|
| 200 |
+
folder / 'results.parquet')
|
| 201 |
+
(folder / 'tasks.parquet.partial').rename(folder / 'tasks.parquet')
|
| 202 |
+
summary['groups'][name] = {'tasks': len(written[name]), 'allowed_failures': sorted(variants[name]),
|
| 203 |
+
'excluded': excluded, 'selection': sorted(written[name])}
|
| 204 |
+
out.mkdir(parents=True, exist_ok=True)
|
| 205 |
+
(out / 'selection.json').write_text(json.dumps(summary, indent=2) + '\n')
|
| 206 |
+
return summary
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
def main():
|
| 210 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 211 |
+
parser.add_argument('--tasks', type=Path, default=Path('tasks.parquet'))
|
| 212 |
+
parser.add_argument('--results', type=Path, default=Path('results.parquet'))
|
| 213 |
+
parser.add_argument('--judge', help='qwen, glm, or exact model ID; omitted = validation only')
|
| 214 |
+
parser.add_argument('--allow-fail', action='append', default=[], metavar='CRITERION',
|
| 215 |
+
help='Allow this judge criterion to fail; all others must pass (repeatable)')
|
| 216 |
+
parser.add_argument('--criteria', nargs='+', default=JUDGE_CRITERIA,
|
| 217 |
+
help='Judge criteria to enforce; default = all eight adjusted-rubric criteria')
|
| 218 |
+
parser.add_argument('--experiment-2', action='store_true', help='Export all three Experiment 2.1 groups')
|
| 219 |
+
parser.add_argument('--out', type=Path, required=True)
|
| 220 |
+
args = parser.parse_args()
|
| 221 |
+
summary = export(args.tasks, args.results, args.out, args.judge, args.allow_fail, args.experiment_2, args.criteria)
|
| 222 |
+
print(json.dumps({k: v['tasks'] for k, v in summary['groups'].items()}, indent=2))
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
if __name__ == '__main__':
|
| 226 |
+
main()
|
calibforge_v1.1/results.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:12d95e368171be81f48f33babc4b157a66d6d9aa88c525bccbc374132e2c6fdb
|
| 3 |
+
size 25324361
|