← Latest papers
💻 computer science

Evaluating LLMs Code Reasoning Under Real-World Context

This paper introduces R2Eval, a new benchmark comprising 135 code reasoning problems from ten real-world Python projects that addresses the limitations of existing evaluations by serializing complex, custom data types to better assess the practical generalizability of large language models.

Original authors: Changshu Liu

Published 2026-04-15
📖 3 min read☕ Coffee break read

Original authors: Changshu Liu

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 training a robot chef to cook meals.

The Old Way (Existing Benchmarks):
Until now, researchers tested these robot chefs using "recipe cards" that were incredibly simple. They'd say, "Here is a list of ingredients: 2 eggs, 1 cup of flour. Now, tell me what the final cake looks like." Or, "Here is a cake, tell me what ingredients went into it."

The problem? Real kitchens aren't like that. In the real world, ingredients aren't just "eggs" or "flour." They are complex things like "a jar of homemade jam that needs to be shaken," "a custom spice blend," or "a dough that has been kneaded 50 times." The old tests ignored these complexities. They only tested the robots on simple, pre-packaged ingredients. As a result, the robots looked like geniuses, scoring 90% or higher on these tests.

The New Way (This Paper's "R2Eval"):
The author, Changshu Liu, says, "Wait a minute. If we want to know if these robots can actually cook in a real restaurant, we need to test them with real, messy ingredients."

So, they built a new test called R2Eval. Instead of simple lists, they grabbed 135 real-world "recipes" from ten famous, complex Python software projects (like the tools used to build websites, analyze data, or create scientific charts).

The Big Hurdle: The "Black Box" Problem
Here is the tricky part. In the real world, some ingredients are "black boxes." You can't just look at a complex software object and say, "This is a number." It might be a custom object that doesn't have a label. If you try to print it out, you just get a random code like 0x4f3a2 (a memory address) instead of the actual data.

To solve this, the author invented a special "Translator" (a program analysis tool). This translator takes these confusing, complex "black box" objects and breaks them down into a simple, readable JSON format (like a detailed shopping list) that the AI can actually understand.

The Shocking Result
When they ran the tests:

  • On the old simple tests: The AI chefs were superstars, getting ~80% to 90% correct.
  • On the new real-world tests: Their performance crashed.
    • Predicting the output (what the code does) dropped by 52%.
    • Predicting the input (what data was needed) dropped by a massive 64%.

The Takeaway
Think of it like this: The AI was like a student who aced the multiple-choice quiz on "What is a car?" but failed the driving test when handed a real, complex vehicle with a sticky gear shift and a weird engine noise.

The paper concludes that while AI models are getting better at logic, they are still very fragile when faced with the messy, interconnected, and complex reality of actual software engineering. We need to stop testing them on "toy problems" and start testing them on the real thing if we want them to be truly useful.

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 →