From Discussion to Execution: Replicating Buggy and Correct Data Science Code
This paper introduces Reprodgen, an LLM-based framework that automatically reconstructs executable buggy and patched data science code pairs from unstructured Q&A forum discussions by iteratively refining code through structured intent representations and reviewer feedback, ultimately validated on a new benchmark across seven major data science libraries.
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 trying to solve a mystery, but the only clues you have are a few scribbled notes on a napkin and a vague story told by a friend. You know someone made a mistake, and you know they eventually fixed it, but you don't have the original broken machine, the specific tools they used, or even the right ingredients to build a replica. This is the daily struggle of modern data science. Scientists and programmers often share their problems and solutions on public forums like Stack Overflow, but these discussions are messy. They are full of "what ifs" and missing details, making it nearly impossible for a computer to automatically recreate the exact broken code and the perfect fix. It's like trying to bake a cake using a recipe that says "add some flour" without telling you how much, or what kind of oven to use.
To understand the solution, we first need to know what a "bug" is in this world. Think of a data science program as a complex recipe for a digital dish. A bug is a tiny mistake in the instructions—maybe you forgot to preheat the oven, or you mixed up the sugar and salt. When this happens, the dish comes out wrong. Usually, a human has to taste the mistake, figure out what went wrong, and rewrite the recipe. But what if we could teach a super-smart robot to look at the messy notes, guess the missing ingredients, build the broken dish on purpose, and then show us exactly how to fix it? That is the big question this paper tackles: Can we build a system that turns vague, informal stories about coding errors into real, working code that we can actually run and test?
Enter Reprodgen, a new digital detective created by researchers at Texas State University and Oakland University. Think of Reprodgen as a pair of robot chefs working together in a high-tech kitchen. One robot, the Generator, is the creative cook. It reads the messy forum posts and tries to build the broken recipe (the buggy code) and the fixed recipe (the patched code). But the Generator is prone to daydreaming; it might invent ingredients that don't exist or forget to turn on the stove. That's why it has a partner: the Reviewer. The Reviewer is the strict head chef who tastes every dish the Generator makes. If the dish is raw, the Reviewer sends it back to the kitchen with a note saying, "You forgot the eggs," or "This tastes wrong, try again." They work in a loop, cooking and tasting, until the dish is perfect.
The paper's main discovery is that this "cooking together" approach works surprisingly well. The researchers tested Reprodgen on 176 real-world examples taken from popular data science forums, covering famous tools like pandas and NumPy. They found that Reprodgen could successfully recreate the broken code and the fix about 60% of the time for the bugs and 52% of the time for the fixes. This is a big deal because previous attempts by other smart systems often failed to produce code that could actually run; they would write code that looked right on paper but crashed the moment you tried to use it. Reprodgen, however, managed to build "executable" code—meaning it actually runs on a computer without breaking.
However, the paper is careful not to call this a magic wand that solves everything. The researchers explicitly argue against the idea that simply asking a smart computer to "write code" is enough. They tested other top-tier systems, like AutoCodeRover and ArchCode, and found that these systems often gave up when the forum posts were missing details. They would either produce code that couldn't run or they would skip the broken part entirely and just give the solution. Reprodgen showed that you must have that strict review loop and that you need to invent "mock data" (fake ingredients) to fill in the gaps left by the forum posts.
The study also revealed some interesting quirks about the robot chefs. The researchers tested several different "brains" (large language models) to see which one was the best cook. They found that the Qwen 2.5 and Gemma 3 models were the most reliable, while others struggled more. Interestingly, the robots were much better at recreating the broken version of the code than the fixed version. It's easier for the robot to guess what the mistake was (because the forum post usually describes the problem clearly) than to guess the perfect solution (which requires more creative reasoning).
In terms of speed, the system took an average of 35 seconds to solve each problem, which is pretty fast for such a complex task. But the researchers also noted that the robots sometimes got confused about which specific tools or "libraries" were needed, suggesting that while the system is smart, it still needs help figuring out the exact environment.
Ultimately, this paper suggests that we are getting closer to a future where computers can automatically learn from human mistakes and fix them. The researchers didn't just build a tool; they also created a new "test kitchen" called ReprodgenBench-V, a collection of 176 real-world problems that other scientists can use to test their own robot chefs. They also set up a public leaderboard so everyone can see which models are the best at this task. While the system isn't perfect yet—it still misses about half of the fixes—the fact that it can turn a messy, incomplete story into a working, running program is a significant step forward. It proves that with the right mix of creativity and strict checking, we can teach machines to understand the messy reality of human coding errors.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.