NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Code2Bench: Scaling Source and Rigor for Dynamic Benchmark Construction

Zhe Zhang, Runlin Liu, Aishan Liu, Xingyu Liu, Xiang Gao, Hailong Sun

The evaluation of code-generating Large Language Models (LLMs) is currently stuck in a rut. While models boast near-perfect scores on popular leaderboards, developers often find that these same models struggle to write robust, production-ready code.

Code2Bench is a new framework designed to solve this "stale benchmark" problem. By dynamically sourcing fresh, real-world code from GitHub and subjecting LLMs to ultra-rigorous Property-Based Testing (PBT), Code2Bench reveals a massive performance gap between memorized puzzles and real-world engineering. It demonstrates that even top-tier models frequently produce code that looks right but fails on subtle edge cases.

The Dual Flaws of Current Benchmarks

Most researchers rely on static benchmarks like HumanEval or MBPP to evaluate code generation. However, these datasets suffer from two fatal flaws:

  1. Contamination: These problems have been on the internet for years. Models aren't necessarily "solving" them; they are likely just reciting them from their training data.
  2. Low Rigor: Most benchmarks use a handful of simple, example-based tests. If a model passes three basic tests, it is marked as a success. In reality, that code might crash on the first null input, empty list, or boundary condition it encounters in production.

To address this, we need Dual Scaling: systematically scaling the source (constantly acquiring new, unseen problems) and scaling the rigor (testing those solutions until they break).

The Code2Bench Framework: Dual Scaling

To operationalize this philosophy, the authors introduce the CODE2BENCH framework, which automates a sophisticated data funnel to create dynamic, rigorous benchmarks.

The Code2Bench framework illustrating the Dual Scaling philosophy: Scaling the Source and Scaling the Rigor.

The framework operates through several key stages:

  • Temporal Filtering: To prevent data contamination, the framework only pulls GitHub commits created after the knowledge cutoff of the models being tested (e.g., post-May 2025).
  • Scope Graph Analysis: Instead of simple keyword matching, it uses formal Scope Graphs to classify tasks. Self-Contained (SC) tasks focus on pure logic and algorithms, while Weakly Self-Contained (WSC) tasks require the use of common libraries like NumPy or Pandas.
  • Property-Based Testing (PBT): Instead of writing five test cases by hand, the framework uses tools like Hypothesis (Python) and jqwik (Java) to generate hundreds of diverse, random inputs—specifically targeting nasty boundary cases.
  • The Great Filter: A task only makes it into the benchmark if its PBT suite achieves 100% branch coverage on the ground-truth code. If the generated tests aren't rigorous enough to exercise every line of the original code, the task is discarded.

Using this pipeline, the authors constructed CODE2BENCH-2509, a high-quality suite of 1,163 tasks spanning SC-Python (217 tasks), WSC-Python (194 tasks), and SC-Java (249 tasks).

Key Findings: Exposing the Illusion of Correctness

Evaluating 10 state-of-the-art LLMs on CODE2BENCH-2509 yielded several striking insights that challenge our current understanding of model capabilities.

The "Illusion of Correctness"

This is the paper's most critical finding. On average, nearly 7% of model submissions were "near-misses"—they passed 98% of the rigorous tests but failed on a few subtle edge cases. On a standard benchmark like HumanEval, these would be marked "Correct," but Code2Bench's rigorous testing exposes them as fundamentally buggy.

Diagnostic Fingerprints

Rather than relying on a single Pass@1 score, the authors utilize "ridgeline plots" to show the distribution of failure modes (Syntax errors vs. Runtime errors vs. Logic errors). This provides a much deeper diagnostic look at why a model is failing.

Diagnostic fingerprints showing the distribution of failure modes across different LLMs.

API vs. Logic

Models are significantly better at "API application" (WSC tasks) than "algorithmic synthesis" (SC tasks). They can use a library function correctly, but they struggle to build complex, self-contained logic from scratch.

Language as Scaffolding

Interestingly, models perform better in Java than in Python for similar logical tasks. The authors hypothesize that Java’s strict type system acts as "performance scaffolding," catching errors at compile-time that would otherwise lead to runtime failures in Python.

The Reality Check

When subjected to Code2Bench, models that score near 100% on traditional benchmarks see their scores plummet. For example, Claude-4-Sonnet drops from a 97% on HumanEval to just 40.1% on SC-Python. While Claude-4-Sonnet and DeepSeek-V3 emerged as the leaders, even they struggled to pass the "Great Filter" of 100% coverage.

The performance gap between "textbook" solutions and "production-ready" code is much wider than previously thought. Most models are academically correct but not industrially robust.

Limitations and Future Work

While Code2Bench represents a massive leap forward, it currently focuses on single-function generation. Real-world engineering often involves multi-file dependencies and repository-level context. Additionally, running 500+ tests per task for multiple models is computationally expensive, prompting the authors to explore a "Lightweight Mode" that uses greedy algorithms to select a minimal subset of tests while maintaining 100% coverage.

Future iterations of Code2Bench aim to extend the "Scaling the Source" principle to repository-level tasks and incorporate non-functional requirements like code efficiency and security, pushing LLM evaluation closer to the realities of modern software engineering.

Summary updated

BibTeX
@inproceedings{zhang2026code,
  author = {Zhe Zhang and Runlin Liu and Aishan Liu and Xingyu Liu and Xiang Gao and Hailong Sun},
  title = {{Code2Bench: Scaling Source and Rigor for Dynamic Benchmark Construction}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=QZmKyAy1VK},
}
Figure