SpecGuardBench / README.md
coxhin's picture
Update README.md
72b8b73 verified
|
Raw History Blame Contribute Delete
4.39 kB
metadata
license: mit
pretty_name: SpecGuardBench
language:
  - en
task_categories:
  - text-generation
tags:
  - code
  - software-engineering
  - test-generation
  - coding-agents
  - benchmark
size_categories:
  - n<1K
configs:
  - config_name: default
    data_files:
      - split: full
        path: data/full-*
      - split: lite
        path: data/lite-*

SpecGuardBench

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.

The tasks are built on 30 feature instances of FeatureBench from 13 Python repositories.

Split Tasks Instances
full 291 30
lite 100 30

The Lite Set is a stratified sample of the Full Set

Loading

from datasets import load_dataset

full = load_dataset("coxhin/SpecGuardBench", split="full")
lite = load_dataset("coxhin/SpecGuardBench", split="lite")

Fields

Each record is one task.

Field Content
schema_version record format version (3)
instance_id FeatureBench instance
spec the atomic specification: spec_id, text, category, and code_mapping (the gold code it maps to, which the agent is not shown)
mask_patch FeatureBench's patch that removes the feature from the repository
gold_patch the gold implementation: the reverse of mask_patch, without the fail-to-pass test files
mutant_patch the violating implementation, as a patch on top of the gold implementation
test_patch FeatureBench's patch that deletes the instance's fail-to-pass test files
proof.case_contract the case contract: the format of a test scenario and how the checks must call the target
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)

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.

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.

mask_patch, gold_patch and test_patch are the same for every task of an instance.

Files

Path Content
data/full-*.parquet the full split
data/lite-*.parquet the lite split
raw/full_set.jsonl the 291 tasks as JSON lines, with the same fields; the evaluation pipeline reads this file
raw/lite_set.tsv the Lite Set as tab-separated instance_id and spec_id pairs
raw/instances.jsonl the 30 FeatureBench instances

The construction record of each task, including its differential witness, is in data/full_set.jsonl of the code repository.

Running the evaluation

The evaluation pipeline is at github.com/coxhin/SpecGuardBench. It reads the files under raw/:

hf download coxhin/SpecGuardBench --repo-type dataset --include "raw/*" --local-dir .

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.

License

MIT. The patches contain code from the 13 upstream repositories, which remains under each repository's own license.