← Latest papers
💻 computer science

PBT-Bench: Benchmarking AI Agents on Property-Based Testing

This paper introduces PBT-Bench, a benchmark of 100 curated problems across 40 Python libraries designed to evaluate AI agents' ability to derive semantic invariants from documentation and construct targeted input-generation strategies for property-based testing, revealing that while explicit scaffolding aids mid-capability models, significant performance gaps and model-specific failures persist even for the strongest LLMs.

Original authors: Lucas Jing, Xinqi Wang, Liao Zhang, Simon S. Du

Published 2026-05-18
📖 5 min read🧠 Deep dive

Original authors: Lucas Jing, Xinqi Wang, Liao Zhang, Simon S. Du

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are hiring a team of detectives (AI agents) to find hidden flaws in a massive library of software tools.

Usually, when we test these detectives, we give them a specific clue: "There is a broken lock on door number 5; go fix it." Or, we say, "Here is a specific key that doesn't work; write a test to prove it."

But PBT-Bench asks a much harder question. It says: "Here is the library's instruction manual. Read it. Figure out the rules that the software should follow (like 'a sorted list must always stay sorted'). Then, invent a machine that randomly generates millions of different scenarios to see if it can trick the software into breaking those rules."

This is called Property-Based Testing (PBT). It's not about finding one specific broken key; it's about building a machine that shakes the software until it reveals its secrets.

Here is a breakdown of what the paper did, using simple analogies:

1. The Problem: The "Specific Clue" Trap

Most previous tests for AI were like giving a detective a specific photo of a crime scene and asking, "Did you see this?"

  • The Limitation: If the AI just memorized the photo, it passes. But real software bugs are sneaky. They only show up under very specific, weird conditions (like a specific combination of rain, wind, and a specific type of shoe).
  • The Gap: Existing tests didn't check if the AI could invent the weird conditions itself. They only checked if the AI could write a test for a known, simple bug.

2. The Solution: PBT-Bench (The "Shaking Machine" Lab)

The researchers built a new lab called PBT-Bench.

  • The Setup: They took 40 real-world Python software libraries (like tools for handling dates, data, or math).
  • The Traps: They secretly injected 365 "stealth bugs" into these tools. These aren't obvious typos; they are deep logical errors.
    • Analogy: Imagine a scale that works perfectly 99% of the time, but if you put two identical heavy rocks on it at the exact same time, it suddenly thinks the weight is zero.
  • The Challenge: The AI agents were given only the user manual (documentation). They had to read the rules, guess where the scale might break, and write a "random generator" (using a tool called Hypothesis) to try millions of rock combinations until it found the break.

3. The Difficulty Levels (The "Riddle" Scale)

They categorized the bugs into three levels of difficulty:

  • Level 1 (The Easy Riddle): The bug happens if you just try a few obvious things (like putting a rock on the scale that is too heavy).
  • Level 2 (The Medium Riddle): The bug only happens if you combine two specific rules (e.g., "The rock must be heavy AND the room must be dark").
  • Level 3 (The Hard Riddle): The bug is a "protocol violation." It only happens if you do a specific sequence of actions in the wrong order, like a dance step that ruins the whole routine. This is the hardest for AI to figure out.

4. The Experiment: Eight Detectives, Two Strategies

They tested 8 different AI models (like Claude, DeepSeek, Gemini, etc.) using two different instructions:

  • Strategy A (The Open-Ended Detective): "Go find a bug and write a test." (No hints).
  • Strategy B (The Scaffolding Detective): "Here is a specific tool called 'Hypothesis'. Here is a template. Here are the types of rules you should look for. Now go find a bug."

5. The Results: Who Found the Bugs?

  • The "Middle" Detectives Won with Hints: The AI models that were already pretty good at coding but not the best improved massively (by over 20%) when given the specific "Scaffolding" instructions. It was like giving them a flashlight in a dark room.
  • The "Top" Detectives Didn't Need the Hints: The smartest AI (Claude Sonnet 4.6) did well on its own. Giving it the specific template helped a little, but not as much as it helped the others.
  • The "Weakest" Detectives Got Confused: For two of the models, the specific instructions actually made them worse. It's like giving a strict recipe to a chef who is better at improvising; the recipe confused them.
  • The "Unsolvable" Bugs: Even with the best AI, some bugs remained hidden. Two specific bugs were so tricky that none of the 16 different AI setups could find them reliably. This shows there is still a lot of room for improvement.

6. The Big Takeaway

The paper proves that Property-Based Testing is a unique skill. Just because an AI is good at writing code doesn't mean it's good at testing code by inventing random scenarios.

  • The "Union" Effect: If you take the results from all the different AI models and combine them, they found 99.5% of the bugs. This suggests that while no single AI is perfect, a team of them (an "ensemble") can catch almost everything.
  • The "Assume" Trap: A common mistake the AI made was using a filter called assume(). It would say, "Let's only test cases where X is true," and accidentally filter out the exact weird case where the bug existed. It's like a detective saying, "I'll only look for the thief if he's wearing a hat," and missing the thief who wasn't wearing one.

Summary

The researchers built a gym for AI agents to practice "shaking" software to find hidden cracks. They found that while AI is getting better at this, it still struggles with the most complex, multi-step logical traps. They also found that giving AI a specific "testing framework" helps weaker models a lot, but can sometimes confuse the strongest ones.

They released all their tools and data so other researchers can try to build better "detectives" for the future.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →