arrow
返回

Reinforcement-Learning-Guided Source Code Summarization Using Hierarchical Attention

delete2022-01-01
delete61
delete
OA
AI
W
Wenhua Wang
Y
Yuqun Zhang *
Y
Yulei Sui
Y
Yao Wan
周炤 封面图
周炤 (Zhou Zhao)
吴坚 (Jian Wu)
P
Philip S. Yu
G
Guandong Xu *
DOI:10.1109/TSE.2020.2979701delete
delete原文链接
delete分享
delete收藏
查看原文
摘要

摘要

En 中文
Code summarization (aka comment generation) provides a high-level natural language description of the function performed by code, which can benefit the software maintenance, code categorization and retrieval. To the best of our knowledge, the state-of-the-art approaches follow an encoder-decoder framework which encodes source code into a hidden space and later decodes it into a natural language space. Such approaches suffer from the following drawbacks: (a) they are mainly input by representing code as a sequence of tokens while ignoring code hierarchy; (b) most of the encoders only input simple features (e.g., tokens) while ignoring the features that can help capture the correlations between comments and code; (c) the decoders are typically trained to predict subsequent words by maximizing the likelihood of subsequent ground truth words, while in real world, they are excepted to generate the entire word sequence from scratch. As a result, such drawbacks lead to inferior and inconsistent comment generation accuracy. To address the above limitations, this paper presents a new code summarization approach using hierarchical attention network by incorporating multiple code features, including type-augmented abstract syntax trees and program control flows. Such features, along with plain code sequences, are injected into a deep reinforcement learning (DRL) framework (e.g., actor-critic network) for comment generation. Our approach assigns weights (pays attention) to tokens and statements when constructing the code representation to reflect the hierarchical code structure under different contexts regarding code features (e.g., control flows and abstract syntax trees). Our reinforcement learning mechanism further strengthens the prediction results through the actor network and the critic network, where the actor network provides the confidence of predicting subsequent words based on the current state, and the critic network computes the reward values of all the possible extensions of the current state to provide global guidance for explorations. Eventually, we employ an advantage reward to train both networks and conduct a set of experiments on a real-world dataset. The experimental results demonstrate that our approach outperforms the baselines by around 22 to 45 percent in BLEU-1 and outperforms the state-of-the-art approaches by around 5 to 60 percent in terms of S-BLEU and C-BLEU.
Keyword:
Code summarization
hierarchical attention
reinforcement learning
AI总结

AI总结

对已上传原文的论文进行重点信息的提取,主要内容包括:简要概述、研究摘要、背景介绍、关键亮点、图文解析、展望与总结。

期刊

IEEE Transactions on Software Engineering 封面图
IEEE Transactions on Software Engineering
IF:
5.6
论文数:
2.8K
被引数:
1.1W

机构

University of Illinois System 封面图
University of Illinois System
学者数:
6.8W
论文数: 6.2W
被引数: 644
U
university of technology sydney
学者数:
1.6W
论文数: 2.0W
被引数: 25
Z
zhejiang university
学者数:
17.7W
论文数: 12.1W
被引数: 152
学者 查看更多机构
引用论文

引用论文

Exposure of Pancreatic β-Cells to Excess Glucose Results in Bimodal Activation of mTORC1 and mTOR-Dependent Metabolic Acceleration
err2020-02-01
err0
errOAAI
errCourtney Zasha Rumala; Juan Liu; Jason Wei Locasale; Barbara Ellen Corkey; Jude Thaddeus Deeney; Lucia Egydio Rameh
err分享
err收藏
err分享
err收藏
Drug prescription errors in a Brazilian hospital巴西某医院的药物处方错误
err2011-05-01
err0
PREAI
errEugenie Desiree Rabelo Néri; Paulo Gean Chaves Gadêlha; Sâmia Graciele Maia; Ana Graziela da Silva Pereira; Paulo César de Almeida; Carlos Roberto Martins Rodrigues; Milena Pontes Portela; Marta Maria de França Fonteles
err分享
err收藏
Physical Activity in Community‐Dwelling Stroke Survivors and a Healthy Population Is Not Explained by Motor Function Only
err2013-08-23
err0
PREAI
errAnna Danielsson; Cristiane Meirelles; Carin Willen; Katharina Stibrant Sunnerhagen
err分享
err收藏
学者 查看更多内容