返回
Reinforcement-Learning-Guided Source Code Summarization Using Hierarchical Attention
DOI:10.1109/TSE.2020.2979701.png)
摘要
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总结
对已上传原文的论文进行重点信息的提取,主要内容包括:简要概述、研究摘要、背景介绍、关键亮点、图文解析、展望与总结。
期刊
IF:
5.6
论文数:
2.8K
被引数:
1.1W
机构
引用论文
Molecular motion in plastic phases of organometallic compounds: iron-57 Mössbauer and carbon-13 n.m.r. spectra of tricarbonyl(1–5-hapto-cyclohexadienyl)iron tetrafluoroborate and related compounds有机金属化合物的塑料相中的分子运动: 铁-57 m ö ssbauer和碳-13 n.m.r.三羰基 (1-5-半环己二烯基) 四氟硼酸铁和相关化合物的光谱
Exposure of Pancreatic β-Cells to Excess Glucose Results in Bimodal Activation of mTORC1 and mTOR-Dependent Metabolic Acceleration
iScience
IF0
Physical Activity in Community‐Dwelling Stroke Survivors and a Healthy Population Is Not Explained by Motor Function Only
PM&R
IF0
Two decades of statistical language modeling: Where do we go from here?统计语言建模二十年: 我们何去何从?
PROCEEDINGS OF THE IEEE
IF25.9

