EMNLP Findings2022
Benchmarking Language Models for Code Syntax Understanding
Da Shen, Xinyun Chen, Chenguang Wang, Koushik Sen, Dawn Song
Abstract
Pre-trained language models have demonstrated impressive performance in both natural language processing and program understanding, which represent the input as a token sequence without explicitly modeling its structure. Some prior works show that pretrained language models can capture the syntactic rules of natural languages without finetuning on syntax understanding tasks. However, there is limited understanding of how well pre-trained models understand the code structure so far. In this work, we perform the first thorough benchmarking of the stateof-the-art pre-trained models for identifying the syntactic structures of programs. Specifically, we introduce CodeSyntax, a large-scale dataset of programs annotated with the syntactic relationships in their corresponding abstract syntax trees. Our key observation is that existing language models pretrained on code still lack the understanding of code syntax. In fact, these pre-trained programming language models fail to match the performance of simple baselines based on positional offsets and keywords. We also present a natural language benchmark to highlight the differences between natural languages and programming languages in terms of syntactic structure understanding. Our findings point out key limitations of existing pre-training methods for programming languages, and suggest the importance of modeling code syntactic structures. 1
Ask Lune
Ask anything. The answer quotes the paper.
Lune reads all of it and the papers around it, then shows you the passages behind every answer.
Lune answers from
the full paper · 4 top-tier papers that cite it · related work
Free to start. No credit card required.
Cited by top-tier papers4
- CodeIPPrompt: Intellectual Property Infringement Assessment of Code Language ModelsZhiyuan Yu, Yuhao Wu, Ning Zhang, Chenguang Wang et al.ICML 2023 · 42 citations
- Measuring Vision-Language STEM Skills of Neural ModelsJianhao Shen, Ye Yuan, Srbuhi Mirzoyan, Ming Zhang et al.ICLR 2024 · 14 citations
- Code Change Intention, Development Artifact, and History Vulnerability: Putting Them Together for Vulnerability Fix Detection by LLMXu Yang, Wenhan Zhu, Michael Pacheco, Jiayuan Zhou et al.FSE 2025 · 5 citations
- Unlocking SLM Potential for Data Analysis Code Generation via Non-Parametric Knowledge DistillationJinyang Li, Jack Williams, Nick McKenna, Arian Askari et al.NeurIPS 2025
Builds on8
- CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan et al.EMNLP Findings 2020 · 2,828 citations
- Unsupervised Translation of Programming LanguagesBaptiste Rozière, Marie-Anne Lachaux, Lowik Chanussot, Guillaume LampleNeurIPS 2020 · 606 citations
- Unsupervised Cross-lingual Representation Learning at ScaleAlexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary et al.ACL 2020 · 539 citations
- Learning and Evaluating Contextual Embedding of Source CodeAditya Kanade, Petros Maniatis, Gogul Balakrishnan, Kensen ShiICML 2020 · 438 citations
- DeepStruct: Pretraining of Language Models for Structure PredictionChenguang Wang, Xiao Liu, Zui Chen, Haoyun Hong et al.ACL Findings 2022 · 78 citations
Related papers
- What Do They Capture? - A Structural Analysis of Pre-Trained Language Models for Source CodeYao Wan, Wei Zhao, Hongyu Zhang, Yulei Sui et al.ICSE 2022 · 66 citations
- AST-Probe: Recovering abstract syntax trees from hidden representations of pre-trained language modelsJosé Antonio Hernández López, Martin Weyssow, Jesús Sánchez Cuadrado, Houari A. SahraouiASE 2022 · 18 citations
- A Critical Study of What Code-LLMs (Do Not) LearnAbhinav Anand, Shweta Verma, Krishna Narasimhan, Mira MeziniACL Findings 2024 · 2 citations
- Understanding Programs by Exploiting (Fuzzing) Test CasesJianyu Zhao, Yuyang Rong, Yiwen Guo, Yifeng He et al.ACL Findings 2023 · 13 citations
- An extensive study on pre-trained models for program understanding and generationZhengran Zeng, Hanzhuo Tan, Haotian Zhang, Jing Li et al.ISSTA 2022 · 142 citations
