cs.SEJun 4, 2025

LLMs are Brittle to Simple Code Transformations: Introducing CETBench - A Benchmark for Code-Equivalence Checking

Authors: Neeva Oza, Ishaan Govil, Parul Gupta, Dinesh Khandelwal, Dinesh Garg, Parag Singla

Organizations: Indian Institute of Technology Delhi · IBM Research AI

Abstract

We study how well LLMs can determine whether two programs are functionally equivalent. This is an important problem because benchmarking code equivalence helps assess LLM capability in tasks such as code rewriting and translation. To this end, we introduce CETBench - Code Equivalence with Transformations Benchmark - built from a repository of programs that may solve the same or different tasks. Each dataset instance is created by sampling a program pair and applying a random sequence of predefined code transformations, yielding either equivalent or non-equivalent pairs. Our analysis shows that even simple transformations cause a significant performance drop in state-of-the-art LLMs on code-equivalence checking. These challenges are further amplified in the cross-lingual setting when comparing programs written in different languages. To remedy this, we present a simple fine-tuning-based approach to boost LLM performance on the transformed pairs of programs. Our approach for dataset generation is generic, supporting cross-lingual equivalence checking, the generation of program pairs with varying difficulty levels, and the application of diverse transformations. In our experiments, we perform ablations over the difficulty level of original programs, as well as the kind of transformations used in generating pairs for equivalence checking. Our analysis presents deep insights into the working of LLMs for the task of code-equivalence, and points to the fact that they may still be far from what could be termed as a semantic understanding of the underlying code.

Figures & tables

Appendix figures & tables51 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Evaluating Language Models on Cross-Language Code Functional Equivalence

    Aug 25, 2026Hui Sun, Anderson Uchôa, Rohit Gheyi +1Code Language ModelsLLM Evaluation

  2. Multi-LCB: Extending LiveCodeBench to Multiple Programming Languages

    Jun 18, 2026Maria Ivanova, Pavel Zadorozhny, Rodion Levichev +5Code GenerationCode Generation Evaluation

  3. Beyond BLEU: A Semantic Evaluation Method for Code Translation

    May 6, 2026Julius Näumann, Sven Keidel, Amir Molzam Sharifloo +1Code TranslationCode Generation Evaluation