MathlibPR: Pull Request Merge-Readiness Benchmark for Formal Mathematical Libraries
The paper introduces MathlibPR, a benchmark derived from real Lean/Mathlib4 pull request histories, to evaluate the ability of LLMs and agents to distinguish merge-ready contributions from non-merged ones, revealing their current struggles and highlighting the benchmark's potential for developing reviewer assistants and reward models.
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 a massive, living library of mathematics called Mathlib. It's not just a book; it's a giant, shared construction site where mathematicians and computer scientists build a perfect, error-free foundation for all of math. To keep this library safe and useful, every new piece of code (a "Pull Request" or PR) must pass two tests:
- The "Does it work?" test: Does the code actually run without crashing? (The computer checks this).
- The "Is it a good citizen?" test: Does the code fit in with the rest of the library? Is it written in the right style? Is it clear enough for others to use? (Humans check this).
For a long time, Artificial Intelligence (AI) has been great at passing the first test. It can write code that runs perfectly. But the second test—the human review—has become a bottleneck. There are too many submissions, and not enough human reviewers to check if the code is truly ready to be merged into the library.
This paper asks a simple question: Can AI learn to be the reviewer? Can an AI look at a piece of code that already works and decide if it's "merge-ready" or if it needs more work?
To find out, the authors created a new test called MATHLIBPR.
The Experiment: A "Blind Taste Test" for Code
Think of MATHLIBPR as a blind taste test for a new recipe.
- The Setup: The researchers took real history from the Mathlib library. They gathered thousands of code submissions that had already passed the "Does it work?" test (they compiled successfully).
- The Challenge: They gave these code snippets to various AI models (like DeepSeek, Qwen, and others) and asked: "Is this ready to be published in the library, or should it be sent back for revisions?"
- The Catch: The AI didn't know the final outcome. It couldn't ask the human reviewers, "Did you like this?" It had to judge solely based on the code itself, just like a human reviewer would.
They tested the AI in three rounds, giving it more and more clues:
- Round 1: Just the code changes and a few style guides.
- Round 2: The code plus a list of automated "linting" errors (like a spell-checker for code).
- Round 3: The code, the errors, plus the author's description of what they were trying to do.
The Results: The AI Got Stuck
The results were surprising and a bit disappointing for the AI community.
- The AI couldn't tell the difference. Even with all the extra clues, the AI models struggled to distinguish between code that was eventually accepted and code that was rejected or sent back for fixes.
- The "Yes" Bias: Most of the AIs were too optimistic. They tended to say, "Yes, this is great!" even when the code was actually messy or didn't fit the library's style. They rarely said, "No, this needs work."
- The "I Don't Know" Option: Some models, when faced with a tough decision, just said, "I'm not sure." While honest, this doesn't help the library move forward.
- More Context Didn't Help Much: Giving the AI more information (like the author's intent or automated error reports) didn't significantly improve its ability to make the right call.
One interesting finding was that even when the AI looked at the same project at two different times (once when it was messy, and once when it was fixed and accepted), it often couldn't tell which version was the "better" one. It was like a student taking a test on a topic they studied, but failing to notice the difference between a rough draft and the final essay.
Why This Matters
The paper concludes that while AI is excellent at writing code that works, it is currently very bad at reviewing code to see if it belongs in a high-quality library.
The authors aren't saying AI should replace human reviewers. Instead, they see this benchmark (MATHLIBPR) as a starting point. It's a tool to help train future AI systems to be better "assistant reviewers." The goal is to build an AI that can help humans by spotting obvious style issues or missing documentation, acting as a first line of defense so human reviewers can focus on the hardest, most creative parts of the job.
In short: AI is a great builder, but right now, it's a terrible inspector. This paper provides the first real test to measure exactly how bad it is, so we can teach it to do better.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.