Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/nullius/catalogue/benchmarks/arc-agi-2/benchmark.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
4 changes: 2 additions & 2 deletions app/nullius/catalogue/benchmarks/arc-agi-2/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]}}

Expand Down
41 changes: 41 additions & 0 deletions app/nullius/runs/attempts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions app/nullius/runs/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
15 changes: 14 additions & 1 deletion app/nullius/runs/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 —
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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),
Expand Down
6 changes: 4 additions & 2 deletions app/nullius/standard/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
8 changes: 6 additions & 2 deletions app/nullius/standard/pages/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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``).
Expand All @@ -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:
Expand All @@ -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"
Expand Down
Loading