Datasets:
|
Download experiments/README.md from PV-SJTU/PV-Bench: direct link, hf CLI and curl.
- Browser
- Download file 17.9 kB
-
https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/experiments/README.md
- Command line
-
hf download hf://datasets/PV-SJTU/PV-Bench/experiments/README.md
-
curl -L -o README.md https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/experiments/README.md
17.9 kB
| # Experiments | |
| The harnesses that run models on PV-Bench's three tasks (see [The three tasks](../README.md#the-three-tasks)) | |
| and on their combination T4, one `uv` project each. Every harness gives the model an isolated, | |
| sandboxed workspace with only the task's inputs, records the run's provenance, and checks the | |
| answer with the proof assistant. This page is the runbook: from a fresh clone to a batch and | |
| its report. The per-task READMEs are the reference for each harness. | |
| | Task | Harness | The model writes | Checked by | Agent budget | | |
| |---|---|---|---|---| | |
| | T1 — Spec | [`t1/`](t1/README.md) | the entry-point contract (`solution_spec.c`, `spec_lib.v`) | a judge session proves or refutes both directions of equivalence with the gold contract, in Coq | 30 min | | |
| | T2 — Annotate | [`t2/`](t2/README.md) | `solution_annotated.c`, plus any headers and Rocq libraries it needs | QCP regenerates the VCs; a judge session proves the residual ones or refutes one | 60 min | | |
| | T3 — Prove | [`t3/`](t3/README.md) | the manual proofs, `<case>_proof_manual.v` (or `.lean` with `--backend lean`) | a clean rebuild of the generated `goal_check` (Lean: plus the axiom audit) | 30 min + 5 min per manual VC goal, at least 45 min, no ceiling | | |
| | T3-flat — Prove one VC | [`t3-flat/`](t3-flat/README.md) | the proof of one manual VC goal, `<case>_proof_manual.v` reduced to that lemma (plus `proof_lib.v`) | a clean rebuild, then the fixed target check types the lemma against the goal constant and audits its assumptions | 10 min per VC | | |
| | T4 — Annotate and prove | [`t4/`](t4/README.md) | T2's answer plus the proofs, `answer/proof/manual.v` and `proof_lib.v` | T2's evaluation, then the judge verifier in proof mode on the model's own proofs; no model judges | 180 min | | |
| Judge sessions (T1, T2) get 60 minutes. Every budget is `agent_timeout_s` in the task's | |
| `task.toml` (T3: a per-problem budget instead, see `t3/budget.py`), recorded in each run manifest; a timed-out session is a scored attempt, not an | |
| error. The limits are measured in awake time: a laptop that sleeps pauses the containers too. | |
| ## 1. Host setup, once | |
| Everything that touches an answer runs in Docker containers from one image; the host only | |
| assembles workspaces, reads results and, for T1 and T3, runs the host `symexec` to generate | |
| fixed inputs. In order: | |
| 1. **Docker.** On macOS, Colima: `colima start --cpu 8 --memory 18` (the sizes the batches | |
| below assume; the image needs about 10 GB of disk). Keep every run directory under `$HOME`, the only tree Colima | |
| shares with its VM; the defaults do. Docker Desktop works too. | |
| 2. **No Coq on the host.** Every `symexec` and `coqc` run, including the generation of the | |
| fixed inputs, happens in the image (Coq 8.20.1). The host needs Docker, Python 3.11+, | |
| `make` and `git` on Linux or macOS (Windows: inside WSL2). | |
| 3. **The QCP backend checkout the image is built from.** The `with-backend` branch carries | |
| it at `backend/`; check it out beside this repository (the examples below assume | |
| `../PV-bench-with-backend/backend`) and export `QCP_BACKEND=<that path>` whenever you | |
| run a harness. Only its Rocq load-path mappings are read; they must match the image. | |
| 4. **`benchmarks/CONFIGURE`**: copy `benchmarks/CONFIGURE.example`, set `QCP_ROCQ` to the | |
| backend's `Rocq/`. T1 and T3 read the Rocq load path from the benchmarks Makefile; a | |
| missing file is reported with this hint. | |
| 5. **The `pvbench-env` image.** Build it from a `with-backend` commit and that commit's | |
| Linux binaries (`symexec`, `StrategyCheck`, under `backend/binary/linux-binary/`): | |
| ```sh | |
| cd experiments/t3 && uv sync | |
| uv run t3 image build --commit <with-backend rev> --binary-dir ../../../PV-bench-with-backend/backend/binary/linux-binary | |
| ``` | |
| The build is recorded in `docker/images.json` as `pvbench-env:<commit12>` and every | |
| harness resolves the image as `PVBENCH_IMAGE`, then `image`/`IMAGE` in its `CONFIGURE`, | |
| then the latest record. The image is amd64 (Apple Silicon runs it under Rosetta), about | |
| 17 GB, and holds Coq, Lean 4.25.2, the backend's Rocq and Lean libraries prebuilt | |
| (Mathlib from its olean cache), `symexec`, and pinned `codex` and `claude` CLIs; the gold | |
| answers are never in it (QCP's own `LLM_bench` Lean examples are pruned at build time). | |
| The build needs network access to GitHub (git clone of Mathlib), the Mathlib cache and | |
| nodejs.org; build steps do not inherit the daemon's proxy, so on a host that needs one | |
| pass `--proxy http://<proxy as seen from the Docker VM>:<port>` (colima: `host.lima.internal`). | |
| 6. **The harnesses.** `uv sync` in each of `t1/`, `t2/`, `t3/`, `t3-flat/`, `t4/`; copy each | |
| `CONFIGURE.example` (T1, T3) or `config.example.toml` (T2, T4) to the gitignored | |
| `CONFIGURE` / `CONFIGURE.toml` and point `benchmark`/`backend` at your checkouts. T4 reads | |
| a T2-shaped file plus a `[t4]` table; T3-flat reads T3's `CONFIGURE`. | |
| 7. **Credentials.** Default mode `host-login`: `codex login` once on the host (the harness | |
| copies `~/.codex/auth.json` into each attempt for the duration of the session), and for | |
| Claude run `claude setup-token` and export the token as `CLAUDE_CODE_OAUTH_TOKEN`. Mode | |
| `api-key` (`PVBENCH_AUTH=api-key`) uses `OPENAI_API_KEY` / `ANTHROPIC_API_KEY` instead. | |
| Mode `none` (`PVBENCH_AUTH=none` or `--auth none`) requires no vendor credential at all: | |
| use it when a pass-through provider (step 9) brings its own key through `--agent-env`; | |
| the CLI home is still prepared, nothing is copied. Never copy a personal `auth.json` to a | |
| shared machine. Codex judges also need `~/.codex/models_cache.json`, written by a codex | |
| session on the host. | |
| 8. **Egress.** Containers reach only the hosts in `task.toml` `egress_allow` through a | |
| logging proxy sidecar. The sidecar runs from the task image itself, so there is one | |
| pinned image and nothing is pulled at run time; each manifest records the sidecar's | |
| image id, and `docker/egress/proxy.py` is part of every harness fingerprint. | |
| If the host itself reaches the model APIs through a local proxy, | |
| set `PVBENCH_EGRESS_UPSTREAM=http://127.0.0.1:<port>` (or `EGRESS_UPSTREAM` / | |
| `egress_upstream` in the harness configuration); `env-check` prints the upstream it uses. | |
| 9. **Pass-through (optional).** The harness knows the agent CLIs, not model endpoints. To | |
| point a CLI somewhere else, pass the CLI's own configuration through, Harbor-style; the | |
| harness forwards it unchanged and records it in the manifest. Four repeatable flags on | |
| `run` / `run-all`, each also an environment variable for a whole batch: | |
| `--agent-config KEY=VALUE` (`PVBENCH_AGENT_CONFIG`, newline-separated: the CLI's own | |
| override, codex `-c`, claude `--settings`), `--agent-env NAME` (`PVBENCH_AGENT_ENV`, | |
| comma-separated: a host variable copied into the attempt container under the same name, | |
| its value redacted, its name recorded), `--egress-allow HOST` (`PVBENCH_EGRESS_ALLOW`) and | |
| `--egress-direct HOST` (`PVBENCH_EGRESS_DIRECT`: an allowed host reached without the | |
| upstream proxy). For example, codex against a Responses-API gateway: | |
| ```sh | |
| uv run t3 run Algorithms/choir_singing <model> --mask x \ | |
| --agent-config 'model_provider="gw"' \ | |
| --agent-config 'model_providers.gw.base_url="https://gw.example/v2"' \ | |
| --agent-config 'model_providers.gw.env_key="GW_API_KEY"' \ | |
| --agent-config 'model_providers.gw.wire_api="responses"' \ | |
| --agent-env GW_API_KEY --egress-allow gw.example --egress-direct gw.example | |
| ``` | |
| Attempts get all four; judges get only the allowlist. There is one sidecar (and one | |
| internal network) per configuration: the names carry the operator's uid and a hash of the | |
| allowlist, upstream, direct hosts, image and proxy script, so sessions with the same | |
| configuration share a sidecar, and batches with different configurations (another | |
| allowlist, another task image, another operator) run side by side without replacing each | |
| other's. A sidecar no container has used for an hour is removed by the next session of | |
| its operator; sidecar setup is serialized under a host lock, so sessions may start together. | |
| ## 2. Check the setup without a model | |
| Each harness has `env-check`: image id, daemon resources, the jobs cap, the container user, | |
| toolchain probe, three egress probes (allowed host, denied host, no proxy) and a write probe | |
| through a bind mount. Containers run as the host user's uid:gid, so files they write are | |
| yours; `PVBENCH_CONTAINER_USER=uid:gid` overrides it (never root). Rootless Docker, where | |
| the host user maps to container root, is not supported. Then the oracle path, which runs | |
| the whole pipeline with the gold answer and must succeed on every case: | |
| ```sh | |
| export QCP_BACKEND=../PV-bench-with-backend/backend # from the repository root | |
| cd experiments/t1 && uv run t1 selfeval --all # every gold spec: obligations generated and type-checked | |
| cd ../t2 && uv run t2 run Algorithms/climbing_stairs --oracle && uv run t2 eval Algorithms/climbing_stairs --model _oracle | |
| cd ../t3 && uv run t3 selfeval --all --calibrate # every gold proof builds; records peak memory and time | |
| uv run t3 selfeval --all --backend lean # the Lean gold proofs against fresh Lean VCs | |
| cd ../t3-flat && uv run t3flat run Algorithms/climbing_stairs::climbStairs_entail_wit_1 --oracle && uv run t3flat eval Algorithms/climbing_stairs::climbStairs_entail_wit_1 _oracle | |
| cd ../t4 && uv run t4 run Algorithms/climbing_stairs --oracle && uv run t4 eval Algorithms/climbing_stairs --model _oracle | |
| ``` | |
| Expected: T1 `223/223 ok`, T2 `JUDGE_READY` or `ACCEPT`, T3 all `OK`, T3-flat `ACCEPT`, T4 `ACCEPT` with | |
| `proof_status: proved`. The T3 calibration is what the `task.toml` memory and evaluator | |
| limits are set from. | |
| ## 3. Run an experiment | |
| Every harness has the same shape: `run` one case or `run-all` a list, `eval`/`eval-all`, | |
| a judge step where the task needs one, and `report`. A case list is one benchmark-relative | |
| case per line, `#` comments allowed; the frozen evaluation set of each task is | |
| `eval_sets/v1.txt`. `--mask <label>` names an attempt and suffixes its directory | |
| (`<case>_Pass@<label>`); runs are never overwritten, choose a new mask for another attempt. | |
| `--jobs N` runs N sessions at a time, capped by what the daemon can hold. | |
| ```sh | |
| # T1: spec, then obligations, then the judge (a second model session; pass --judge-model, the default may not be in your account) | |
| cd experiments/t1 | |
| uv run t1 run-all eval_sets/v1.txt gpt-5.6-sol --runner codex --mask r1 --jobs 2 | |
| uv run t1 eval-all eval_sets/v1.txt gpt-5.6-sol --mask r1 --jobs 2 | |
| uv run t1 judge-all eval_sets/v1.txt gpt-5.6-sol --mask r1 --judge-model gpt-5.6-sol --jobs 2 | |
| uv run t1 report gpt-5.6-sol --mask r1 | |
| # T2: annotations, then deterministic evaluation, then the judge on JUDGE_READY cases | |
| cd ../t2 | |
| uv run t2 run-all eval_sets/v1.txt --runner codex --model gpt-5.6-sol --mask r1 --jobs 2 | |
| uv run t2 eval-all eval_sets/v1.txt --model gpt-5.6-sol --mask r1 --jobs 2 | |
| uv run t2 judge-all eval_sets/v1.txt --model gpt-5.6-sol --mask r1 --judge-model gpt-5.6-sol --judge-mask r1 | |
| uv run t2 report gpt-5.6-sol --mask r1 | |
| # T3: proofs, then the clean rebuild; no judge | |
| cd ../t3 | |
| uv run t3 run-all eval_sets/v1.txt gpt-5.6-sol --runner codex --mask r1 --jobs 2 | |
| uv run t3 eval-all eval_sets/v1.txt gpt-5.6-sol --mask r1 --jobs 2 | |
| uv run t3 report gpt-5.6-sol --mask r1 | |
| # the same task against the Lean 4 backend (81 cases, results under runs/lean, evals/lean) | |
| uv run t3 run-all eval_sets/lean-v1.txt gpt-5.6-sol --backend lean --runner codex --mask l1 --jobs 2 | |
| uv run t3 eval-all eval_sets/lean-v1.txt gpt-5.6-sol --backend lean --mask l1 --jobs 2 | |
| uv run t3 report gpt-5.6-sol --backend lean --mask l1 | |
| # T3-flat: one VC per attempt over the frozen pool (4,581 cases), the same list syntax | |
| cd ../t3-flat | |
| uv run t3flat run-all eval_sets/v1.txt gpt-5.6-sol --runner codex --mask r1 --jobs 4 | |
| uv run t3flat eval-all eval_sets/v1.txt gpt-5.6-sol --mask r1 --jobs 4 | |
| uv run t3flat report gpt-5.6-sol --mask r1 | |
| # T4: annotations and proofs in one session, then T2's evaluation plus the proof verification | |
| cd ../t4 | |
| uv run t4 run-all eval_sets/v1.txt --runner codex --model gpt-5.6-sol --mask r1 --jobs 2 | |
| uv run t4 eval-all eval_sets/v1.txt --model gpt-5.6-sol --mask r1 --jobs 2 | |
| uv run t4 report gpt-5.6-sol --mask r1 | |
| ``` | |
| The Claude runner is `--runner claude --model claude-sonnet-5` (T2/T4) or | |
| `--runner claude claude-sonnet-5` (T1/T3), with the token from step 7 exported. A formal | |
| pass@1 run freezes the eval-set version, the reference pool (`t1/examples.txt`), prompt, | |
| guide, image, `task.toml`, model and reasoning setting, and runs every case exactly once; | |
| anything else is a diagnostic run under a mask. The T3 and T4 eval sets exclude the | |
| reference pool, whose cases the model sees with their complete proofs; a harness refuses to | |
| run a pool case. | |
| Transport and auth failures are retried up to three times with the failed trace kept; a | |
| genuine timeout is never retried. `run --dry-run` prepares the workspace and prints the | |
| `docker run` command without starting a model. | |
| ## 4. Capacity and operations | |
| - **Sessions per machine.** Each session is capped at 2 CPUs and 6 to 8 GB; `env-check` | |
| prints the jobs cap for the task. The memory caps are ceilings: a session uses a few | |
| hundred MB most of the time and spikes only during Coq builds, so on an 8-CPU, 18 GiB | |
| VM four sessions of mixed tasks run comfortably (CPU is the binding limit). | |
| - **One driver per case list.** A second `run-all` on the same list and mask does not | |
| coordinate with the first: each `run` deletes and recreates the run directory of a case | |
| that has no status file yet, so two drivers reaching the same case destroy each other's | |
| session. Split a list into disjoint parts, or queue the second driver behind the first. | |
| - **Stopping and resuming.** Stop a batch by its process tree (driver, then its `run` | |
| children, then `docker kill` of their `pvbench-attempt-*` containers), never by a text | |
| pattern that may match a launcher's command line. A relaunched `run-all` skips every case | |
| that has a status file and redoes the ones that do not; `eval-all` skips existing verdicts | |
| unless `--force`. | |
| - **Laptops.** Wrap long batches in `caffeinate -i`; it prevents idle sleep but not a closed | |
| lid. The budgets count awake time, so a sleep lengthens wall clock but not the model's | |
| budget. | |
| - **Resources on disk.** Runs and evaluations are git-ignored: `t1/runs`, `t1/evals`, | |
| `t3/runs`, `t3/evals`, and `~/.cache/pvbench/{t2,t4}/{runs,evals,judges}` by default. A | |
| T2 or T4 run keeps its whole workspace for audit; a batch of 50 T4 cases is a few GB. | |
| ## 5. Reading results | |
| Each `report` tabulates one model's runs under a mask: run status, run validity, verdict, | |
| time, tokens, calls. The verdict vocabularies: | |
| | Task | Accepted | Rejected by evidence | Undecided or incomplete | Not the model's fault | | |
| |---|---|---|---|---| | |
| | T1 | EQUIVALENT | TOO-WEAK, TOO-STRONG, INCOMPARABLE (checked refutations) | UNDECIDED (judge gave up) | INVALID (run validity), INFRA_ERROR | | |
| | T2 | ACCEPT (automatic, or judge proved) | REJECT (judge refuted one VC), INVALID (source rules) | JUDGE_READY (not yet judged), UNRESOLVED | COMPILE_FAIL / SYMEXEC_FAIL are the model's; INFRA_ERROR is not | | |
| | T3 | ACCEPT | FAILED (proof does not build) | OTL (timed out with an incomplete proof) | INVALID (run validity) | | |
| | T4 | ACCEPT (`automatic` or `proved`) | INVALID (source rules, or an admission in the proof) | PROOF_INCOMPLETE | COMPILE_FAIL / SYMEXEC_FAIL are the model's; INFRA_ERROR is not | | |
| Run validity (`check`, `run-validity.txt`) is about provenance, isolation, completion and | |
| fixed inputs, never about answer quality; a run that is not valid is excluded, not scored. | |
| Every accept rests on a kernel-checked build in a fresh container and an assumption audit | |
| against the task's trust basis; every refutation is a Coq proof of the negation of the | |
| exact generated proposition. A run whose status says `memory_limit` with exit code 0 was | |
| flagged by Docker because some child process in the container was killed for memory while | |
| the session itself finished; its answer is evaluated normally. | |
| Where to look when a verdict needs explaining (every directory is | |
| `<model>/<group>/<case>_Pass@<mask>`): T1 `t1/evals/.../evidence/judge/`; T2 | |
| `judges/.../<judge>_Pass@<judge mask>/out/` and `verification/`; T3 | |
| `t3/evals/.../evidence/build/build.stderr.log`; T4 `evals/.../proof/verification/check-0/` | |
| (`sources/` holds the proofs that were checked, `evidence/` the build). | |
| ## 6. Tests and more | |
| Each harness has a pure test suite (`python3 -m unittest discover -s tests`; no Docker, no | |
| model) and opt-in container tests gated by `PVBENCH_IMAGE`. The shared container package is | |
| `common/pvbench_common`; the egress proxy is `docker/egress/proxy.py`; the agent CLI pins are | |
| `docker/agents/`. The reference READMEs: [T1](t1/README.md), [T2](t2/README.md), | |
| [T3](t3/README.md), [T4](t4/README.md). | |
| **Agent CLIs.** Everything the harness knows about a CLI lives in one adapter under | |
| `common/pvbench_common/agents/` (`codex.py`, `claude.py`): the attempt command line, the | |
| judge command line (the CLI restricted to T2's MCP broker), the credential flow for both | |
| auth modes, the instructions file it reads (`AGENTS.md` / `CLAUDE.md`), the reasoning | |
| efforts it accepts, its installer under `docker/agents/`, and the readers of its trace | |
| (`last_message.md`, `usage.json`, the API-error and completion checks, the tool-call audit). | |
| The tasks only ask the adapter, so `--runner` and `task.toml` `runners` accept exactly the | |
| registered names. To add a CLI: write its adapter and register it in `agents/__init__.py`, | |
| add its installer and a version ARG to `docker/Dockerfile` and rebuild the image, and list | |
| the hosts it talks to in each task's `egress_allow`. | |