diff --git a/app/nullius/catalogue/benchmarks/arc-agi-2/benchmark.json b/app/nullius/catalogue/benchmarks/arc-agi-2/benchmark.json
index 8220ad989..f7530faa0 100644
--- a/app/nullius/catalogue/benchmarks/arc-agi-2/benchmark.json
+++ b/app/nullius/catalogue/benchmarks/arc-agi-2/benchmark.json
@@ -21,7 +21,7 @@
"ARC Prize's leaderboard and competition score models on semi-private and private tasks that are not published. Only the 120 public evaluation tasks run here, and a model may have seen them."
],
"limitations": [
- "An agent answers each test input once, and its score is the mean over the 167 test inputs. ARC Prize counts either of two answers and takes the mean over the 120 tasks: an agent's score does not compare with the harness's. Several attempts of an agent are averaged.",
+ "An agent answers each test input once by default. With two attempts, Grouped best of 2 reports the mean over tasks of each input's best answer, following ARC Prize's scoring rule. The headline remains the mean over individual attempts; partial runs cover only their observed inputs.",
"Original offers 56 of ARC Prize's 139 model configurations: Anthropic's 23 and 33 of OpenAI's, not the 24 in OpenAI's background mode, GPT-5.1 and GPT-5.2 among them. Google's, OpenRouter's and the other providers' are not offered.",
"Original runs each task once: a test input left with no answer scores 0. Upstream, running the batch again fills it.",
"The network does not block a web search the model's provider runs: each agent needs its own switch to turn web search off, for a fair comparison."
diff --git a/app/nullius/catalogue/benchmarks/arc-agi-2/driver.py b/app/nullius/catalogue/benchmarks/arc-agi-2/driver.py
index dd6b01dfc..99f470ad5 100644
--- a/app/nullius/catalogue/benchmarks/arc-agi-2/driver.py
+++ b/app/nullius/catalogue/benchmarks/arc-agi-2/driver.py
@@ -217,10 +217,10 @@ def score(unit, dir, transcript, answer, setup=None, **_):
_, results = scored(task, [{"attempt_1": attempt_record(task, k, answer or "")}])
except ValidationError as e: # its parser found no grid, or its schema refused what it found
why = "; ".join(str(x.get("msg")) for x in e.errors())[:300]
- return {"reward": 0.0, "detail": {"grid": None, "expected": expected, "unread": why, "answer": said,
+ return {"reward": 0.0, "group": task, "detail": {"grid": None, "expected": expected, "unread": why, "answer": said,
"dataset_revision": SOURCE["revision"]}}
attempt = results[0][0]
- return {"reward": 1.0 if attempt.correct else 0.0,
+ return {"reward": 1.0 if attempt.correct else 0.0, "group": task,
"detail": {"grid": json.dumps(attempt.answer), "expected": expected, "answer": said,
"dataset_revision": SOURCE["revision"]}}
diff --git a/app/nullius/runs/attempts.py b/app/nullius/runs/attempts.py
index 45e4dc649..ecd39810a 100644
--- a/app/nullius/runs/attempts.py
+++ b/app/nullius/runs/attempts.py
@@ -256,3 +256,44 @@ def readable(tasks: Iterable[Sequence]) -> list:
def for_job(job) -> dict | None:
"""``for_tasks`` over a parsed job, its tasks by ``_task``; None for a job with scores and no pass or fail."""
return None if job.scored_only else for_tasks(_by_task_name(job).values())
+
+
+def score_summary(rows, repeat: int | None = None) -> dict | None:
+ """Mean and best score per unit, then equal-weight means over driver groups.
+
+ Rows are (unit, group, score); None scores include failed/unscored attempts.
+ Only units with exactly K finite scores count. K is the configured repeat,
+ or the largest observed count for older records. A group counts only when
+ all its observed units qualify and agree on their group across attempts.
+ This is descriptive best-of-K, not a pass@k estimator or a headline mean.
+ """
+ from math import isfinite
+ per = {}
+ for unit, group, score in rows:
+ group = group if isinstance(group, str) else None
+ per.setdefault(unit, []).append((group, score))
+ if not per:
+ return None
+ k = repeat or max(map(len, per.values()))
+ good = {u: vs for u, vs in per.items() if len(vs) == k and
+ all(type(s) in (int, float) and isfinite(s) for _, s in vs)}
+ if not good:
+ return None
+ mean = lambda vs: sum(vs) / len(vs)
+ values = {u: (mean([s for _, s in vs]), max(s for _, s in vs)) for u, vs in good.items()}
+ out = {"attempts": k, "units": len(good), "excluded_units": len(per) - len(good),
+ "mean": mean([v[0] for v in values.values()]), "best": mean([v[1] for v in values.values()])}
+ groups, invalid = {}, set()
+ for u, vs in per.items():
+ names = {g for g, _ in vs}
+ if len(names) != 1 or None in names or "" in names or u not in good:
+ invalid.update(names)
+ for g in names:
+ if g:
+ groups.setdefault(g, []).append(u)
+ eligible = {g: us for g, us in groups.items() if g not in invalid}
+ if eligible:
+ out.update(groups=len(eligible), excluded_groups=len(groups) - len(eligible),
+ grouped_mean=mean([mean([values[u][0] for u in us]) for us in eligible.values()]),
+ grouped_best=mean([mean([values[u][1] for u in us]) for us in eligible.values()]))
+ return out if k > 1 or eligible else None
diff --git a/app/nullius/runs/cli.py b/app/nullius/runs/cli.py
index f631b6a76..8be097845 100644
--- a/app/nullius/runs/cli.py
+++ b/app/nullius/runs/cli.py
@@ -111,6 +111,7 @@ def job_detail(job: parse.Job) -> dict:
data["harbor_label"] = job.harbor_label
data["mean_score"] = job.mean_score
data["mean_score_planned"] = job.mean_score_planned
+ data["score_summary"] = job.score_summary
data["complement"] = job.complement
for trial, raw in zip(job.trials, data["trials"]):
raw["outcome_label"] = trial.outcome_label
@@ -334,6 +335,13 @@ def _show(args) -> int:
mix = " · ".join(f"{k} {v}" for k, v in row["counts"].items() if v)
if mix:
print(f" outcomes: {mix}")
+ summary = job.score_summary
+ if summary:
+ print(f" score over {summary['units']} complete units: mean {summary['mean']:.4f}, best of {summary['attempts']} {summary['best']:.4f}"
+ f" ({summary['excluded_units']} units excluded)")
+ if summary.get("groups"):
+ print(f" mean over {summary['groups']} driver groups: mean {summary['grouped_mean']:.4f}, best of {summary['attempts']} {summary['grouped_best']:.4f}"
+ f" ({summary['excluded_groups']} groups excluded)")
if job.mean_score is not None:
planned = job.mean_score_planned
print(f" mean score {job.mean_score:.2f} over the trials scored"
diff --git a/app/nullius/runs/parse.py b/app/nullius/runs/parse.py
index 03a53e82f..ba952ac08 100644
--- a/app/nullius/runs/parse.py
+++ b/app/nullius/runs/parse.py
@@ -34,7 +34,7 @@
# The shape this module produces. A workspace caches parsed Jobs keyed on it,
# so bump it when a Trial or Job field is added, renamed or means something
# new — otherwise a cache written by the old parse is read back as current.
-SCHEMA = "33"
+SCHEMA = "34"
# What a rate-limit record in `agent/gateway.log` looks like. The agent's SDK
# retries a 429 below the harness, so a limit the run survived leaves nothing in result.json —
@@ -391,6 +391,8 @@ class Trial:
# The unit a standard trial ran, as its benchmark names it (`standard.unit`): its task
# name turns a `/` into `-`, so two units can share one name. None when the trial records none or an empty one.
unit: str | None = None
+ # The driver's task key for means over groups of scored units; absent in older records.
+ score_group: str | None = None
# The benchmark and its version as the trial's own record says them (`standard.benchmark`,
# `standard.benchmark_version`): a merged job's own may be another's. "" when it records none, or one
# redaction would change: two redacted names read alike.
@@ -699,6 +701,16 @@ def mean_score(self):
scored = [(t.score, t.n_parts or 1) for t in self.trials if t.score is not None]
return sum(s * n for s, n in scored) / sum(n for _, n in scored) if scored else None
+ @property
+ def score_summary(self):
+ """Additional score means and best-of-K, shared by the page and command."""
+ from . import attempts
+ if not self.scored_only:
+ return None
+ repeat = (self.identity.get("limits") or {}).get("repeat")
+ return attempts.score_summary([(t.unit if t.unit is not None else t.task_name, t.score_group,
+ None if t.exception_type else t.score) for t in self.trials], repeat)
+
@property
def complement(self) -> dict:
"""The trials' second score (``Trial.complement``), weighed by its parts as ``mean_score`` is:
@@ -1013,6 +1025,7 @@ def parse_trial(job_id: str, trial_dir: str) -> Trial | None:
outcome=outcome,
reward=reward,
score=score,
+ score_group=ver_res.get("group") if isinstance(ver_res.get("group"), str) else None,
part_groups=part_groups,
parts_by=parts_by,
complement=_complement(ver_res),
diff --git a/app/nullius/standard/cli.py b/app/nullius/standard/cli.py
index 2851830e3..99f8a97c9 100644
--- a/app/nullius/standard/cli.py
+++ b/app/nullius/standard/cli.py
@@ -9,7 +9,7 @@
PYTHONPATH=app python3 -m nullius.standard.cli conform AGENT|MODULE --model M [--provider P] [--port PORT ...] [--attempts K] [--option NAME=VALUE ...] [--unsandboxed | --backend container | --backend boat]
PYTHONPATH=app python3 -m nullius.standard.cli run BENCHMARK[@VERSION] AGENT|MODULE --model M [--provider P] [--units FILE] [--limit N] [-j N] [--option NAME=VALUE ...] [--bench-option NAME=VALUE ...] [--price MODEL=INPUT,OUTPUT[,CACHED,WRITE,WRITE_1H][/TOKENS=INPUT,OUTPUT...] ...] [--max-usd USD] [--max-usd-per-unit USD] [--timeout PHASE=SECONDS ...] [--max-turns N] [--max-calls N] [--constraint KEY=VALUE ...] [--served-by [MODEL=]SLUG[,SLUG...] ...] [--exchanges whole|text|off] [--exchanges-max-mb N] [--unsandboxed | --backend container | --backend boat [--boat-size SIZE]]
PYTHONPATH=app python3 -m nullius.standard.cli run BENCHMARK[@VERSION] nop|oracle [--dataset D] [--units FILE] [--limit N]
- PYTHONPATH=app python3 -m nullius.standard.cli prove BENCHMARK[@VERSION] [--dataset D] [--limit N] [--bench-option NAME=VALUE ...] [--job nop|oracle=JOB_DIR ...]
+ PYTHONPATH=app python3 -m nullius.standard.cli prove BENCHMARK[@VERSION] [--dataset D] [--units FILE] [--limit N] [--bench-option NAME=VALUE ...] [--job nop|oracle=JOB_DIR ...]
PYTHONPATH=app python3 -m nullius.standard.cli run ... --shard I/N [--launch ID]
PYTHONPATH=app python3 -m nullius.standard.cli merge JOB_DIR... -o OUT [--force]
PYTHONPATH=app python3 -m nullius.standard.cli set create|list|show|rename|delete|import ...
@@ -1202,7 +1202,8 @@ def cmd_prove(a):
got = prove.prove(b, dataset=a.dataset, limit=a.limit, jobs_root=a.jobs, provider=a.provider, judge_model=a.judge_model,
stamp=a.stamp, concurrency=a.concurrency, say=print, shard=_shard(a.shard), launch=a.launch,
env=run_env(a.provider) if a.from_run else None, licences=held,
- bench_options=options(a.bench_option), jobs=jobs, remove_images=a.remove_images)
+ bench_options=options(a.bench_option), jobs=jobs, remove_images=a.remove_images,
+ units_file=run.units_file(a.units) if a.units else None)
except run.Refused as e:
print("refused:", e)
return 2
@@ -1669,6 +1670,7 @@ def main(argv=None):
v = sub.add_parser("prove", help="prove a benchmark: its controls, its units, no leak; record what passed")
v.add_argument("benchmark")
v.add_argument("--dataset", help="one dataset (default: each)")
+ v.add_argument("--units", metavar="FILE", help="selected units, one id a line; recorded separately from dataset proofs")
v.add_argument("--limit", type=int, help="the first N units of each dataset (the record says so)")
v.add_argument("--provider", default="openai", choices=sorted(providers.PROVIDERS), help="a judged benchmark's: the judge's provider")
v.add_argument("--judge-model", help="a judged benchmark: this judge instead of its official one")
diff --git a/app/nullius/standard/pages/recipe.py b/app/nullius/standard/pages/recipe.py
index 0b6b8145a..87322c2d4 100644
--- a/app/nullius/standard/pages/recipe.py
+++ b/app/nullius/standard/pages/recipe.py
@@ -238,6 +238,7 @@ def _bench_page(b: dict) -> dict:
"subset_of": d.get("subset_of") or "",
"controls": [dict(c, **{k: status[d["id"]][c["key"]][k] for k in ("proven", "short", "failed")})
for c in controls],
+ "selections": prove.selections_of(b, d["id"]),
"proofs": {k: status[d["id"]][k]["proven"] for k in ("units", "leak")},
"failed": {k: status[d["id"]][k]["failed"] for k in ("units", "leak") if status[d["id"]][k]["failed"]},
# the user's task sets cut from it (standard/runner/sets.py), each with the version it was made at;
@@ -1380,7 +1381,7 @@ def conformance(kind: str, key: str, *, model: str, provider: str, unsandboxed:
def proving(benchmark: str, *, dataset: str = "", limit=None, provider: str = "openai", judge_model: str = "",
- stamp: str, concurrency: int = 4) -> dict:
+ stamp: str, concurrency: int = 4, units_file: str = "") -> dict:
"""The proof a benchmark's page starts: ``cli prove`` over one dataset or each - its
units, the leak check and every control it declares - as one command,
the control jobs it will write named ahead (``prove.job_name``).
@@ -1396,6 +1397,8 @@ def proving(benchmark: str, *, dataset: str = "", limit=None, provider: str = "o
sets = [d for d in b["datasets"] if dataset in ("", d["id"])]
if not sets:
errors.append(f"Choose one of {b['label']}'s datasets, or each of them.")
+ if units_file and len(sets) > 1:
+ errors.append("--units selects one dataset: name it (--dataset)")
if limit not in ("", None) and _int(limit, 1) is None:
errors.append(f"Number of {(b.get('units') or {}).get('nouns', 'units')}: a whole number of at least 1, or empty for all.")
if _int(concurrency, 1, MAX_CONCURRENT) is None:
@@ -1409,7 +1412,8 @@ def proving(benchmark: str, *, dataset: str = "", limit=None, provider: str = "o
if errors:
return {"errors": errors, "script": "", "jobs": [], "label": b["label"], "keyless": False}
words = ["nullius", "standard", "prove", definitions.ref_of(b), *(["--dataset", dataset] if dataset else []),
- *(["--limit", str(limit)] if isinstance(limit, int) else []), *(["--provider", provider] if judged else []),
+ *(["--limit", str(limit)] if isinstance(limit, int) else []),
+ *(["--units", units_file] if units_file else []), *(["--provider", provider] if judged else []),
*(["--judge-model", judge_model] if judged and judge_model else []), "-j", str(concurrency), "--stamp", stamp, "--from-run"]
command = " ".join(shlex.quote(w) for w in words) + ' --jobs "${NULLIUS_JOBS:-jobs_standard}"'
script = ("#!/usr/bin/env bash\n"
diff --git a/app/nullius/standard/proofs/prove.py b/app/nullius/standard/proofs/prove.py
index f85be4cdb..fd22e7a61 100644
--- a/app/nullius/standard/proofs/prove.py
+++ b/app/nullius/standard/proofs/prove.py
@@ -41,6 +41,7 @@
"""
from __future__ import annotations
+import hashlib
import json
import math
import os
@@ -235,7 +236,7 @@ def control_check(bench: dict, ds: dict, which: str, *, limit: Optional[int], jo
provider: str, model: str, judge_model: Optional[str], env, concurrency: int,
say: Callable[[str], None], shard: Optional[tuple] = None, launch: Optional[str] = None,
licences=None, options: Optional[dict] = None, job_dir: Optional[str] = None,
- ids: Optional[List[str]] = None, remove_images: bool = False) -> dict:
+ ids: Optional[List[str]] = None, remove_images: bool = False, units_file: Optional[dict] = None) -> dict:
"""Run one control over the dataset (or its first ``limit`` units, of
``shard`` when given) and hold it to its bound: the pass rate, or the mean score.
``job_dir``: a control run already, held to the bound instead; it must cover ``ids``."""
@@ -249,7 +250,7 @@ def control_check(bench: dict, ds: dict, which: str, *, limit: Optional[int], jo
job_dir = run.run(bench, other, model=model, provider=provider, dataset=ds["id"], limit=limit, concurrency=concurrency,
jobs_root=jobs_root, name=job_name(stamp, definitions.job_word(bench), ds["id"], which, shard),
say=lambda s: say(" " + s), env=env, judge_model=judge_model, shard=shard, launch=launch,
- licences=licences, bench_options=options,
+ licences=licences, bench_options=options, units_file=units_file,
remove_images=remove_images, retries=1, retry_if=retries.rate_limited)
cfg = {}
field = FIELD[bench["score"]["kind"]]
@@ -393,7 +394,7 @@ def prove(bench: dict, *, dataset: Optional[str] = None, limit: Optional[int] =
env=None, concurrency: int = 4, write: bool = True, say: Callable[[str], None] = print,
shard: Optional[tuple] = None, launch: Optional[str] = None, licences=None,
bench_options: Optional[dict] = None, jobs: Optional[Dict[str, str]] = None,
- remove_images: bool = False) -> Dict[str, dict]:
+ remove_images: bool = False, units_file: Optional[dict] = None) -> Dict[str, dict]:
"""Every check on every dataset (or ``dataset``); with ``write``, what
passed is recorded in the benchmark version's ``proofs.json`` evidence.
``shard`` (I, N): the leak check and the controls cover that shard's units only,
@@ -401,6 +402,8 @@ def prove(bench: dict, *, dataset: Optional[str] = None, limit: Optional[int] =
``remove_images``: each unit's own image is removed after it, so the
oracle pulls it again (by default they stay). Returns
{dataset: {check: record}}, each record with ``ok`` and its ``problems``.
+ ``units_file``: run.units_file output; controls and leak cover those ids.
+ Their records live under selections, never replacing dataset evidence.
``jobs``: {control: job directory}, held to its bound instead of run."""
env = env if env is not None else os.environ
stamp = stamp or time.strftime(STAMP)
@@ -408,6 +411,8 @@ def prove(bench: dict, *, dataset: Optional[str] = None, limit: Optional[int] =
sets = [d for d in bench["datasets"] if dataset in (None, d["id"])]
if not sets:
raise run.Refused(f"{bench['label']} has no dataset {dataset!r}: {[d['id'] for d in bench['datasets']]}")
+ if units_file and len(sets) > 1:
+ raise run.Refused("--units selects one dataset: name it (--dataset)")
declared = [c for c in definitions.CONTROLS if c in (bench.get("controls") or {})]
if jobs:
if dataset is None and len(sets) > 1:
@@ -434,9 +439,18 @@ def prove(bench: dict, *, dataset: Optional[str] = None, limit: Optional[int] =
raise run.Refused(f"could not install what the proof needs: {e}")
checks["units"] = units_check(driver, ds)
every = ids = checks["units"].pop("ids")
+ if units_file:
+ unknown = set(units_file["units"]) - set(every)
+ if unknown:
+ raise run.Refused("--units lists ids outside the dataset: " + ", ".join(sorted(unknown)))
+ chosen = set(units_file["units"])
if shard and shard[1] > 1:
ids = [u for _, u in shards.select(ids, *shard)]
+ if units_file:
+ ids = [u for u in ids if u in chosen]
ids = ids[:limit] if limit else ids
+ if units_file:
+ say(f" selected {len(ids)} units from {units_file['name']} (sha256 {units_file['sha256']})")
_say(say, "units", checks["units"])
if "oracle" in declared and ids:
checks["leak"] = leak_check(driver, ids, bench["family"], bench["controls"]["oracle"].get("in_prompt") or "")
@@ -451,7 +465,8 @@ def prove(bench: dict, *, dataset: Optional[str] = None, limit: Optional[int] =
checks[c] = control_check(bench, ds, c, limit=limit, jobs_root=jobs_root, stamp=stamp, provider=provider,
model=model, judge_model=judge_model, env=env, concurrency=concurrency, say=say,
shard=shard if shard and shard[1] > 1 else None, launch=launch, licences=licences,
- options=opts[ds["id"]], job_dir=jobs.get(c), ids=every,
+ options=opts[ds["id"]], job_dir=jobs.get(c), ids=ids if units_file else every,
+ units_file=units_file,
remove_images=remove_images)
if not checks["units"]["ok"]:
checks[c]["problems"].append(UNITS_FAILED + ", so this job cannot be checked against the dataset")
@@ -459,6 +474,8 @@ def prove(bench: dict, *, dataset: Optional[str] = None, limit: Optional[int] =
_say(say, c, checks[c])
total = ds.get("units") if isinstance(ds.get("units"), int) else checks["units"]["units"]
for name, r in checks.items():
+ if units_file and name != "units":
+ r["selection"] = dict(units_file, selected=ids)
if limit and name != "units" and limit < total:
r["limit"] = limit
if shard and shard[1] > 1 and name != "units":
@@ -489,20 +506,32 @@ def _unnamed(r: dict) -> dict:
"""A check's record without the units it names: the leak check's first
prompts that name their answer, and a failed check's problems."""
r = dict(r, problems=[])
+ if "selection" in r:
+ selection = r["selection"]
+ r["selection"] = {k: v for k, v in selection.items() if k not in ("units", "selected", "name")}
+ r["selection"]["count"] = len(selection["selected"])
if "in_prompt" in r:
r["in_prompt"] = {k: v for k, v in r["in_prompt"].items() if k != "first"}
return r
-def _merged(proven: dict, got: Dict[str, dict]) -> dict:
+def _merged(proven: dict, got: Dict[str, dict], selection_scope: bool = False) -> dict:
proven = dict(proven)
for ds, checks in got.items():
cur = dict(proven.get(ds) or {})
+ selections = dict(cur.pop("selections", None) or {})
+ selected = {name: r for name, r in checks.items() if r.get("selection") and not selection_scope}
+ if selected:
+ first = next(iter(selected.values()))
+ identity = {k: first.get(k) for k in ("selection", "limit", "shard")}
+ key = hashlib.sha256(json.dumps(identity, sort_keys=True).encode()).hexdigest()
+ selections[key] = _merged({ds: selections.get(key, {})}, {ds: selected}, selection_scope=True)[ds]
+ checks = {name: r for name, r in checks.items() if name not in selected}
failed = dict(cur.pop("failed", None) or {})
for name, r in checks.items():
if not r["ok"]:
cur.pop(name, None)
- failed[name] = {k: r[k] for k in ("passed", "value", "expect", "units", "limit", "shard") if k in r}
+ failed[name] = {k: r[k] for k in ("passed", "value", "expect", "units", "limit", "shard", "selection") if k in r}
failed[name]["problems"] = list(r.get("problems") or [])[:3]
continue
failed.pop(name, None)
@@ -510,8 +539,9 @@ def _merged(proven: dict, got: Dict[str, dict]) -> dict:
if old and old.get("units", 0) > r.get("units", 0):
continue
cur[name] = {k: v for k, v in r.items() if k not in ("ok", "problems", "job")}
- if cur or failed:
- proven[ds] = {**{k: cur[k] for k in CHECKS if k in cur}, **({"failed": failed} if failed else {})}
+ if cur or failed or selections:
+ proven[ds] = {**{k: cur[k] for k in CHECKS if k in cur}, **({"failed": failed} if failed else {}),
+ **({"selections": selections} if selections else {})}
else:
proven.pop(ds, None)
return proven
@@ -542,6 +572,19 @@ def short_of(rec: Optional[dict], expect: dict) -> str:
return f"{_pct(rec['value'])}, " + (f"at most {_pct(v)} allowed" if bound == "at_most" else f"at least {_pct(v)} needed")
+def selections_of(bench: dict, dataset: str) -> list:
+ """Selected evidence with its common provenance, for the benchmark page."""
+ records = ((bench.get("proven") or {}).get(dataset, {}).get("selections") or {}).values()
+ out = []
+ for checks in records:
+ evidence = [r for name, r in checks.items() if name in CHECKS] + list((checks.get("failed") or {}).values())
+ if evidence:
+ out.append({"selection": evidence[0].get("selection") or {}, "checks": checks,
+ "short": {name: short_of(rec, rec.get("expect") or {"at_least": 1})
+ for name, rec in checks.items() if name in definitions.CONTROLS}})
+ return out
+
+
def status(bench: dict) -> Dict[str, Dict[str, dict]]:
"""Per dataset, each control the benchmark declares - its source, where it
comes from, its bound and what it must score - and whether it is proven on
diff --git a/app/nullius/standard/runner/job.py b/app/nullius/standard/runner/job.py
index 2ed983635..f256a6208 100644
--- a/app/nullius/standard/runner/job.py
+++ b/app/nullius/standard/runner/job.py
@@ -532,6 +532,8 @@ def write_trial(trial_dir: str, *, job: str, bench: dict, other: dict, model: st
# benchmark a score and no pass or fail - the trial reads as Scored
rewards = {"reward": value} if bench["score"]["kind"] == "pass" else {"score": value}
res["verifier_result"] = {"rewards": rewards}
+ if isinstance(score.get("group"), str) and score["group"]:
+ res["verifier_result"]["group"] = score["group"]
if score.get("stopped"):
res["verifier_result"]["stopped"] = str(score["stopped"])
also = score.get("complement")
@@ -737,23 +739,36 @@ def pass_hat(results: List[dict]) -> Optional[dict]:
"at": {str(k): round(v, 4) for k, v in got["at"].items()}}
+def score_summary(results: List[dict], repeat: Optional[int] = None) -> Optional[dict]:
+ """The shared score attempt summary, from stored standard trial records."""
+ from nullius.runs import attempts
+ if not any("score" in ((r.get("verifier_result") or {}).get("rewards") or {}) for r in results):
+ return None
+ return attempts.score_summary([
+ ((r.get("standard") or {}).get("unit", r.get("task_name")),
+ (r.get("verifier_result") or {}).get("group"),
+ None if r.get("exception_info") else ((r.get("verifier_result") or {}).get("rewards") or {}).get("score"))
+ for r in results], repeat)
+
+
def n_retries(results: List[dict]) -> int:
"""The retries a job's attempts took, all together: Harbor's ``stats.n_retries``, from each trial's ``standard.retries``."""
return sum(int((r.get("standard") or {}).get("retries") or 0) for r in results)
def write_result(job_dir: str, job: str, t0: float, t1: float, results: List[dict], planned: int, budget: Optional[dict] = None,
- served: Optional[dict] = None):
+ served: Optional[dict] = None, repeat: Optional[int] = None):
"""``budget``: a run with a spending cap (``run.Run.budget``): the cap,
what was spent, whether it stopped the run, the units it cut off and
those never begun. ``served``: who served the benchmark's own relay's
calls (:func:`served`); the job's ``served`` adds its trials' to them."""
errored = sum(1 for r in results if r.get("exception_info"))
hat = pass_hat(results)
+ scores = score_summary(results, repeat)
who = served_total(results, served)
ondisk.write_whole(os.path.join(job_dir, "result.json"), json.dumps({"id": job, "started_at": iso(t0), "finished_at": iso(t1), "n_total_trials": planned,
"stats": {"n_completed_trials": len(results) - errored, "n_errored_trials": errored,
"n_cancelled_trials": planned - len(results), "n_running_trials": 0, "n_pending_trials": 0,
"n_retries": n_retries(results)},
- **({"pass_hat_k": hat} if hat else {}), **({"budget": budget} if budget else {}),
+ **({"pass_hat_k": hat} if hat else {}), **({"score_summary": scores} if scores else {}), **({"budget": budget} if budget else {}),
**({"served": who} if who else {})}, indent=1))
diff --git a/app/nullius/standard/runner/merge.py b/app/nullius/standard/runner/merge.py
index b65936e73..34ad0f9fc 100644
--- a/app/nullius/standard/runner/merge.py
+++ b/app/nullius/standard/runner/merge.py
@@ -314,6 +314,9 @@ def result_of(shards: list, results: List[dict]) -> dict:
budget["spent_total_usd"] = sum(spent)
if unknown:
budget.update(spent_usd=None, spent_unknown=unknown)
+ repeat = max(((s.get("config") or {}).get("standard") or {}).get("repeat") or
+ (s["result"].get("score_summary") or {}).get("attempts") or 1 for s in shards)
+ summary = job.score_summary(results, repeat)
# ISO stamps in UTC sort as their instants
return {"started_at": min(starts) if starts else None, "finished_at": max(ends) if ends else None,
"n_total_trials": planned,
@@ -322,6 +325,7 @@ def result_of(shards: list, results: List[dict]) -> dict:
"n_retries": job.n_retries(results)},
"standard": {"passed": sum(1 for w in rewards if w.get("reward") == 1.0),
"scored": len(scores), "mean_score": job.mean_score(results)},
+ **({"score_summary": summary} if summary else {}),
**({"budget": budget} if budget else {})}
diff --git a/app/nullius/standard/runner/rerun.py b/app/nullius/standard/runner/rerun.py
index f0d388c79..6822f87b1 100644
--- a/app/nullius/standard/runner/rerun.py
+++ b/app/nullius/standard/runner/rerun.py
@@ -716,6 +716,10 @@ def write(ended: List[dict], budget: Optional[dict]) -> None:
now = {name: merge._read(os.path.join(job_dir, name, "result.json")) for name in merge._trials(job_dir)}
every = list(now.values())
out = dict(old, **{k: v for k, v in merge.result_of([{"result": old, "trials": list(now)}], every).items() if k != "budget"})
+ out.pop("score_summary", None)
+ summary = job.score_summary(every, r.repeat)
+ if summary:
+ out["score_summary"] = summary
if r.repeat > 1:
hat = job.pass_hat(every)
out.pop("pass_hat_k", None)
diff --git a/app/nullius/standard/runner/run.py b/app/nullius/standard/runner/run.py
index 9701ee37d..e83da3d2b 100644
--- a/app/nullius/standard/runner/run.py
+++ b/app/nullius/standard/runner/run.py
@@ -1443,7 +1443,7 @@ def _start(self, lck, mine) -> str:
for pos, (i, u, r) in enumerate(work):
self.feed.emit("trial.queued", self.trial_name(i, u, r), agent=job.agent_name(self.other), position=pos)
results, budget, u0 = self.run_units(first, lambda results, budget: job.write_result(
- self.job_dir, self.name, t0, time.time(), results, len(work), budget=budget,
+ self.job_dir, self.name, t0, time.time(), results, len(work), budget=budget, repeat=self.repeat,
served=job.served(self.benchmark_calls(), getattr(self, "serving", None))))
# the units' stage says why it ended early: a line of its own would be a stage that never starts
p.emit("units", "done", seconds=round(time.time() - u0, 1),
diff --git a/app/templates/catalogue/benchmark.html b/app/templates/catalogue/benchmark.html
index 982e9ee94..e5020a2e5 100644
--- a/app/templates/catalogue/benchmark.html
+++ b/app/templates/catalogue/benchmark.html
@@ -59,7 +59,7 @@
Overview
{% if std %}
{#- The standard's proofs of it, per dataset (standard/proofs/prove.py): its controls as chips, their source in the title, then its units and leak checks; and Prove it, cli prove as a run. -#}
{% macro proof(rec, failed, expect, short='') -%}
- {%- if rec %}{% set notes = [short, ('over the first ' ~ rec.limit) if rec.limit, ('shard ' ~ rec.shard) if rec.shard]|select|list %} {{ rec.passed }}{% if rec.limit %} · first {{ rec.limit }}{% endif %}
+ {%- if rec %}{% set notes = [short, ('over the first ' ~ rec.limit) if rec.limit, ('shard ' ~ rec.shard) if rec.shard, ('selected from ' ~ (rec.selection.name or 'units file') ~ ' · sha256 ' ~ rec.selection.sha256) if rec.selection]|select|list %} {{ rec.passed }}{% if rec.limit %} · first {{ rec.limit }}{% endif %}
{%- elif failed and failed.value is defined %}{% set e = (failed.expect or expect or {'at_least': 1}) %}{% set k = e|list|first %} {{ failed.value }} {{ '>' if k == 'at_most' else '<' }} {{ e[k] }}
{%- elif failed %} not proven
{%- else %}not run{% endif -%}
@@ -86,6 +86,14 @@
Overview
{%- for c in d.controls if c.proven and c.proven.job in std_jobs %}{{ c.key }}'s job{% endfor %}
+ {% for selection in d.selections %}
+
Selected units{% if selection.selection.name %}{{ selection.selection.name }}{% endif %}
+ {% for name in ['leak', 'nop', 'oracle'] %}
+ {% set rec = selection.checks.get(name) %}{% set failed = (selection.checks.failed or {}).get(name) %}
+ {% if rec or failed %}{{ name }}{{ proof(rec, failed, short=selection.short.get(name, '')) }}{% endif %}
+ {% endfor %}
+
+ {% endfor %}
{% endfor %}
@@ -104,6 +112,7 @@
Overview
{% else %}
{% endif %}
+
{% if s.judged %}
{% if providers %}{% endif %}
diff --git a/app/templates/runs/job.html b/app/templates/runs/job.html
index 2353f6921..9527d5acf 100644
--- a/app/templates/runs/job.html
+++ b/app/templates/runs/job.html
@@ -389,6 +389,15 @@
{% if job.budget and job.budget.unit_max_usd %}
Cap per {{ job.runner_items[0] if job.runner_items else 'trial' }}{{ job.budget.unit_max_usd|cap }}
{% if job.budget.over_unit %}
{{ job.budget.over_unit|length }} reached it
{% for u in job.budget.over_unit %}{{ u }}{% endfor %}
{% endif %}{% endif %}
+ {% set scores = job.score_summary %}
+ {% if scores %}
+
Mean over units{{ '%.4f'|format(scores.mean) }}
+
Best of {{ scores.attempts }}{{ '%.4f'|format(scores.best) }}