clawbench / README.md
pranav-near's picture
Add nearai-bench flat packaging (one row per task)
4b2ea78 verified
|
Raw
History Blame Contribute Delete
5.88 kB
---
license: apache-2.0
task_categories:
- text-generation
language:
- en
tags:
- agents
- agentic-benchmark
- evaluation
- clawbench
- tool-use
size_categories:
- n<1K
configs:
- config_name: default
data_files:
- split: train
path: data/train-*.parquet
---
# ClawBench (nearai-bench packaging)
A **flat, self-contained repackaging** of [ClawBench](https://github.com/claw-bench/claw-bench)
— 319 agent tasks across 35 domains, difficulty levels L1–L4. Task
content, environments and verifiers are **unmodified**, so scores stay
comparable to the upstream ClawBench leaderboard.
## Why this exists
Upstream ships a git repo of nested task directories
(`tasks/<domain>/<task>/{task.toml,instruction.md,environment/,verifier/,solution/}`).
Cloning that per worker is wasteful for an eval/RL harness. Here each task is
**one row**, with its three directory payloads as deterministic base64 `tar.gz`
blobs.
```python
from datasets import load_dataset
ds = load_dataset("NEAR-AI/clawbench", split="train")
```
## Columns
| Column | Type | Notes |
|---|---|---|
| `task_id` | string | Stable task id = the upstream task **directory** name (e.g. `acct-001-journal-entries`) |
| `upstream_id` | string | The `id` field inside `task.toml`. Often a short form (`sec-001`) that is **not** unique across domains — prefer `task_id` |
| `task_path` | string | `<domain>/<task_id>`, the task's path under upstream `tasks/` |
| `title` | string | Human-readable title |
| `domain` | string | One of 34 domains (`email`, `security`, `multi-agent`, …) |
| `level` | string | `L1``L4` difficulty |
| `track` | string | `foundation` \| `subject-matter`; empty when upstream omits it |
| `description` | string | One-line task description, when upstream supplies one |
| `timeout` | int64 | Upstream per-task budget (seconds) |
| `skills_allowed` | bool | Whether the task permits skill creation/reuse |
| `tags` | string (JSON) | Upstream tag list |
| `capabilities` | string (JSON) | e.g. `["tool-use"]` or `["file-read","file-write"]` — see note below |
| `capability_types` | string (JSON) | e.g. `["reasoning","tool-use"]` |
| `required_actions` | string (JSON) | e.g. `["file-read","data-processing","file-write"]` |
| `instruction` | string | **Verbatim `instruction.md`** — the agent-facing prompt |
| `task_toml` | string | **Verbatim `task.toml`** |
| `environment_tar` | string | base64(tar.gz) of `environment/``setup.sh` plus any `data/` seed files |
| `verifier_tar` | string | base64(tar.gz) of `verifier/` (pytest `test_output.py`) **plus a bundled `conftest.py`** |
| `solution_tar` | string | base64(tar.gz) of `solution/` — the reference `solve.sh` |
### Note on the two upstream `task.toml` shapes
Upstream is not uniform: 65 tasks nest their metadata under a `[task]` table,
the other 254 put the same keys at the top level — and the two shapes carve up
capabilities differently (`capabilities` + `required_actions` vs.
`capabilities` + `capability_types`). The flattened columns above normalize
both, and `task_toml` always holds the verbatim original. If you parse
`task_toml` yourself, handle both shapes or you will silently blank the
metadata of 80% of the suite.
## Running a task
```python
import base64, io, subprocess, tarfile, tempfile, pathlib
def untar(b64, dest):
if not b64: return
dest.mkdir(parents=True, exist_ok=True)
with tarfile.open(fileobj=io.BytesIO(base64.b64decode(b64)), mode="r:gz") as t:
t.extractall(dest)
row = ds[0]
tmp = pathlib.Path(tempfile.mkdtemp())
untar(row["environment_tar"], tmp / "environment")
untar(row["verifier_tar"], tmp / "verifier")
workspace = tmp / "workspace"; workspace.mkdir()
# 1. seed the workspace
subprocess.run(["bash", str(tmp / "environment/setup.sh"), str(workspace)], check=True)
# 2. give row["instruction"] to the agent, let it work in `workspace`
# 3. score with the upstream pytest verifier
subprocess.run(
["python", "-m", "pytest", "verifier/test_output.py", "--workspace", str(workspace), "-q"],
cwd=tmp,
)
```
`setup.sh` takes the workspace directory as `$1`. Pass an **absolute** path —
several scripts interpolate `$1` into a heredoc that runs with a different cwd,
so a relative path silently produces an empty workspace.
## Scoring
The verifier is pytest. Each test carries an `@pytest.mark.weight(n)` marker
(default `2.0`); the task score is
`sum(weight of passing tests) / sum(all weights)`. `conftest.py` — bundled into
every `verifier_tar` — provides both that marker and the `--workspace` option,
so a verifier run needs nothing else from the upstream repo.
Two things worth knowing if you compare numbers:
- The verifier imports `numpy`/`pandas` for some domains. A verifier
environment missing them yields false zeros rather than errors.
- The upstream leaderboard metric is a difficulty-weighted aggregate over a
5-dimension composite, not a flat mean of per-task scores.
A reference implementation lives in
[`nearai/benchmarks`](https://github.com/nearai/benchmarks) at
`src/adapters/clawbench.rs`.
## ⚠️ Contamination warning
`solution_tar` contains **reference solutions**. They are published upstream
too, and they are needed for golden-validation (a correct harness must score
1.0 when the solution is applied and ~0.0 on an empty workspace) — but do not
train on this column, and drop it before handing any of this to a model.
## Provenance & license
- **Upstream**: <https://github.com/claw-bench/claw-bench> — Apache-2.0.
Pinned commit `1fc25add8fe77aa498d58fb564ea91a87307da76`.
- **This repackaging**: Apache-2.0, same terms. Task content unmodified; only
the container format changed, plus a `conftest.py` copy bundled into each
`verifier_tar` for self-containment.
- **Packaged by**: [NEAR AI](https://near.ai) for
[nearai-bench](https://github.com/nearai/benchmarks).