利用代码对称性学习程序语义
Exploiting Code Symmetries for Learning Program Semantics
AI总结:
本文提出 SymC,用群论刻画代码对称性,并设计对程序依赖图置换群等变的自注意力,从而在无预训练情况下提升五项程序分析任务性能。
摘要:
本文解决通过将代码对称性纳入模型架构,向 Large Language Models(LLMs)教授代码语义以进行程序分析的挑战。我们引入一个群论框架,将代码对称性定义为保持语义的变换;在该框架中,构建代码对称群能够实现精确且高效的代码语义推理。我们的解决方案 SymC 开发了一种新型自注意力变体,可证明其对定义在程序依赖图上的置换群中的代码对称性具有等变性。SymC 在五项程序分析任务上取得优越性能,在没有任何预训练的情况下优于最先进的代码模型。结果表明,通过代码对称群编码代码结构先验的代码 LLM 具有更好、更快的泛化能力。
英文摘要:
This paper tackles the challenge of teaching code semantics to Large Language Models (LLMs) for program analysis by incorporating code symmetries into the model architecture. We introduce a group-theoretic framework that defines code symmetries as semantics-preserving transformations, where forming a code symmetry group enables precise and efficient reasoning of code semantics. Our solution, SymC, develops a novel variant of self-attention that is provably equivariant to code symmetries from the permutation group defined over the program dependence graph. SymC obtains superior performance on five program analysis tasks, outperforming state-of-the-art code models without any pre-training. Our results suggest that code LLMs that encode the code structural prior via the code symmetry group generalize better and faster.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。