paper-with-me

Papers

How Accurately Do Large Language Models Understand Code?

2025-04-06 · Sabaat Haroon, Ahmad Faraz Khan, Ahmad Humayun, Waris Gill, Abdul Haddi Amjad, Ali R. Butt, Mohammad Taha Khan, Muhammad Ali Gulzar

Large Language Models (LLMs) are increasingly used in post-development tasks such as code repair and testing. A key factor in these tasks' success is the model's deep understanding of code. However, the extent to which LLMs truly understand code remains largely unevaluated. Quantifying code comprehension is challenging due to its abstract nature and the lack of a standardized metric. Previously, this was assessed through developer surveys, which are not feasible for evaluating LLMs. Existing LLM benchmarks focus primarily on code generation, fundamentally different from code comprehension. Additionally, fixed benchmarks quickly become obsolete as they become part of the training data. This paper presents the first large-scale empirical investigation into LLMs' ability to understand code. Inspired by mutation testing, we use an LLM's fault-finding ability as a proxy for its deep code understanding. This approach is based on the insight that a model capable of identifying subtle functional discrepancies must understand the code well. We inject faults in real-world programs and ask the LLM to localize them, ensuring the specifications suffice for fault localization. Next, we apply semantic-preserving code mutations (SPMs) to the faulty programs and test whether the LLMs still locate the faults, verifying their confidence in code understanding. We evaluate nine popular LLMs on 600,010 debugging tasks from 670 Java and 637 Python programs. We find that LLMs lose the ability to debug the same bug in 78% of faulty programs when SPMs are applied, indicating a shallow understanding of code and reliance on features irrelevant to semantics. We also find that LLMs understand code earlier in the program better than later. This suggests that LLMs' code comprehension remains tied to lexical and syntactic features due to tokenization designed for natural languages, which overlooks code semantics.

📄 PDF Abstract BibTeX arXiv:2504.04372

Code (0)

등록된 구현이 없습니다.

Tasks

Code GenerationCode RepairFault localization

Methods 이 논문이 사용한 방법론

Focus 설명 없음

Similar Papers 제목 키워드 기반

TreeCaps: Tree-Structured Capsule Networks for Program Source Code Processing

2019-10-27 · Vinoj Jayasundara, Nghi Duy Quoc Bui, Lingxiao Jiang, David Lo

Program comprehension is a fundamental task in software development and maintenance processes. Software developers often need to understand a large amount of existing code before they can develop new features or fix bugs…

Articles

DeepRTL: Bridging Verilog Understanding and Generation with a Unified Representation Model

2025-02-20 · Yi Liu, Changran Xu, Yunhao Zhou, Zeju Li 외

Recent advancements in large language models (LLMs) have shown significant potential for automating hardware description language (HDL) code generation from high-level natural language instructions. While fine-tuning has…

Code GenerationSemantic SimilaritySemantic Textual Similarity

Comparing Code Explanations Created by Students and Large Language Models

2023-04-08 · Juho Leinonen, Paul Denny, Stephen MacNeil, Sami Sarsa 외

Reasoning about code and explaining its purpose are fundamental skills for computer scientists. There has been extensive research in the field of computing education on the relationship between a student's ability to exp…

VS-Assistant: Versatile Surgery Assistant on the Demand of Surgeons

2024-05-14 · Zhen Chen, Xingjian Luo, Jinlin Wu, Danny T. M. Chan 외

The surgical intervention is crucial to patient healthcare, and many studies have developed advanced algorithms to provide understanding and decision-making assistance for surgeons. Despite great progress, these algorith…

MLLM-SUL: Multimodal Large Language Model for Semantic Scene Understanding and Localization in Traffic Scenarios

2024-12-27 · Jiaqi Fan, Jianhua Wu, Jincheng Gao, Jianhao Yu 외

Multimodal large language models (MLLMs) have shown satisfactory effects in many autonomous driving tasks. In this paper, MLLMs are utilized to solve joint semantic scene understanding and risk localization tasks, while …

Autonomous DrivingLanguage ModelingLanguage ModellingLarge Language Model+3