English

HierarchyNet: Learning to Summarize Source Code with Heterogeneous Representations

Software Engineering 2023-05-10 v3 Artificial Intelligence Programming Languages

Abstract

We propose a novel method for code summarization utilizing Heterogeneous Code Representations (HCRs) and our specially designed HierarchyNet. HCRs effectively capture essential code features at lexical, syntactic, and semantic levels by abstracting coarse-grained code elements and incorporating fine-grained program elements in a hierarchical structure. Our HierarchyNet method processes each layer of the HCR separately through a unique combination of the Heterogeneous Graph Transformer, a Tree-based CNN, and a Transformer Encoder. This approach preserves dependencies between code elements and captures relations through a novel Hierarchical-Aware Cross Attention layer. Our method surpasses current state-of-the-art techniques, such as PA-Former, CAST, and NeuralCodeSum.

Keywords

Cite

@article{arxiv.2205.15479,
  title  = {HierarchyNet: Learning to Summarize Source Code with Heterogeneous Representations},
  author = {Minh Huynh Nguyen and Nghi D. Q. Bui and Truong Son Hy and Long Tran-Thanh and Tien N. Nguyen},
  journal= {arXiv preprint arXiv:2205.15479},
  year   = {2023}
}
R2 v1 2026-06-24T11:33:52.962Z