CodeStructEval: A Holistic Evaluation Framework of Code Structure Generation and Comprehension

Zhanyue Qin, jia feng, Xin-Cheng Wen, Cuiyun Gao, Qing LiaoOpenReview 2026 · Submission to ICLR 2026 · Rejected

TL;DR

Researchers have introduced CodeStructEval, a new framework that moves beyond testing if Large Language Models (LLMs) can just write code, instead probing whether they actually understand its underlying architecture. By tasking models with translating between source code and Abstract Syntax Trees (ASTs), the study reveals that while top-tier models like Claude 3.5 Sonnet excel at structural reasoning, most open-source models still struggle to "see" the forest for the trees.

What Problem Does This Paper Address?

Most existing benchmarks for code LLMs, like the famous HumanEval, focus on "sequential" generation: you give the model a natural language prompt, and it gives you a block of code. While useful, this doesn't tell us if the model truly understands the program logic and hierarchical structure of what it's writing.

Code is not just text; it’s a tree-like structure of nested logic. When LLMs produce code that is syntactically correct but logically broken, it often stems from a lack of "structural awareness." This paper addresses the gap in evaluation by forcing models to interact directly with Abstract Syntax Trees (ASTs)—the data structures compilers use to represent the organization of code.

Methods

The authors propose two complementary tasks to measure structural intelligence:

  1. Code Structure Generation (CSG): The model is given source code and must generate the corresponding AST. This tests the model's ability to abstract and analyze existing logic.
  2. Code Structure Comprehension (CSC): The model is given an AST and must reconstruct the original source code. This tests if the model can "read" a structural blueprint and turn it into functional software.

To measure success, they introduced two metrics:

  • SAR (Semantic Accuracy Rate): Does the generated code (or code derived from a generated AST) actually pass its unit tests? This measures functional correctness.
  • StAR (Structure Accuracy Rate): Does the generated AST match the ground-truth AST exactly? This is a much stricter metric for structural "alignment."

The framework, CodeStructEval, automates the pipeline from data preprocessing to model inference and multi-metric evaluation.

Datasets

The researchers built their benchmark using HumanEval as a "seed" dataset. They didn't just take it as-is; they passed the canonical solutions through a multi-stage pipeline:

  • AST Generation: Converting Python solutions into standardized ASTs using Python’s built-in ast module.
  • Filtering: Removing samples that were too computationally expensive or had excessively large ASTs (over 1,500 tokens).
  • Difficulty Stratification: They ended up with 157 high-quality samples categorized into Easy, Medium, and Hard tiers based on code complexity and AST size.

Key Insights and Ideas

  • Abstraction is Harder than Reconstruction: The CSG task (Code $\rightarrow$ AST) proved significantly more difficult for models than the CSC task (AST $\rightarrow$ Code). It is much easier for an LLM to fill in the blanks when a structural "scaffold" is provided than it is to derive that scaffold from scratch.
  • Functional $\neq$ Structural: The study found that SAR $\ge$ StAR across the board. A model can often write code that passes all tests (high SAR) even if its internal representation of the structure is slightly "off" compared to the ground truth (lower StAR).
  • The "Instruction Tuning" Paradox: Surprisingly, instruction-tuned models (designed to follow human directions) didn't always outperform their "base" counterparts on structural tasks. In some cases, instruction tuning actually weakened structural reasoning, suggesting that current tuning pipelines might prioritize conversational fluency over deep logical analysis.
  • Scaling Isn't a Silver Bullet: While larger models generally performed better, the gap between open-source and closed-source models remains massive. Massive scale alone doesn't guarantee structural understanding; specific "structure-aware" training may be necessary.

Key Results

The authors evaluated 18 mainstream LLMs, including the GPT, Claude, and Qwen families.

  • The Champion: Claude 3.5 Sonnet dominated the benchmark, achieving a staggering 91.08% SAR on the difficult CSG task, far outstripping its closest competitors.
  • The Gap: For Qwen2.5-Coder-14B-Base, the performance drop-off was stark: it hit 94.52% SAR on the "easier" CSC task but plummeted to 29.04% on the CSG task.
  • CoT and Few-Shot: Using Chain-of-Thought (CoT) prompting actually decreased performance for pass@1 results because it increased the chance of a single error in a long reasoning chain. However, Few-Shot prompting (providing examples) consistently helped models adapt to the rigid format of ASTs.

Limitations and Future Work

The authors acknowledge a few hurdles:

  • Token Limits: ASTs are incredibly verbose. For complex functions, the AST representation can quickly exceed the context window or generation limits of smaller models.
  • Language Scope: While the framework is designed to be language-agnostic, the current benchmark is focused on Python.
  • Future Directions: The authors suggest that future LLM training should explicitly include "structure-aware" signals—such as AST-level supervision—to bridge the gap between writing text and understanding logic.

For those interested in the full technical details, the paper is currently under review for ICLR 2026.

Summary updated

BibTeX
@misc{qin2026codestructeval,
  author = {Zhanyue Qin and jia feng and Xin-Cheng Wen and Cuiyun Gao and Qing Liao},
  title = {{CodeStructEval: A Holistic Evaluation Framework of Code Structure Generation and Comprehension}},
  year = {2026},
  url = {https://openreview.net/forum?id=5koD6h0ep1},
  howpublished = {OpenReview},
  note = {Submitted to ICLR 2026},
}
Figure