Code Structure Guided Transformer for Source Code Summarization
Gao, Shuzheng, Gao, Cuiyun, He, Yulan, Zeng, Jichuan, Nie, Lun Yiu, Xia, Xin, Lyu, Michael R.
–arXiv.org Artificial Intelligence
Code summaries help developers comprehend programs and reduce their time to infer the program functionalities during software maintenance. Recent efforts resort to deep learning techniques such as sequence-to-sequence models for generating accurate code summaries, among which Transformer-based approaches have achieved promising performance. However, effectively integrating the code structure information into the Transformer is under-explored in this task domain. In this paper, we propose a novel approach named SG-Trans to incorporate code structural properties into Transformer. Specifically, we inject the local symbolic information (e.g., code tokens and statements) and global syntactic structure (e.g., data flow graph) into the self-attention module of Transformer as inductive bias. To further capture the hierarchical characteristics of code, the local information and global structure are designed to distribute in the attention heads of lower layers and high layers of Transformer. Extensive evaluation shows the superior performance of SG-Trans over the state-of-the-art approaches. Compared with the best-performing baseline, SG-Trans still improves 1.4% and 2.0% in terms of METEOR score, a metric widely used for measuring generation quality, respectively on two benchmark datasets.
arXiv.org Artificial Intelligence
Jul-22-2022
- Country:
- Oceania > Australia
- North America
- United States
- Texas > Travis County
- Austin (0.04)
- Michigan > Washtenaw County
- Ann Arbor (0.04)
- Minnesota > Hennepin County
- Minneapolis (0.14)
- Illinois > Champaign County
- Urbana (0.04)
- Nevada > Clark County
- Las Vegas (0.04)
- Louisiana > Orleans Parish
- New Orleans (0.04)
- Pennsylvania > Philadelphia County
- Philadelphia (0.04)
- California
- San Francisco County > San Francisco (0.14)
- Los Angeles County > Long Beach (0.14)
- San Diego County > San Diego (0.04)
- New York > New York County
- New York City (0.04)
- Texas > Travis County
- Canada
- Quebec > Montreal (0.04)
- British Columbia > Metro Vancouver Regional District
- Vancouver (0.14)
- United States
- Europe
- Austria (0.04)
- Hungary > Budapest
- Budapest (0.04)
- Italy > Tuscany
- Florence (0.04)
- Germany
- Berlin (0.04)
- Saarland > Saarbrücken (0.04)
- Spain
- Galicia > Madrid (0.04)
- Catalonia > Barcelona Province
- Barcelona (0.04)
- Bulgaria > Sofia City Province
- Sofia (0.04)
- United Kingdom > England
- West Midlands > Coventry (0.04)
- Greece > Attica
- Athens (0.04)
- Belgium > Flanders
- Antwerp Province > Antwerp (0.04)
- Sweden
- Vaestra Goetaland > Gothenburg (0.04)
- Stockholm > Stockholm (0.04)
- France > Occitanie
- Hérault > Montpellier (0.04)
- Asia
- Taiwan > Taiwan Province
- Taipei (0.04)
- South Korea > Seoul
- Seoul (0.04)
- Middle East > Qatar
- China
- Hong Kong (0.04)
- Guangdong Province > Shenzhen (0.04)
- Heilongjiang Province > Harbin (0.04)
- Taiwan > Taiwan Province
- Africa
- South Africa > Western Cape
- Cape Town (0.04)
- Ethiopia > Addis Ababa
- Addis Ababa (0.04)
- South Africa > Western Cape
- Genre:
- Research Report > Promising Solution (0.86)
- Overview > Innovation (0.68)
- Industry:
- Information Technology (0.47)
- Technology: