Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,93 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
pretty_name: SpecGuardBench
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
task_categories:
|
| 7 |
+
- text-generation
|
| 8 |
+
tags:
|
| 9 |
+
- code
|
| 10 |
+
- software-engineering
|
| 11 |
+
- test-generation
|
| 12 |
+
- coding-agents
|
| 13 |
+
- benchmark
|
| 14 |
+
size_categories:
|
| 15 |
+
- n<1K
|
| 16 |
+
configs:
|
| 17 |
+
- config_name: default
|
| 18 |
+
data_files:
|
| 19 |
+
- split: full
|
| 20 |
+
path: data/full-*
|
| 21 |
+
- split: lite
|
| 22 |
+
path: data/lite-*
|
| 23 |
---
|
| 24 |
+
|
| 25 |
+
# SpecGuardBench
|
| 26 |
+
|
| 27 |
+
SpecGuardBench measures whether a coding agent can build a reliable validation harness from a natural-language specification. A task gives the agent one atomic specification of a feature, the repository, and a reference implementation. The agent writes a scenario generator (`build_cases()`) and executable checks (`check_case(case)`). The harness is run against implementations that satisfy the specifications and violate them. A faithful harness rejects the violating implementation and accepts the gold implementation and every valid alternative. Meanwhile it should achieve high coverage.
|
| 28 |
+
|
| 29 |
+
The tasks are built on 30 feature instances of [FeatureBench](https://huggingface.co/datasets/LiberCoders/FeatureBench) from 13 Python repositories.
|
| 30 |
+
|
| 31 |
+
| Split | Tasks | Instances |
|
| 32 |
+
|---|---|---|
|
| 33 |
+
| `full` | 291 | 30 |
|
| 34 |
+
| `lite` | 100 | 30 |
|
| 35 |
+
|
| 36 |
+
The Lite Set is a stratified sample of the Full Set
|
| 37 |
+
|
| 38 |
+
## Loading
|
| 39 |
+
|
| 40 |
+
```python
|
| 41 |
+
from datasets import load_dataset
|
| 42 |
+
|
| 43 |
+
full = load_dataset("coxhin/SpecGuardBench", split="full")
|
| 44 |
+
lite = load_dataset("coxhin/SpecGuardBench", split="lite")
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
## Fields
|
| 48 |
+
|
| 49 |
+
Each record is one task.
|
| 50 |
+
|
| 51 |
+
| Field | Content |
|
| 52 |
+
|---|---|
|
| 53 |
+
| `schema_version` | record format version (3) |
|
| 54 |
+
| `instance_id` | FeatureBench instance |
|
| 55 |
+
| `spec` | the atomic specification: `spec_id`, `text`, `category`, and `code_mapping` (the gold code it maps to, which the agent is not shown) |
|
| 56 |
+
| `mask_patch` | FeatureBench's patch that removes the feature from the repository |
|
| 57 |
+
| `gold_patch` | the gold implementation: the reverse of `mask_patch`, without the fail-to-pass test files |
|
| 58 |
+
| `mutant_patch` | the violating implementation, as a patch on top of the gold implementation |
|
| 59 |
+
| `test_patch` | FeatureBench's patch that deletes the instance's fail-to-pass test files |
|
| 60 |
+
| `proof.case_contract` | the case contract: the format of a test scenario and how the checks must call the target |
|
| 61 |
+
| `metadata.preservation_probes` | the tasks that take this violating implementation as a valid alternative; each entry gives that task's `spec_id` and how many functions and lines the gold code of the two specifications shares (`shared_functions`, `shared_lines`) |
|
| 62 |
+
|
| 63 |
+
The agent is given `spec.spec_id`, `spec.category`, `spec.text` and `proof.case_contract`, together with a repository that holds the reference implementation. The other fields build that repository and score the harness.
|
| 64 |
+
|
| 65 |
+
The valid alternative implementations of a task are the violating implementations of other tasks in the same instance whose `metadata.preservation_probes` list the task. The evaluation scores up to three per task, those sharing the most code with it.
|
| 66 |
+
|
| 67 |
+
`mask_patch`, `gold_patch` and `test_patch` are the same for every task of an instance.
|
| 68 |
+
|
| 69 |
+
## Files
|
| 70 |
+
|
| 71 |
+
| Path | Content |
|
| 72 |
+
|---|---|
|
| 73 |
+
| `data/full-*.parquet` | the `full` split |
|
| 74 |
+
| `data/lite-*.parquet` | the `lite` split |
|
| 75 |
+
| `raw/full_set.jsonl` | the 291 tasks as JSON lines, with the same fields; the evaluation pipeline reads this file |
|
| 76 |
+
| `raw/lite_set.tsv` | the Lite Set as tab-separated `instance_id` and `spec_id` pairs |
|
| 77 |
+
| `raw/instances.jsonl` | the 30 FeatureBench instances |
|
| 78 |
+
|
| 79 |
+
The construction record of each task, including its differential witness, is in `data/full_set.jsonl` of the code repository.
|
| 80 |
+
|
| 81 |
+
## Running the evaluation
|
| 82 |
+
|
| 83 |
+
The evaluation pipeline is at [github.com/coxhin/SpecGuardBench](https://github.com/coxhin/SpecGuardBench). It reads the files under `raw/`:
|
| 84 |
+
|
| 85 |
+
```bash
|
| 86 |
+
hf download coxhin/SpecGuardBench --repo-type dataset --include "raw/*" --local-dir .
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
Pass `raw/full_set.jsonl` as `MUTATION_OUTPUT`, and `raw/lite_set.tsv` as `SPEC_SUBSET` for the Lite Set. The Lite Set is also evaluated from `raw/full_set.jsonl`, because the valid alternatives of a task come from other tasks of its instance. Each task runs in the FeatureBench image of its instance (`docker.io/libercoders/featurebench-specs_*`), and the pipeline reads instance metadata from `LiberCoders/FeatureBench`.
|
| 90 |
+
|
| 91 |
+
## License
|
| 92 |
+
|
| 93 |
+
MIT. The patches contain code from the 13 upstream repositories, which remains under each repository's own license.
|