TL;DR
Most coding benchmarks test whether an AI can fix a known bug or write a unit test for a concrete example. PBT-Bench tests a much subtler skill: reading a library’s documentation, figuring out the universal rules ("invariants") the code must always obey, and writing a targeted random-input generator (using Python’s Hypothesis library) to catch hidden semantic bugs. Across 100 curated problems, even top frontier models like Claude Sonnet 4.6 (83.4% recall) and Claude Opus 4.8 (81.2% recall) leave plenty of room for improvement—and two bugs are never reliably found by any model.
What Problem Does This Paper Address?
Writing a unit test is like checking that 2 + 2 = 4. Property-based testing (PBT) is different: you specify a property that must hold for all valid inputs (e.g., "sorting a list should always return a permutation of the original elements in non-decreasing order") and a strategy that generates random inputs to try to break it.
While LLMs excel at concrete input–output coding tasks, existing benchmarks (like SWE-bench, SWT-bench, or TestExplora) don't isolate PBT. They either give the agent a bug report, ask for a patch, or allow concrete example-based tests. Moreover, benchmarks mined from real-world pull requests are full of bugs that aren't suited for PBT (like UI glitches or network-ordering issues). To measure whether AI agents can actually do property-based testing, the authors needed a benchmark of bugs specifically designed to be caught by documentation-derived properties—and almost impossible to hit with naive random inputs.
Methods
The authors built an automated, two-container evaluation harness using the OpenHands SDK:
- Agent Container: The AI agent receives a buggy Python library, its documentation (the only oracle), and its existing passing test suite. The agent must write
/workspace/pbt_test.py. - Eval Container: Each problem contains one or more reversible bug patches (
bug_N.patch). The harness runs every test function the agent wrote against the buggy code, then reverses one patch at a time and re-runs. A bug is marked "found" if at least one test function fails on the buggy version and passes on the fixed version (Fail-to-Pass, or F→P).
They evaluated eight contemporary LLMs under two prompting regimes (three runs each, totaling 4,800 trajectories), plus post-review runs of Claude Opus 4.8 (on OpenHands and inside Claude Code):
- Baseline (open-ended): Tells the agent to understand the library and write a failing test, without mentioning PBT or Hypothesis.
- PBT (scaffolded): Explicitly instructs the agent to use Hypothesis
@givendecorators, teaches a property taxonomy (Roundtrip, Model-oracle, Invariant), and asks for at least five focused test functions covering the specification.
Datasets
The authors introduce PBT-Bench, consisting of:
- 100 curated problems across 40 real, pure-Python libraries spanning seven domains (serialization, data structures, date–time, type systems/schemas, numerics, state machines, and parsing/HTML).
- 365 injected semantic bugs (mean 3.65 per problem), all verified to pass the library's existing unit tests ("clean-pass criterion").
- Three difficulty tiers: L1 (87 bugs, 24% — single-constraint boundaries), L2 (184 bugs, 50% — multi-constraint triggers), and L3 (94 bugs, 26% — stateful, cross-function protocol violations).
Key Insights and Ideas
- The PBT–Baseline gap is behavioural, not just capability-based: Claude Opus 4.8 had the largest jump from Baseline to PBT (+41.9 percentage points). Why? Under the open-ended Baseline prompt, Opus 4.8 simply stopped after finding one bug (writing a median of 2 test functions vs. Sonnet 4.6's 8), hitting at least one bug on 96.5% of problems but finding all bugs on only 11.5%.
- Frontier models don't need a property taxonomy, but mid-tier models do: A controlled ablation showed that for Opus 4.8, simply telling it to use Hypothesis and "cover the specification" accounted for essentially all of its +41.5pp gain; the property taxonomy and template added +0.2pp. In contrast, mid-capability models like Qwen 3.6 Plus (+6.7pp) and DeepSeek V3.2 (+11.3pp) benefited noticeably from being taught which types of properties to look for.
- Baseline and PBT fail in completely different ways: Baseline tests mostly failed due to wrong expected values (59%) or overly concrete, hand-picked inputs (32%). PBT tests mostly failed due to search issues: misusing
hypothesis.assume()to accidentally filter out the bug-triggering inputs (31%), or choosing a strategy value range that missed the trigger region (31%). - No single model dominates the hardest bugs: Different model families solved different hard problems (such as finite-field arithmetic). Combining all 16 original model–prompt cells reliably covered 99.5% of all bugs.
Key Results
Table 1: Headline results on all 100 problems for PBT mode and Baseline mode
- Leaderboard (PBT Mode): Bug recall ranged from 42.1% (Grok 4.1 Fast) to 83.4% (Claude Sonnet 4.6). Claude Opus 4.8 reached 81.2% on OpenHands and 78.6% in Claude Code—meaning neither the newer frontier model nor the commercial scaffold saturated the benchmark.
- Full Recall ("Perfect"): Sonnet 4.6 found all bugs on 67.0% of problems in PBT mode, compared to 61.8% for Opus 4.8 (OpenHands) and 53.7% for Opus 4.8 (Claude Code).
- Difficulty Scaling: Averaged across the eight original models, recall dropped steadily with difficulty: 66% on L1, 60% on L2, and 51% on L3 (Opus 4.8: 88% / 83% / 76%).
- Unbeaten Bugs: Two of the 365 bugs (
BIDC-004 bug 3andTMLK-005 bug 1) were never reliably found (in $\ge 2$ of 3 runs) by any model or scaffold.
Limitations and Future Work
The authors note that curated, injected bugs trade some real-world population fidelity for PBT-testability, and the benchmark is currently limited to 100 problems in Python with English documentation. Additionally, the max_examples=200 Hypothesis budget likely caps recall on narrow-trigger L2/L3 bugs, and Codex CLI (GPT-5.5) could not be reported because it produced no test file in three pilot runs. Future work includes extending the language-agnostic pipeline to other languages, running a max_examples sweep, and designing prompts that explicitly warn agents against assume()-based filtering.
Summary updated