arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2408.11081cs.SEcs.AIcs.CLcs.LG
收藏

大语言模型能捕捉代码功能等价性的哪些方面?

What can Large Language Models Capture about Code Functional Equivalence?

School of Informatics, University of Edinburgh(爱丁堡大学信息学院)

Nickil Maveli, Antonio Vergari, Shay B. Cohen

AI总结:

本文针对Code-LLMs是否及如何捕捉代码语义这一开放问题,提出SeqCoBench基准,通过多类Python代码语义转换评估其功能等价性识别能力,发现其与经典匹配检索性能差距小但语义理解深度均不足。

摘要:

代码大语言模型(Code-LLMs)是在大规模代码语料库上预训练的大语言模型,它们在学习代码结构和语法的丰富表示方面取得了显著进展,并成功用于生成或分类代码片段。与此同时,它们是否因捕捉到代码语义而具备这些能力,以及捕捉程度如何,仍是一个开放问题。本文通过引入SeqCoBench基准来解决这一问题,该基准用于系统评估Code-LLMs捕捉代码功能等价性的能力。SeqCoBench包含20多种对Python程序进行的、或保留或改变语义的代码转换。我们在不同设置下进行了广泛评估,包括在最先进的(代码)大语言模型上使用零样本和参数高效微调方法,以观察它们能否识别SeqCoBench中语义等价或不同的程序对。我们发现,这些大语言模型与基于经典匹配的检索分数之间的性能差距极小,两种方法在理解代码语义方面都显示出令人担忧的深度不足。

英文摘要:

Code-LLMs, LLMs pre-trained on large code corpora, have shown great progress in learning rich representations of the structure and syntax of code, successfully using it to generate or classify code fragments. At the same time, understanding if they are able to do so because they capture code semantics, and how well, is still an open question. In this paper, we tackle this problem by introducing SeqCoBench, a benchmark for systematically assessing how Code-LLMs can capture code functional equivalence. SeqCoBench contains over 20 code transformations that either preserve or alter the semantics of Python programs. We conduct extensive evaluations in different settings, including zero-shot and parameter-efficient finetuning methods on state-of-the-art (Code)-LLMs to see if they can discern semantically equivalent or different pairs of programs in SeqCoBench. We find that the performance gap between these LLMs and classical match-based retrieval scores is minimal, with both approaches showing a concerning lack of depth in understanding code semantics.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑