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

CodeGlance: Understanding Code Reasoning Challenges in LLMs through Multi-Dimensional Feature Analysis

Yunkun Wang, Xuanhe Zhang, Junxiao Han, Chen Zhi, Shuiguang Deng

TL;DR

While Large Language Models (LLMs) excel at writing and summarizing code, their ability to mentally simulate its dynamic execution remains a major bottleneck. This paper introduces CodeGlance, a multi-dimensional benchmark that evaluates LLM code reasoning across intrinsic logic, API interactions, and entirely unseen functions. The findings reveal that dynamic execution trace length and explicit parameter configurations are what truly challenge LLMs, and smaller models completely collapse when encountering unfamiliar functions.

What Problem Does This Paper Address?

Most existing code evaluation benchmarks focus on static tasks (like code completion) or isolated, self-contained code snippets. However, real-world software development is messy: developers constantly review code that chains multiple external APIs together or references custom functions defined elsewhere in a massive codebase.

To bridge this gap, the authors address a fundamental question: Can LLMs truly understand code behavior across diverse and realistic coding scenarios? Code behavior reasoning requires a model to simulate program execution, track variable states, and predict concrete outputs given specific inputs—a task that is significantly harder than just explaining syntax.

Methods

The authors formalize code reasoning as an assertion-prediction task (e.g., predicting the value that makes assert function(input) == ? true). To build a reliable benchmark, they developed a three-stage curation pipeline:

  1. LLM-Assisted Generation: An LLM generates verifiable, semantically meaningful assertions from reference code and test inputs.
  2. Format Standardization: Problems are structured uniformly into a code snippet and a single input-assertion pair.
  3. Human Verification: Human annotators filter out non-deterministic code, execution failures, and complex math that would test arithmetic precision rather than code logic.
Pipeline of CodeGlance Benchmark Construction and Framework for Empirical Study.

To understand why models struggle, the authors extract 9 distinct complexity features across three categories:

  • Logic Features: Code lines, cyclomatic complexity (branching paths), and execution trace length.
  • API Features: API count, total parameters, specified parameters, and encapsulated lines of code/execution.
  • Knowledge Features: Unseen function counts.

Finally, they systematically evaluate 7 state-of-the-art LLMs (including the Qwen2.5-Coder family, DeepSeek-Coder, and GPT-4o) alongside common augmentation strategies like Chain-of-Thought (CoT) prompting, document retrieval (RAG), and code search.

Datasets

CodeGlance integrates 1,969 high-quality code reasoning problems compiled from several source datasets:

  • CRUXEval: 800 problems used to evaluate Intrinsic Logic Reasoning (ILR) without external dependencies.
  • DS-1000 & TorchdataCode: Over 1,000 problems combined to evaluate API Interaction Reasoning (AIR) using popular data science libraries.
  • PanNumEval & MonkBeatEval: 100 problems used for Unseen Function Reasoning (UFR). Crucially, MonkBeatEval systematically translates familiar Pandas/NumPy APIs from PanNumEval into functionally equivalent but completely fictional custom functions (e.g., pandas.iterrows becomes monkey.traversal). This clever mapping isolates the exact impact of knowledge distribution shift.

Key Insights and Ideas

  • Dynamic Traces Outweigh Static Structure: Surprisingly, static metrics like the number of lines of code or cyclomatic complexity have a minimal impact on reasoning difficulty. Instead, the execution trace length (the actual number of steps executed at runtime) is the dominant driver of performance degradation. LLMs can handle complex branching paths if they are short, but they quickly lose track during long execution simulations.
  • The Devil is in the Parameters: In API interactions, performance doesn't just drop because a snippet uses multiple APIs; it drops significantly based on the number of specified (non-default) parameters. Explicitly configured arguments require deep semantic understanding, which challenges LLMs much more than standard API signatures.
  • Unseen Functions Offer Mutual Context: For known APIs, adding more calls steadily decreases performance due to compounding complexity. However, for unseen functions, a moderate number of unknown calls actually helps the model by providing richer contextual clues (variable naming, data flow patterns) to infer what the custom functions do.
  • Mismatched Augmentation Strategies: CoT few-shot prompting works wonders when the model has the prerequisite knowledge but faces complex logic. Conversely, RAG (retrieving API docs) helps bridge knowledge gaps for unseen functions, but only for larger models. Smaller models lack the capacity to filter out noise in retrieved documentation and actually perform worse when it is provided.

Key Results

  • The Unseen Collapse: Smaller models fail dramatically on out-of-distribution code. Qwen2.5-3b achieved a decent 37.5% accuracy on familiar APIs but plummeted to a near-useless 6.0% accuracy on unseen functions.
  • Massive Scaling Gains: Scaling up model size yields a massive 10.7× performance boost for unseen function reasoning (comparing Qwen2.5 3B to 32B), proving that larger models are vastly superior at inferring function behavior from context.
Code lines analysis in CRUXEval.
  • The 65% Ceiling: Despite scaling and various prompt augmentations, pass@1 accuracy across all scenarios plateaus around 64%–68% at the 32B scale, indicating a persistent shared bottleneck in fundamental execution simulation.

Limitations and Future Work

While CodeGlance covers major developer workflows, it evaluates only three specific scenarios and may not capture every real-world context. Additionally, its feature analysis omits qualitative code properties like variable naming clarity or comment density, which heavily influence how humans (and likely LLMs) infer context.

The authors conclude that future research should move away from simply enhancing static code comprehension and instead focus on improving an LLM's ability to simulate runtime execution dynamics.

Summary updated

BibTeX
@inproceedings{wang2026codeglance,
  author = {Yunkun Wang and Xuanhe Zhang and Junxiao Han and Chen Zhi and Shuiguang Deng},
  title = {{CodeGlance: Understanding Code Reasoning Challenges in LLMs through Multi-Dimensional Feature Analysis}},
  booktitle = {ICPC},
  year = {2026},
  doi = {10.1145/3794763.3794815},
}
Figure