Abstract
Large Language Models (LLMs) have shown remarkable proficiency in Automated Code Refinement (ACR), yet evaluating their true understanding remains a challenge. Traditional metrics like BLEU or Exact Match often fail to distinguish between genuine reasoning and rote memorization of training data. We introduce CodeReviewQA, a benchmark that decomposes code refinement into three distinct reasoning probes: recognizing change types, locating code, and identifying solutions. By framing these as multiple-choice questions with synthetic distractors and invariance testing, we expose significant gaps between a model's ability to generate code and its actual comprehension of developer intent.
Introduction
While LLMs are increasingly integrated into developer workflows to revise code based on review comments, the "why" behind their success or failure remains opaque. Code review comments are often colloquial and implicit (e.g., "Should we also test against 3.11?"), requiring deep contextual understanding. Current evaluation methods primarily rely on text-matching metrics, which are susceptible to data contamination—where a model produces a correct fix simply because it encountered that specific GitHub commit during training. CodeReviewQA addresses this by peeking inside the "black box" of LLM reasoning to determine if models are truly understanding technical context or merely performing high-tech copy-pasting.
Methodology: The Three Probes
To move beyond monolithic generation, CodeReviewQA breaks down the refinement task into three Multiple Choice Question Answering (MCQA) probes:
- Change Type Recognition (CTR): Identifying whether the review asks to add, delete, or modify code.
- Change Localisation (CL): Pinpointing the exact line numbers requiring modification.
- Solution Identification (SI): Selecting the correct code revision from a set of plausible-but-incorrect "distractors."
To ensure robustness, the benchmark employs Invariance Testing, requiring models to select the correct answer across all $N!$ permutations of choice orderings. Furthermore, a surrogate LLM generates semantically similar distractors to stress-test fine-grained comprehension.
The CodeReviewQA Dataset
The evaluation set consists of 900 manually curated examples spanning nine programming languages (C, C++, C#, Go, Java, JavaScript, PHP, Python, and Ruby). These instances were distilled from an initial pool of 9,000, with rigorous manual cleaning to exclude noisy data such as formatting-only changes or ignored comments. This results in a high-quality, diverse dataset sourced from nearly 200 distinct GitHub repositories.
Key Results and Insights
Evaluation of 72 state-of-the-art LLMs reveals a striking discrepancy between generation and comprehension. Many models successfully pass the generative ACR task while failing the underlying reasoning probes.
- The Localization Hurdle: Change Localisation (CL) proved to be the most difficult task. Even large models that excel at picking the right solution (SI) struggle to identify the specific lines of code that need changing.
- Model Performance: Llama-3.1-70B-Instruct emerged as the top performer in generative accuracy (50.3% Exact Match), while Qwen2.5-72B-Instruct led in Solution Identification, achieving 97.1% accuracy on easy distractors.
- The Small Model Gap: Models under 3B parameters often show decent performance in recognizing change types (CTR) but fail almost entirely at localization (CL), frequently scoring near 0% on invariant accuracy.
Discussion and Future Work
The results suggest that current LLMs rely heavily on rote memorization for code tasks. By reformulating code review as an MCQA task with synthetic distractors, CodeReviewQA effectively "de-contaminates" the benchmark, making it significantly harder for models to succeed without genuine comprehension.
Future work will focus on increasing the granularity of localization (moving from line-level to token-level) and exploring the causal links between these reasoning steps. While 900 examples is a modest size, the high quality and manual curation provide a more rigorous "stress test" for model reasoning than larger, noisier datasets.
Summary updated