# 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, `_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, `_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=` 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 --binary-dir ../../../PV-bench-with-backend/backend/binary/linux-binary ``` The build is recorded in `docker/images.json` as `pvbench-env:` 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://:` (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:` (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 --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