Skip to content

Commit 5727a44

Browse files
varunursekarclaude
andcommitted
Let the rescore script measure a benchmark's seed harness, not just a candidate
Re-pinning a baseline and re-scoring a candidate are the same measurement with a different starting tree, so --seed reuses the whole verified path rather than introducing a second scorer whose equivalence we would have to argue: plain harbor run over the explicit test task list, N rounds pooled, no gateway, and no --agent-timeout-multiplier so harbor's default 1.0 applies exactly as it did when the baselines were first pinned. Aggregation still matches runs/recompute.py. The seed is copied out of the benchmark's agent_repo before running so a measurement cannot mutate the checkout, and __pycache__/.venv/.git are excluded. Needed because the pinned baselines are of uncertain currency: gaia's seed scored 0.6414 through a run's finalization against a pinned 0.5736. Whether that is a stale pin or gaia's own variance is what re-measuring settles -- officeqa's first fresh round already lands at 0.3535 against its pinned 0.3603, which suggests the pins are healthier than the gaia figure implied. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent d93c696 commit 5727a44

1 file changed

Lines changed: 34 additions & 8 deletions

File tree

harness-engineering-bench/scripts/rescore_candidate.py

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,17 @@ def trial_rewards(round_dir: Path) -> list[float]:
195195

196196
def main() -> int:
197197
parser = argparse.ArgumentParser(description=__doc__.split("\n")[0])
198-
parser.add_argument("--session", required=True,
198+
source = parser.add_mutually_exclusive_group(required=True)
199+
source.add_argument("--session",
199200
help="session.tar.gz, or an extracted session dir")
201+
source.add_argument(
202+
"--seed", action="store_true",
203+
help=(
204+
"score the benchmark's own seed harness instead of a candidate, to "
205+
"re-pin baseline_reward. Uses the same path and aggregation as a "
206+
"candidate rescore, so the two stay comparable."
207+
),
208+
)
200209
parser.add_argument("--benchmark", required=True)
201210
parser.add_argument("--version", help="candidate sha (default: the shipped one)")
202211
parser.add_argument("--partition", default="test")
@@ -216,12 +225,28 @@ def main() -> int:
216225
tempfile.mkdtemp(prefix=f"rescore-{args.benchmark}-"))
217226
outdir.mkdir(parents=True, exist_ok=True)
218227

219-
session_dir = open_session(args.session, outdir)
220-
version = shipped_version(session_dir, Path(args.session).resolve(), args.version)
221-
workspace = outdir / "candidate"
222-
if workspace.exists():
223-
shutil.rmtree(workspace)
224-
extract_candidate(session_dir, version, workspace)
228+
if args.seed:
229+
# The seed harness lives beside the build config, at the path build.yaml
230+
# names in agent_repo. Copy it so the run cannot mutate the checkout.
231+
origin = (build_path.parent / str(build.get("agent_repo", "target"))).resolve()
232+
if not origin.is_dir():
233+
sys.exit(f"no seed harness at {origin}")
234+
workspace = outdir / "seed"
235+
if workspace.exists():
236+
shutil.rmtree(workspace)
237+
shutil.copytree(origin, workspace, ignore=shutil.ignore_patterns(
238+
"__pycache__", "*.pyc", ".venv", ".git"))
239+
version = "seed"
240+
log(f"seed harness from {origin}")
241+
else:
242+
session_dir = open_session(args.session, outdir)
243+
version = shipped_version(
244+
session_dir, Path(args.session).resolve(), args.version
245+
)
246+
workspace = outdir / "candidate"
247+
if workspace.exists():
248+
shutil.rmtree(workspace)
249+
extract_candidate(session_dir, version, workspace)
225250

226251
partition_file = build["partition_files"][args.partition]
227252
tasks = json.loads((build_path.parent / partition_file).read_text())
@@ -273,7 +298,8 @@ def main() -> int:
273298
if target.get("partition") == args.partition:
274299
pinned = target.get("baseline_reward")
275300
print()
276-
print(f" candidate {version[:12]}")
301+
label = "seed harness" if version == "seed" else f"candidate {version[:12]}"
302+
print(f" {label}")
277303
print(f" {args.partition:15s} n={len(pooled)} reward={reward:.4f} sd={sd:.4f}")
278304
print(f" rounds {' / '.join(f'{m:.3f}' for m in round_means)}")
279305
if pinned is not None:

0 commit comments

Comments
 (0)