mlsanityData to 7 Oct 2026

CAT-probing: A Metric-based Approach to Interpret How Pre-trained Models for Programming Language Attend Code Structure

arXiv 2210.04633 ↗First posted 7 Oct 2022cs.SE cs.AI cs.LGcited by 6

Not on the map. Why?

Abstract (arXiv)

Code pre-trained models (CodePTMs) have recently demonstrated significant success in code intelligence. To interpret these models, some probing methods have been applied. However, these methods fail to consider the inherent characteristics of codes. In this paper, to address the problem, we propose a novel probing method CAT-probing to quantitatively interpret how CodePTMs attend code structure. We first denoise the input code sequences based on the token types pre-defined by the compilers to filter those tokens whose attention scores are too small. After that, we define a new metric CAT-score to measure the commonality between the token-level attention scores generated in CodePTMs and the pair-wise distances between corresponding AST nodes. The higher the CAT-score, the stronger the ability of CodePTMs to capture code structure. We conduct extensive experiments to integrate CAT-probing with representative CodePTMs for different programming languages. Experimental results show the effectiveness of CAT-probing in CodePTM interpretation. Our codes and data are publicly available at https://github.com/nchen909/CodeAttention.

Key facts. Cited by 6 papers in the map (data through 7 Oct 2026). Builds on 25 of its 32 references that are in the map. First posted on arXiv 7 Oct 2022.

Builds on

25 of 32 references.

References · 25

  1. 2017Attention Is All You Needcited by 59,932
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  3. 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,266
  4. 2020Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecastingcited by 2,141
  5. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  6. 2019What Does BERT Look At? An Analysis of BERT's Attentioncited by 994
  7. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
  8. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
  9. 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
  10. 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
  11. 2021Unified Pre-training for Program Understanding and Generationcited by 361
  12. 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
13 more
  1. 2019Analyzing the Structure of Attention in a Transformer Language Modelcited by 241
  2. 2020IntelliCode Compose: Code Generation Using Transformercited by 225
  3. 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 220
  4. 2020Detecting Code Clones with Graph Neural Networkand Flow-Augmented Abstract Syntax Treecited by 68
  5. 2021Language-Agnostic Representation Learning of Source Code from Structure and Contextcited by 63
  6. 2021SynCoBERT: Syntax-Guided Multi-Modal Contrastive Pre-Training for Code Representationcited by 63
  7. 2022What Do They Capture? -- A Structural Analysis of Pre-Trained Language Models for Source Codecited by 50
  8. 2020Are Pre-trained Language Models Aware of Phrases? Simple but Strong Baselines for Grammar Inductioncited by 47
  9. 2021What do pre-trained code models know about code?cited by 36
  10. 2021Code Completion by Modeling Flattened Abstract Syntax Trees as Graphscited by 30
  11. 2022Probing Pretrained Models of Source Codecited by 26
  12. 2022Deep Learning Meets Software Engineering: A Survey on Pre-Trained Models of Source Codecited by 20
  13. 2022A Neural Network Architecture for Program Understanding Inspired by Human Behaviorscited by 5

Built on by

Cited by year

Citing papers per year: 2023: 2; 2024: 3; 2025: 1.

6 papers.