HELoC: Hierarchical Contrastive Learning of Source Code Representation
Not on the map. Why?
Abstract (arXiv)
Abstract syntax trees (ASTs) play a crucial role in source code representation. However, due to the large number of nodes in an AST and the typically deep AST hierarchy, it is challenging to learn the hierarchical structure of an AST effectively. In this paper, we propose HELoC, a hierarchical contrastive learning model for source code representation. To effectively learn the AST hierarchy, we use contrastive learning to allow the network to predict the AST node level and learn the hierarchical relationships between nodes in a self-supervised manner, which makes the representation vectors of nodes with greater differences in AST levels farther apart in the embedding space. By using such vectors, the structural similarities between code snippets can be measured more precisely. In the learning process, a novel GNN (called Residual Self-attention Graph Neural Network, RSGNN) is designed, which enables HELoC to focus on embedding the local structure of an AST while capturing its overall structure. HELoC is self-supervised and can be applied to many source code related downstream tasks such as code classification, code clone detection, and code clustering after pre-training. Our extensive experiments demonstrate that HELoC outperforms the state-of-the-art source code representation models.
Key facts. Cited by 4 papers in the map (data through 7 Oct 2026). First posted on arXiv 27 Mar 2022.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2022: 2; 2023: 2.
4 papers.
- 2022DS-1000: A Natural and Reliable Benchmark for Data Science Code Generationcited by 442
- 2022HiCo: Hierarchical Contrastive Learning for Ultrasound Video Model Pretrainingcited by 7
- 2023TransformCode: A Contrastive Learning Framework for Code Embedding via Subtree Transformationcited by 4
- 2023Contrastive Learning for API Aspect Analysiscited by 0
- 2023TransformCode: A Contrastive Learning Framework for Code Embedding via Subtree Transformation10 Nov 2023
- 2023Contrastive Learning for API Aspect Analysis31 Jul 2023
- 2022DS-1000: A Natural and Reliable Benchmark for Data Science Code Generation18 Nov 2022
- 2022HiCo: Hierarchical Contrastive Learning for Ultrasound Video Model Pretraining10 Oct 2022