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
78 changes: 78 additions & 0 deletions app/nullius/catalogue/benchmarks/browsecomp/benchmark.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"key": "browsecomp",
"title": "BrowseComp",
"category": "Deep research",
"domain": "Hard-to-find facts on the web: questions that take persistent searching, each with one short answer that is easy to check.",
"scoring": "GPT-4.1 judge",
"harness": [
"standard"
],
"origin": "official",
"good_to_know": [
"Agents search the public web. Original asks a model alone, with no tools.",
"The upstream publishes questions and answers encrypted, to keep them out of training data. A task list shows topics only; a run's folder holds them decrypted, so do not publish a run, a trace or a page made from one.",
"The upstream sets no time limit and its questions take long searches: an agent gets an hour for each, unless the run sets another limit.",
"Like the paper offers the upstream's OpenAI models that the provider lists under their own ID. Another model, or one the provider names differently, runs as Any of your choice, asked as the listed model you choose."
],
"upstream_limitations": [
"As published, no answer counts as correct: the upstream compares the grader's whole verdict line with \"yes\". Its pull requests 67 and 93, both open, fix it. The Grading fix version runs the second.",
"Trainers who solved a question matched its reference answer 86.4% of the time, by the paper: some references may be wrong or not unique.",
"The published code scores accuracy only. The paper's calibration error and its voting over several attempts are not in it."
],
"limitations": [
"A limit takes the first questions of the file. The upstream's --examples draws a seeded random sample.",
"The upstream's three Claude models are not offered: they are asked through Anthropic's API while the grader is asked through OpenAI's, and a run has one provider.",
"A model call the provider refuses ends the question as an API error, with no score. The upstream grades its placeholder reply as a miss.",
"Runs and Compare show an Original run under its model ID: listed models that share one, such as o3 and o3_low, read alike there. A run's Reasoning setting replaces a listed model's own effort."
],
"datasets": [
{
"key": "browsecomp",
"title": "Test set",
"tasks": 1266,
"official": "https://github.com/openai/simple-evals",
"source": "OpenAI's public storage",
"registry": "",
"hub": "",
"verifier": "The upstream's own loop and grader, GPT-4.1 (gpt-4.1-2025-04-14). As published, it counts no answer correct.",
"notes": "1,266 questions in 10 topics, published encrypted. MIT License."
}
],
"citation": "@misc{wei2025browsecompsimplechallengingbenchmark,\n title={BrowseComp: A Simple Yet Challenging Benchmark for Browsing Agents}, \n author={Jason Wei and Zhiqing Sun and Spencer Papay and Scott McKinney and Jeffrey Han and Isa Fulford and Hyung Won Chung and Alex Tachard Passos and William Fedus and Amelia Glaese},\n year={2025},\n eprint={2504.12516},\n archivePrefix={arXiv},\n primaryClass={cs.CL},\n url={https://arxiv.org/abs/2504.12516}, \n}",
"citation_source": "https://arxiv.org/abs/2504.12516",
"task_count": 1266,
"evidence": [
{
"label": "Answer",
"path": "answer",
"reply": true
},
{
"label": "Judge said",
"path": "judge_said"
},
{
"label": "Upstream",
"path": "upstream",
"names": {
"is_correct": "Counted correct",
"is_incorrect": "Counted incorrect"
}
}
],
"versions": {
"grading-fix": {
"upstream_limitations": [
"The verdict is the first \"correct: yes\" or \"correct: no\" anywhere in the grader's reply, inside \"incorrect: no\" too. A yes spelt any other way, in bold or with a capital, counts as incorrect.",
"A judge call the provider refuses as a bad request raises no error: the answer counts as incorrect.",
"Trainers who solved a question matched its reference answer 86.4% of the time, by the paper: some references may be wrong or not unique.",
"The published code scores accuracy only. The paper's calibration error and its voting over several attempts are not in it."
],
"datasets": {
"browsecomp": {
"verifier": "The upstream's own loop and grader, GPT-4.1 (gpt-4.1-2025-04-14): correct or incorrect per answer."
}
}
}
}
}
241 changes: 241 additions & 0 deletions app/nullius/catalogue/benchmarks/browsecomp/driver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
"""BrowseComp's driver for the Nullius standard (JSON lines on stdin and stdout).

The upstream is OpenAI's simple-evals at the pinned commit ($NULLIUS_UPSTREAM): a
package with relative imports and a module named types.py, so it is imported as a
package, by its folder's name from the folder above it, never with its own folder
on sys.path.

units - one per row of the test set, named by its place in the file ("0001")
describe - each unit's topic, the one column the file publishes in clear; never
a question's text: a listing is kept on disk
setup - the question in the upstream's QUERY_TEMPLATE; the unit's environment
is the one that has the public web
answer - the original and model setups: the loop's first two calls for a row,
its QUERY_TEMPLATE asked once through the unit's relay by the sampler
simple_evals.py builds for the model's name (its --model): that row
of its models table, evaluated from its own source. A model of the
run's choice is asked by the row its Asked as option names
score - the upstream's own loop (BrowseCompEval.__call__) on the unit's one
row, given a sampler that hands it the answer already made: its
GRADER_TEMPLATE and grade_sample, asked through the grading sampler
simple_evals.py builds, on the unit's judge route. The reward is the
score that loop returns, nothing of ours added: at a commit whose
loop counts no answer correct, no answer passes
oracle - the reference control: the row's answer
preflight - each role's first request, made by the same samplers on a made-up
question and caught before it is sent

Questions and answers are published encrypted, each row with its canary. They are
decrypted in memory with the upstream's decrypt, when a unit is set up or scored,
and the driver writes none of them. The test set is $NULLIUS_DATASET, the file the
upstream downloads, checked by its sha256 and read with the upstream's own pandas
call; BrowseCompEval's __init__, which downloads it again at every start, is not run.
"""
import ast
import contextlib
import importlib
import json
import os
import sys

UP = os.path.normpath(os.environ["NULLIUS_UPSTREAM"])
sys.path.append(os.path.dirname(UP))


def upstream(module):
with contextlib.redirect_stdout(sys.stderr): # stdout carries the replies
return importlib.import_module(os.path.basename(UP) + "." + module)


EVAL = upstream("browsecomp_eval")
TYPES = upstream("types")
# simple_evals.py is read, never imported: it imports every eval of the repository and their packages, and its
# models table and grading sampler are local names of its main().
with open(os.path.join(UP, "simple_evals.py"), encoding="utf-8") as f:
MAIN = ast.parse(f.read())
ROWS = {}
QUESTION = "Compatibility check. Reply OK." # what preflight asks: never a question of the test set


def rows():
"""The test set's rows as BrowseCompEval.__init__ makes them, each under its place in the file."""
if not ROWS:
df = EVAL.pandas.read_csv(os.environ["NULLIUS_DATASET"])
ROWS.update({f"{n:04d}": row.to_dict() for n, (_, row) in enumerate(df.iterrows(), 1)})
return ROWS


def question(unit):
row = rows()[unit]
return EVAL.decrypt(row["problem"], row["canary"])


def assigned(name, kind):
"""The expression simple_evals.py's main() assigns to a name."""
for node in ast.walk(MAIN):
if isinstance(node, ast.Assign) and [ast.unparse(t) for t in node.targets] == [name] and isinstance(node.value, kind):
return node.value
raise RuntimeError(f"simple_evals.py no longer assigns {name} where the driver reads it")


def built(expression, base_url, key):
"""An expression of simple_evals.py that builds a sampler, evaluated as that file would - each name it uses
bound as the file imports it - on a route: its samplers make their client as OpenAI(), which reads both variables."""
os.environ["OPENAI_BASE_URL"], os.environ["OPENAI_API_KEY"] = base_url, key
names = {n.id for n in ast.walk(expression) if isinstance(n, ast.Name)}
bound = {alias.asname or alias.name: getattr(upstream(node.module), alias.name)
for node in MAIN.body if isinstance(node, ast.ImportFrom) and node.level == 1 and node.module
for alias in node.names if (alias.asname or alias.name) in names}
return eval(compile(ast.Expression(expression), "simple_evals.py", "eval"), bound)


def row_sampler(setup, model, base_url, key):
"""The sampler simple_evals.py builds for a model's name, as its --model does: that row of its models table.
The original's model is asked as itself. A model of the run's choice (the model setup, which is told the
row it runs as) is asked as the row its Asked as option names, when it names one."""
if setup not in ("original", "model"):
raise ValueError(f"BrowseComp has no {setup} setup")
name = os.environ.get("NULLIUS_OPTION_ASKED_AS", "default")
if setup == "original" and name not in ("default", model):
raise ValueError(f"{model} is a listed model, asked as itself: leave Asked as at default, or choose Any of your "
f"choice (the model setup) to ask a model as {name}")
table = assigned("models", ast.Dict)
table = {ast.literal_eval(k): v for k, v in zip(table.keys, table.values)}
name = model if name == "default" else name
if name not in table:
raise ValueError(f"simple_evals.py has no model {name}")
try:
return built(table[name], base_url, key)
except ImportError as e: # a row whose sampler needs a package the environment has not
raise ValueError(f"simple_evals.py asks {name} with a package the driver's environment has not: {e}") from None


def ask(sampler, question):
"""One question, as BrowseCompEval.__call__ asks its sampler: in its QUERY_TEMPLATE, one user message."""
return sampler([sampler._pack_message(content=EVAL.QUERY_TEMPLATE.format(Question=question), role="user")])


class Given(TYPES.SamplerBase):
"""Hands the upstream's loop an answer already made, where it would sample one."""

def __init__(self, text):
self.text = text

def _pack_message(self, role, content):
return {"role": str(role), "content": content}

def __call__(self, message_list):
return TYPES.SamplerResponse(response_text=self.text, actual_queried_message_list=message_list, response_metadata={})


class Heard(TYPES.SamplerBase):
"""The upstream's grading sampler, unchanged, its reply kept: the trial's evidence beside the score."""
reply = None

def __init__(self, sampler):
self.sampler = sampler

def _pack_message(self, **message):
return self.sampler._pack_message(**message)

def __call__(self, message_list):
self.reply = self.sampler(message_list)
return self.reply


def graded(examples, base_url, key):
"""BrowseCompEval over these rows, without its constructor (see the docstring), its grader the grading sampler
simple_evals.py builds: the judge's route sends the run's judge model in the place of the one it names."""
loop = EVAL.BrowseCompEval.__new__(EVAL.BrowseCompEval)
loop.examples = examples
loop.grader_model = Heard(built(assigned("grading_sampler", ast.Call), base_url, key))
return loop


def units(dataset, setup=None):
return {"units": list(rows())}


def describe(dataset=None, **_):
return {"units": {unit: {"categories": {"topic": row["problem_topic"]}} for unit, row in rows().items()}}


def setup(unit, dir, **_):
return {"prompt": EVAL.QUERY_TEMPLATE.format(Question=question(unit)), "environment": "web"}


def answer(unit, dir, setup, model, base_url, key, **_):
"""The original and model setups: one question, asked as BrowseCompEval.__call__ asks its sampler. The answer
is the reply as that loop hands it to its grader, whose template formats it: a reply with no content, which
the o-series sampler returns unchecked, reads None there, and is graded as that."""
reply = ask(row_sampler(setup, model, base_url, key), question(unit))
return {"answer": "{}".format(reply.response_text), "model": model}


def score(unit, dir, transcript, answer, judge=None, setup=None, **_):
if not judge:
raise ValueError("BrowseComp is graded by a judge model, and none was given")
loop = graded([rows()[unit]], judge["base_url"], judge["key"])
result = loop(Given(answer if isinstance(answer, str) else ""))
said = loop.grader_model.reply
return {"reward": float(result.score), "passed": bool(result.score == 1),
"detail": {"judge": judge["model"], "judge_said": said.response_text if said else "",
"upstream": {k: bool(v) for k, v in result.metrics.items() if ":" not in k},
"topic": rows()[unit]["problem_topic"]}}


def oracle(unit, dir):
row = rows()[unit]
return {"answer": EVAL.decrypt(row["answer"], row["canary"])}


def preflight(participant, model, roles, setup=None, **_):
"""Each role's first request as the upstream's own sampler makes it, on a made-up question, with no
network: the client's send is cut, so nothing leaves. A setup's model is asked as answer asks it, the judge
as grade_sample asks it; an agent's own request is not the upstream's, and is left unchecked."""
import httpx
from unittest.mock import patch

class Captured(BaseException): # not an Exception: the samplers retry those without end
def __init__(self, request):
self.request = {"path": request.url.raw_path.decode(), "body": json.loads(request.content)}

def send(client, request, **kw):
raise Captured(request)

nowhere = ("http://127.0.0.1:9/v1", "nullius-relay")
asks = {"judge": lambda: graded([], *nowhere).grade_sample(QUESTION, "OK", "OK")}
if participant == "setup":
asks["agent"] = lambda: ask(row_sampler(setup, model, *nowhere), QUESTION)
requests = []
with patch.object(httpx.Client, "send", send):
for role in roles:
if role not in asks:
continue
try:
asks[role]()
except Captured as captured:
requests.append(dict(captured.request, role=role))
else:
raise RuntimeError(f"{role}: the upstream's sampler returned without a request")
return {"requests": requests}


HANDLERS = {"units": units, "describe": describe, "setup": setup, "answer": answer, "score": score, "oracle": oracle,
"preflight": preflight}


def main():
replies = sys.stdout
for line in sys.stdin:
try:
request = json.loads(line)
with contextlib.redirect_stdout(sys.stderr): # the upstream prints its metrics and its retries
reply = HANDLERS[request.pop("op")](**request)
except Exception as e:
reply = {"error": f"{type(e).__name__}: {e}"}
print(json.dumps(reply, ensure_ascii=False), file=replies, flush=True)


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# The base image unchanged: the environment only says its agents need the public web.
Loading