What does Transformer learn about source code?

Kechi Zhang, Ge Li, Zhi Jin
7/18/2022
cs.SEcs.AI

No confident code implementation found for this paper. 4 possible matches can be shown below.

Abstract

In the field of source code processing, the transformer-based representation models have shown great powerfulness and have achieved state-of-the-art (SOTA) performance in many tasks. Although the transformer models process the sequential source code, pieces of evidence show that they may capture the structural information (\eg, in the syntax tree, data flow, control flow, \etc) as well. We propose the aggregated attention score, a method to investigate the structural information learned by the transformer. We also put forward the aggregated attention graph, a new way to extract program graphs from the pre-trained models automatically. We measure our methods from multiple perspectives. Furthermore, based on our empirical findings, we use the automatically extracted graphs to replace those ingenious manual designed graphs in the Variable Misuse task. Experimental results show that the semantic graphs we extracted automatically are greatly meaningful and effective, which provide a new perspective for us to understand and use the information contained in the model.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 4 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{zhang2022what,
  title  = {What does Transformer learn about source code?},
  author = {Kechi Zhang and Ge Li and Zhi Jin},
  year   = {2022},
  eprint = {2207.08466},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2207.08466v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2207.08466.svg)](https://codeofpaper.com/paper/2207.08466)

Discussion