Computer Science > Machine Learning
[Submitted on 7 Aug 2023 (v1), last revised 29 Feb 2024 (this version, v7)]
Title:Exploiting Code Symmetries for Learning Program Semantics
View PDF HTML (experimental)Abstract: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, including GPT-4, 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.
Submission history
From: Kexin Pei [view email][v1] Mon, 7 Aug 2023 05:40:58 UTC (394 KB)
[v2] Fri, 25 Aug 2023 16:08:51 UTC (394 KB)
[v3] Mon, 28 Aug 2023 04:53:52 UTC (394 KB)
[v4] Tue, 29 Aug 2023 01:44:39 UTC (394 KB)
[v5] Thu, 31 Aug 2023 02:29:36 UTC (396 KB)
[v6] Tue, 27 Feb 2024 21:18:17 UTC (446 KB)
[v7] Thu, 29 Feb 2024 05:16:24 UTC (446 KB)
Current browse context:
cs.LG
References & Citations
Bibliographic and Citation Tools
Bibliographic Explorer (What is the Explorer?)
Litmaps (What is Litmaps?)
scite Smart Citations (What are Smart Citations?)
Code, Data and Media Associated with this Article
CatalyzeX Code Finder for Papers (What is CatalyzeX?)
DagsHub (What is DagsHub?)
Gotit.pub (What is GotitPub?)
Papers with Code (What is Papers with Code?)
ScienceCast (What is ScienceCast?)
Demos
Recommenders and Search Tools
Influence Flower (What are Influence Flowers?)
Connected Papers (What is Connected Papers?)
CORE Recommender (What is CORE?)
IArxiv Recommender
(What is IArxiv?)
arXivLabs: experimental projects with community collaborators
arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.
Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.
Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs.