What does Transformer learn about source code?
- URL: http://arxiv.org/abs/2207.08466v1
- Date: Mon, 18 Jul 2022 09:33:04 GMT
- Title: What does Transformer learn about source code?
- Authors: Kechi Zhang, Ge Li, Zhi Jin
- Abstract summary: transformer-based representation models have achieved state-of-the-art (SOTA) performance in many tasks.
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.
- Score: 26.674180481543264
- License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
- 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.
Related papers
- Automatic Graph Topology-Aware Transformer [50.2807041149784]
We build a comprehensive graph Transformer search space with the micro-level and macro-level designs.
EGTAS evolves graph Transformer topologies at the macro level and graph-aware strategies at the micro level.
We demonstrate the efficacy of EGTAS across a range of graph-level and node-level tasks.
arXiv Detail & Related papers (2024-05-30T07:44:31Z) - Deep Prompt Tuning for Graph Transformers [55.2480439325792]
Fine-tuning is resource-intensive and requires storing multiple copies of large models.
We propose a novel approach called deep graph prompt tuning as an alternative to fine-tuning.
By freezing the pre-trained parameters and only updating the added tokens, our approach reduces the number of free parameters and eliminates the need for multiple model copies.
arXiv Detail & Related papers (2023-09-18T20:12:17Z) - Dynamic Graph Message Passing Networks for Visual Recognition [112.49513303433606]
Modelling long-range dependencies is critical for scene understanding tasks in computer vision.
A fully-connected graph is beneficial for such modelling, but its computational overhead is prohibitive.
We propose a dynamic graph message passing network, that significantly reduces the computational complexity.
arXiv Detail & Related papers (2022-09-20T14:41:37Z) - Relphormer: Relational Graph Transformer for Knowledge Graph
Representations [25.40961076988176]
We propose a new variant of Transformer for knowledge graph representations dubbed Relphormer.
We propose a novel structure-enhanced self-attention mechanism to encode the relational information and keep the semantic information within entities and relations.
Experimental results on six datasets show that Relphormer can obtain better performance compared with baselines.
arXiv Detail & Related papers (2022-05-22T15:30:18Z) - Transformer for Graphs: An Overview from Architecture Perspective [86.3545861392215]
It's imperative to sort out the existing Transformer models for graphs and systematically investigate their effectiveness on various graph tasks.
We first disassemble the existing models and conclude three typical ways to incorporate the graph information into the vanilla Transformer.
Our experiments confirm the benefits of current graph-specific modules on Transformer and reveal their advantages on different kinds of graph tasks.
arXiv Detail & Related papers (2022-02-17T06:02:06Z) - Graph Self-Attention for learning graph representation with Transformer [13.49645012479288]
We propose a novel Graph Self-Attention module to enable Transformer models to learn graph representation.
We propose context-aware attention which considers the interactions between query, key and graph information.
Our method achieves state-of-the-art performance on multiple benchmarks of graph representation learning.
arXiv Detail & Related papers (2022-01-30T11:10:06Z) - Do Transformers Really Perform Bad for Graph Representation? [62.68420868623308]
We present Graphormer, which is built upon the standard Transformer architecture.
Our key insight to utilizing Transformer in the graph is the necessity of effectively encoding the structural information of a graph into the model.
arXiv Detail & Related papers (2021-06-09T17:18:52Z) - A Graph VAE and Graph Transformer Approach to Generating Molecular
Graphs [1.6631602844999724]
We propose a variational autoencoder and a transformer based model which fully utilise graph convolutional and graph pooling layers.
The transformer model implements a novel node encoding layer, replacing the position encoding typically used in transformers, to create a transformer with no position information that operates on graphs.
In experiments we chose a benchmark task of molecular generation, given the importance of both generated node and edge features.
arXiv Detail & Related papers (2021-04-09T13:13:06Z) - Structural Information Preserving for Graph-to-Text Generation [59.00642847499138]
The task of graph-to-text generation aims at producing sentences that preserve the meaning of input graphs.
We propose to tackle this problem by leveraging richer training signals that can guide our model for preserving input information.
Experiments on two benchmarks for graph-to-text generation show the effectiveness of our approach over a state-of-the-art baseline.
arXiv Detail & Related papers (2021-02-12T20:09:01Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.