Lune

ASE2022顶会

AST-Probe: Recovering abstract syntax trees from hidden representations of pre-trained language models

José Antonio Hernández López, Martin Weyssow, Jesús Sánchez Cuadrado, Houari A. Sahraoui

摘要

The objective of pre-trained language models is to learn contextual representations of textual data. Pre-trained language models have become mainstream in natural language processing and code modeling. Using probes, a technique to study the linguistic properties of hidden vector spaces, previous works have shown that these pre-trained language models encode simple linguistic properties in their hidden representations. However, none of the previous work assessed whether these models encode the whole grammatical structure of a programming language. In this paper, we prove the existence of a syntactic subspace, lying in the hidden representations of pre-trained language models, which contain the syntactic information of the programming language. We show that this subspace can be extracted from the models’ representations and define a novel probing method, the AST-Probe, that enables recovering the whole abstract syntax tree (AST) of an input code snippet. In our experimentations, we show that this syntactic subspace exists in five state-of-the-art pre-trained language models. In addition, we highlight that the middle layers of the models are the ones that encode most of the AST information. Finally, we estimate the optimal size of this syntactic subspace and show that its dimension is substantially lower than those of the models’ representation spaces. This suggests that pre-trained language models use a small part of their representation spaces to encode syntactic information of the programming languages.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 7 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • Better Context Makes Better Code Language Models: A Case Study on Function Call Argument Completion 引用了 CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
  • Better Context Makes Better Code Language Models: A Case Study on Function Call Argument Completion 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Better Context Makes Better Code Language Models: A Case Study on Function Call Argument Completion 引用了 GraphCodeBERT: Pre-training Code Representations with Data Flow
  • CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Self-Supervised Contrastive Learning for Code Retrieval and Summarization via Semantic-Preserving Transformations 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • A Learning-Based Approach to Static Program Slicing 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • A Learning-Based Approach to Static Program Slicing 引用了 GraphCodeBERT: Pre-training Code Representations with Data Flow
  • The Devil is in the Tails: How Long-Tailed Code Distributions Impact Large Language Models 引用了 CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
  • The Devil is in the Tails: How Long-Tailed Code Distributions Impact Large Language Models 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • The EarlyBIRD Catches the Bug: On Exploiting Early Layers of Encoder Models for More Efficient Code Classification 引用了 CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
  • The EarlyBIRD Catches the Bug: On Exploiting Early Layers of Encoder Models for More Efficient Code Classification 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • The EarlyBIRD Catches the Bug: On Exploiting Early Layers of Encoder Models for More Efficient Code Classification 引用了 GraphCodeBERT: Pre-training Code Representations with Data Flow
  • Towards Efficient Fine-Tuning of Pre-trained Code Models: An Experimental Study and Beyond 引用了 CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
  • Towards Efficient Fine-Tuning of Pre-trained Code Models: An Experimental Study and Beyond 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Towards Efficient Fine-Tuning of Pre-trained Code Models: An Experimental Study and Beyond 引用了 GraphCodeBERT: Pre-training Code Representations with Data Flow
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper7

  1. Towards Efficient Fine-Tuning of Pre-trained Code Models: An Experimental Study and BeyondEnsheng Shi, Yanlin Wang, Hongyu Zhang, Lun Du 等ISSTA 2023 · 37 次引用
  2. Better Context Makes Better Code Language Models: A Case Study on Function Call Argument CompletionHengzhi Pei, Jinman Zhao, Leonard Lausen, Sheng Zha 等AAAI 2023 · 30 次引用
  3. A Learning-Based Approach to Static Program SlicingAashish Yadavally, Yi Li, Shaohua Wang, Tien N. NguyenOOPSLA 2024 · 15 次引用
  4. The EarlyBIRD Catches the Bug: On Exploiting Early Layers of Encoder Models for More Efficient Code ClassificationAnastasiia Grishina, Max Hort, Leon MoonenFSE 2023 · 15 次引用
  5. The Devil is in the Tails: How Long-Tailed Code Distributions Impact Large Language ModelsXin Zhou, Kisub Kim, Bowen Xu, Jiakun Liu 等ASE 2023 · 10 次引用

它引用的 Paper9

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
  2. CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan 等EMNLP Findings 2020 · 2,828 次引用
  3. GraphCodeBERT: Pre-training Code Representations with Data FlowDaya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng 等ICLR 2021 · 1,644 次引用
  4. CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and GenerationYue Wang, Weishi Wang, Shafiq R. Joty, Steven C. H. HoiEMNLP 2021 · 1,224 次引用
  5. Self-Supervised Contrastive Learning for Code Retrieval and Summarization via Semantic-Preserving TransformationsNghi D. Q. Bui, Yijun Yu, Lingxiao JiangSIGIR 2021 · 98 次引用

相关 Paper

  1. What Do They Capture? - A Structural Analysis of Pre-Trained Language Models for Source CodeYao Wan, Wei Zhao, Hongyu Zhang, Yulei Sui 等ICSE 2022 · 66 次引用
  2. Benchmarking Language Models for Code Syntax UnderstandingDa Shen, Xinyun Chen, Chenguang Wang, Koushik Sen 等EMNLP Findings 2022 · 16 次引用
  3. AST-T5: Structure-Aware Pretraining for Code Generation and UnderstandingLinyuan Gong, Mostafa Elhoushi, Alvin CheungICML 2024 · 42 次引用
  4. CAT-probing: A Metric-based Approach to Interpret How Pre-trained Models for Programming Language Attend Code StructureNuo Chen, Qiushi Sun, Renyu Zhu, Xiang Li 等EMNLP Findings 2022 · 5 次引用
  5. Mechanisms vs. Outcomes: Probing for Syntax Fails to Explain Performance on Targeted Syntactic EvaluationsAnanth Agarwal, Jasper Jian, Christopher D. Manning, Shikhar MurtyEMNLP 2025 · 5 次引用
黄昏的海面,两侧是细线勾勒的悬崖