arXiv:2610.41562cs.SEOct 2026

Manuscript Offprint

arXiv:2610.41562

SCRBench: Beyond Equivalence Checking for Semantic Change Reasoning in Code

Omid Saghatchian, Ali Mahzoun, Khashayar Etemadi, Saeed Reza Kheradpisheh

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Omid Saghatchian

Department of Computer and Data Sciences Faculty of Mathematical Sciences Shahid Beheshti University Tehran, Iran o.saghatchian@mail.sbu.ac.ir

Ali Mahzoun

Independent Researcher ali@mahzoun.me

Khashayar Etemadi

Department of Computer Science ETH Zurich Zurich, Switzerland ketemadi@ethz.ch

Saeed Reza Kheradpisheh

Department of Computer and Data Sciences Faculty of Mathematical Sciences Shahid Beheshti University Tehran, Iran s_kheradpisheh@sbu.ac.ir

Abstract

Understanding how code changes affect program semantics is a core aspect of code reasoning in language models. It is commonly evaluated by asking whether two programs are semantically equivalent, but a yes/no answer does not reveal whether a model knows which code change caused a semantic difference, or which sequence of code changes produced the modified program. We study two tasks that ask these questions directly, diagnosing semantic change and reconstructing sequences of code changes, alongside detecting semantic equivalence. We build SCRBench, 67,658 Python program pairs generated by applying sequences of code changes that preserve or alter program semantics, and evaluate five language models on a stratified subset of 4,500 pairs. Detecting semantic equivalence exposes weaker models, whose accuracy declines as changes accumulate, but the strongest models remain near the ceiling. Diagnosing semantic change reveals weaknesses that equivalence accuracy hides: a model with 94.71% equivalence accuracy diagnoses only 54.44% of semantic changes. Reconstructing sequences of code changes is much harder: the best model reconstructs the exact sequence for only 39.27% of pairs, and no model exceeds 1.11% when five changes are applied. High equivalence accuracy therefore overestimates how well models reason about the semantic effects of code changes.

1 Introduction

Understanding how code changes affect program semantics is a core aspect of code reasoning in large language models (LLMs). Evaluating this understanding has received increasing attention (Wei et al., 2025). One common test asks a model whether two programs are semantically equivalent, that is, whether they produce the same output for every input (Oza et al., 2026). Existing benchmarks commonly construct such program pairs from seed programs by applying small automated code changes, called transformations, that either preserve or alter a program's semantics (Wei et al., 2025; Maveli et al., 2025; Oza et al., 2026). In the simplest case, only a single transformation is applied (Maveli et al., 2025), so the evaluation does not test a model as transformations accumulate. CETBENCH addresses this by composing several transformations into one transformation sequence (Oza et al., 2026), but it still asks only whether the two programs are semantically equivalent. A yes/no answer, however, does not reveal how the model arrived at it. A model may correctly judge two programs as non-equivalent without knowing which transformation is responsible for the semantic difference or which sequence of transformations produced the modified program from the original. Equivalence accuracy alone therefore cannot measure this finer-grained reasoning. Measuring it requires asking the model these questions directly.

In this paper, we go a step further: beyond ask-ing whether two programs are semantically equivalent, we ask which transformation changed their semantics and in which order the transformations were applied. To this end, we define three tasks on pairs of an original program and a modified program produced by a sequence of transformations. (T1) Detecting semantic equivalence: decide whether the two programs are semantically equivalent. (T2) Diagnosing semantic change: given a non-equivalent pair, identify which transformation altered the semantics. (T3) Reconstructing transformation sequences: recover the ordered sequence of transformations that produces the modified program from the original one. To investigate LLM performance on these tasks, we build SCRBench from 418 MBPP programs (Austin et al., 2021). We use each MBPP program as an original program and apply to it a sequence of one to five transformations from a catalog of nine semantics-preserving and semantics-altering transformations (Table 1). In every non-equivalent pair, exactly one of the applied transformations alters semantics, so T2 has a single correct answer. Every pair carries ground truth for all three tasks (Section 2). SCRBench contains 67,658 program pairs. From it we draw a stratified subset of 4,500 pairs to evaluate all three tasks as transformations accumulate: for each number of applied transformations from one to five, it contains 450 equivalent and 450 non-equivalent pairs. T1 and T3 use all 4,500 pairs, and T2, which applies only to non-equivalent pairs, uses the 2,250 non-equivalent ones.

We evaluate five language models on the stratified subset with a prompt that includes chain-of-thought reasoning and a one-shot example. Within each task, we analyze how accuracy changes as transformations accumulate (Sections 3.2–3.4). We also perform an ablation study on a single model to assess the impact of chain-of-thought reasoning and the one-shot example on accuracy (Sections 3.2–3.4). Finally, we analyze the results across the three tasks to characterize the progression of code reasoning, including the opportunities it reveals for improving advanced models (Section 3.5). Detecting semantic equivalence (T1) and diagnosing semantic change (T2) show substantial variation across models, and T2 reveals differences that T1 hides. For example, Mistral-Small-24B is within five percentage points of the strongest models on T1 (94.71%) but about 40 points behind them on T2 (54.44%). Across all models, T1 accuracy ranges from 99.69% for Qwen3-235B to 55.49% for GPT-4.1-nano, and the strongest models remain accurate as transformations accumulate, while weaker models decline. T2 accuracy ranges from 97.07% for GPT-OSS-120B to 22.67% for Llama-3.1-8B. Reconstructing transformation sequences (T3) is more demanding, because it requires recovering the ordered sequence of transformations. Even models that are accurate on T1 and T2 show substantially lower accuracy on T3. GPT-OSS-120B, the strongest model on T3, reconstructs 39.27% of the sequences, and no model exceeds 1.11% when five transformations are applied. Qwen3-235B, the most accurate model on T1 (99.69%), reconstructs only 26.82% of the sequences.

Our contributions are twofold: (i) We study two tasks beyond detecting semantic equivalence (T1), diagnosing semantic change (T2) and reconstructing transformation sequences (T3), and show with five language models that T1 accuracy can overstate how well a model understands the effect of code changes on program semantics: T1 exposes weaker models, T2 separates models that perform similarly on T1, and models near the ceiling on T1 and T2 still struggle on T3 (Section 3). (ii) To support this study, we build SCRBench, 67,658 program pairs with automatically checked ground truth for all three tasks: an equivalence label, the single semantics-altering transformation of each non-equivalent pair, and every transformation sequence connecting the two programs, so that any valid order counts as correct (Section 2); we will publicly release SCRBench and our code upon conference acceptance.

References (40)