Lune

EMNLP2021Top-tier venue

CAST: Enhancing Code Summarization with Hierarchical Splitting and Reconstruction of Abstract Syntax Trees

Ensheng Shi, Yanlin Wang, Lun Du, Hongyu Zhang, Shi Han, Dongmei Zhang, Hongbin Sun

Abstract

Code summarization aims to generate concise natural language descriptions of source code, which can help improve program comprehension and maintenance. Recent studies show that syntactic and structural information extracted from abstract syntax trees (ASTs) is conducive to summary generation. However, existing approaches fail to fully capture the rich information in ASTs because of the large size/depth of ASTs. In this paper, we propose a novel model CAST that hierarchically splits and reconstructs ASTs. First, we hierarchically split a large AST into a set of subtrees and utilize a recursive neural network to encode the subtrees. Then, we aggregate the embeddings of subtrees by reconstructing the split ASTs to get the representation of the complete AST. Finally, AST representation, together with source code embedding obtained by a vanilla code token encoder, is used for code summarization. Extensive experiments, including the ablation study and the human evaluation, on benchmarks have demonstrated the power of CAST. To facilitate reproducibility, our code and data are available at https://github.com/ DeepSoftwareAnalytics/CAST .

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

18 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • CoCoSoDa: Effective Contrastive Learning for Code Search cites RACE: Retrieval-augmented Commit Message Generation
  • CoCoSoDa: Effective Contrastive Learning for Code Search cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • CoCoSoDa: Effective Contrastive Learning for Code Search cites On the Evaluation of Neural Code Summarization
  • CoCoSoDa: Effective Contrastive Learning for Code Search cites Retrieval-based neural source code summarization
  • CoCoSoDa: Effective Contrastive Learning for Code Search cites GraphCodeBERT: Pre-training Code Representations with Data Flow
  • CoCoSoDa: Effective Contrastive Learning for Code Search cites Code Completion by Modeling Flattened Abstract Syntax Trees as Graphs
  • Developer-Intent Driven Code Comment Generation cites Are we building on the rock? on the importance of data preprocessing for code summarization
  • Developer-Intent Driven Code Comment Generation cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Developer-Intent Driven Code Comment Generation cites Retrieval-based neural source code summarization
  • Developer-Intent Driven Code Comment Generation cites GraphCodeBERT: Pre-training Code Representations with Data Flow
  • RACE: Retrieval-augmented Commit Message Generation cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • RACE: Retrieval-augmented Commit Message Generation cites On the Evaluation of Neural Code Summarization
  • RACE: Retrieval-augmented Commit Message Generation cites Retrieval-based neural source code summarization
  • Are we building on the rock? on the importance of data preprocessing for code summarization cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Are we building on the rock? on the importance of data preprocessing for code summarization cites On the Evaluation of Neural Code Summarization
  • Are we building on the rock? on the importance of data preprocessing for code summarization cites Retrieval-based neural source code summarization
  • On the Evaluation of Neural Code Summarization cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • On the Evaluation of Neural Code Summarization cites Retrieval-based neural source code summarization
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers18

  1. On the Evaluation of Neural Code SummarizationEnsheng Shi, Yanlin Wang, Lun Du, Junjie Chen et al.ICSE 2022 · 76 citations
  2. Are we building on the rock? on the importance of data preprocessing for code summarizationLin Shi, Fangwen Mu, Xiao Chen, Song Wang et al.FSE 2022 · 65 citations
  3. CoCoSoDa: Effective Contrastive Learning for Code SearchEnsheng Shi, Yanlin Wang, Wenchao Gu, Lun Du et al.ICSE 2023 · 45 citations
  4. RACE: Retrieval-augmented Commit Message GenerationEnsheng Shi, Yanlin Wang, Wei Tao, Lun Du et al.EMNLP 2022 · 36 citations
  5. Developer-Intent Driven Code Comment GenerationFangwen Mu, Xiao Chen, Lin Shi, Song Wang et al.ICSE 2023 · 25 citations

Builds on8

  1. CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan et al.EMNLP Findings 2020 · 2,828 citations
  2. GraphCodeBERT: Pre-training Code Representations with Data FlowDaya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng et al.ICLR 2021 · 1,644 citations
  3. Retrieval-based neural source code summarizationJian Zhang, Xu Wang, Hongyu Zhang, Hailong Sun et al.ICSE 2020 · 242 citations
  4. InferCode: Self-Supervised Learning of Code Representations by Predicting SubtreesNghi D. Q. Bui, Yijun Yu, Lingxiao JiangICSE 2021 · 106 citations
  5. Code Completion by Modeling Flattened Abstract Syntax Trees as GraphsYanlin Wang, Hui LiAAAI 2021 · 96 citations

Related papers

  1. AST-Trans: Code Summarization with Efficient Tree-Structured AttentionZe Tang, Xiaoyu Shen, Chuanyi Li, Jidong Ge et al.ICSE 2022 · 57 citations
  2. Modeling Hierarchical Syntax Structure with Triplet Position for Source Code SummarizationJuncai Guo, Jin Liu, Yao Wan, Li Li et al.ACL 2022
  3. BLOCSUM: Block Scope-based Source Code Summarization via Shared Block RepresentationYunSeok Choi, Hyojun Kim, Jee-Hyong LeeACL Findings 2023 · 2 citations
  4. Learning Sequential and Structural Information for Source Code SummarizationYunSeok Choi, JinYeong Bak, CheolWon Na, Jee-Hyong LeeACL Findings 2021 · 34 citations
  5. MGF-ESE: An Enhanced Semantic Extractor with Multi-Granularity Feature Fusion for Code SummarizationXiaolong Xu, Yuxin Cao, Hongsheng Hu, Haolong Xiang et al.WWW 2025 · 4 citations
Dusk over the sea between two cliffs drawn in fine vertical lines