JOURNAL ARTICLE

Fret: Functional Reinforced Transformer With BERT for Code Summarization

Ruyun WangHanwen ZhangGuoliang LuLei LyuChen Lyu

Year: 2020 Journal:   IEEE Access Vol: 8 Pages: 135591-135604   Publisher: Institute of Electrical and Electronics Engineers

Abstract

Code summarization has long been viewed as a challenge in software engineering because of the difficulties of understanding source code and generating natural language. Some mainstream methods combine abstract syntax trees with language models to capture the structural information of the source code and generate relatively satisfactory comments. However, these methods are still deficient in code understanding and limited by the long dependency problem. In this paper, we propose a novel model called Fret, which stands for Functional REinforced Transformer with BERT. The model provides a new way to generate code comments by learning code functionalities and deepening code understanding while alleviating the problem of long dependency. For this purpose, a novel reinforcer is proposed for learning the functional contents of code so that more accurate summaries to describe the code functionalities can be generated. In addition, a more efficient algorithm is newly designed to capture the source code structure. The experimental results show that the effectiveness of our model is remarkable. Fret significantly outperforms all the state-of-the-art methods we examine. It pushes the BLEU-4 score to 24.32 for Java code summarization (14.23% absolute improvement) and the ROUGE-L score to 40.12 for Python. An ablation test is also conducted to further explore the impact of each component of our method.

Keywords:
Automatic summarization Computer science Source code Code (set theory) Programming language Artificial intelligence Dependency (UML) Natural language processing Theoretical computer science

Metrics

46
Cited By
8.21
FWCI (Field Weighted Citation Impact)
68
Refs
0.97
Citation Normalized Percentile
Is in top 1%
Is in top 10%

Citation History

Topics

Software Engineering Research
Physical Sciences →  Computer Science →  Information Systems
Topic Modeling
Physical Sciences →  Computer Science →  Artificial Intelligence
Web Data Mining and Analysis
Physical Sciences →  Computer Science →  Information Systems

Related Documents

JOURNAL ARTICLE

Code Structure–Guided Transformer for Source Code Summarization

Shuzheng GaoCuiyun GaoYulan HeJichuan ZengLunyiu NieXin XiaMichael R. Lyu

Journal:   ACM Transactions on Software Engineering and Methodology Year: 2022 Vol: 32 (1)Pages: 1-32
BOOK-CHAPTER

Code Summarization Through Learning Linearized AST Paths with Transformer

Zhenzhou TianCuiping ZhangBinhui Tian

Lecture notes on data engineering and communications technologies Year: 2023 Pages: 53-60
JOURNAL ARTICLE

Source Code Summarization with Structural Relative Position Guided Transformer

Zi GongCuiyun GaoYasheng WangWenchao GuYun PengZenglin Xu

Journal:   2022 IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER) Year: 2022 Pages: 13-24
© 2026 ScienceGate Book Chapters — All rights reserved.