InferCode: Self-Supervised Learning of Code Representations by Predicting Subtrees
The DOI matches its Crossref record; 74 of the 75 references it cites were found in a registry or an index.
Abstract
Learning code representations has found many uses in software engineering, such as code classification, code search, comment generation, and bug prediction, etc. Although representations of code in tokens, syntax trees, dependency graphs, paths in trees, or the combinations of their variants have been proposed, existing learning techniques have a major limitation that these models are often trained on datasets labeled for specific downstream tasks, and as such the code representations may not be suitable for other tasks. Even though some techniques generate representations from unlabeled code, they are far from being satisfactory when applied to the downstream tasks. To overcome the limitation, this paper proposes InferCode, which adapts the self-supervised learning idea from natural language processing to the abstract syntax trees (ASTs) of code. The novelty lies in the training of code representations by predicting subtrees automatically identified from the contexts of ASTs. With InferCode, subtrees in ASTs are treated as the labels for training the code representations without any human labelling effort or the overhead of expensive graph construction, and the trained representations are no longer tied to any specific downstream tasks or code units. We have trained an instance of InferCode model using Tree-Based Convolutional Neural Network (TBCNN) as the encoder of a large set of Java code. This pre-trained model can then be applied to downstream unsupervised tasks such as code clustering, code clone detection, cross-language code search, or be reused under a transfer learning scheme to continue training the model weights for supervised tasks such as code classification and method name prediction. Compared to prior techniques applied to the same downstream tasks, such as code2vec, code2seq, ASTNN, using our pre-trained InferCode model higher performance is achieved with a significant margin for most of the tasks, including those involving different programming languages. The implementation of InferCode and the trained embeddings are available at the link: https://github.com/bdqnghi/infercode.
Overview
The claims and statistics of this paper haven’t been checked yet.
Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.
Integrity signals
Registry
Cites
Statistics
Verification
Claims the paper makes
The claims and statistics of this paper haven’t been checked yet.
Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.
Claims other papers make about this one
Each is checked against this paper’s own text: does it say what the citing paper says it does?
The cited source says what the claim attributes to it.
In the citing paper
“This case may degenerate the code generation task for Bef. problems into querying code in the database (i.e., code reuse [43], [4], [44]).”
From No Need to Lift a Finger Anymore? Assessing the Quality of Code Generation by ChatGPT (2024) · cites this paper as [4]
Self-check
Percentages, sums and reported differences re-computed from the paper’s own numbers.
The self-check needs the paper’s full text.
Citations
Cites
Adam: A Method for Stochastic Optimization
Kingma, D. P., & Ba, J. (2014) · arXiv · doi:10.48550/arxiv.1412.6980 · Cited by 98,946
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
Devlin, J., Chang, M.-W., Lee, K., & Toutanova, K. (2018) · arXiv · doi:10.48550/arxiv.1810.04805 · Cited by 73,173
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
Devlin, J., Chang, M.-W., Lee, K., & Toutanova, K. (2019) · Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers) · doi:10.18653/v1/n19-1423 · Cited by 54,325
(2008) · Journal of Machine Learning Research · Cited by 33,051
Distributed Representations of Words and Phrases and their Compositionality
Mikolov, T., Sutskever, I., Chen, K., Corrado, G., & Dean, J. (2013) · arXiv · doi:10.48550/arxiv.1310.4546 · Cited by 24,533
A fast learning algorithm for deep belief nets
Hinton, G. E., Osindero, S., & Teh, Y.-W. (2006) · Neural Computation · doi:10.1162/neco.2006.18.7.1527 · Cited by 16,336
Convolutional Neural Networks for Sentence Classification
Kim, Y. (2014) · Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP) · doi:10.3115/v1/d14-1181 · Cited by 14,831
A simple framework for contrastive learning of visual representations
Chen, T., Kornblith, S., Norouzi, M., & Hinton, G. (2020) · arXiv · doi:10.48550/arxiv.2002.05709 · Cited by 10,857
Bidirectional recurrent neural networks
Schuster, M., & Paliwal, K. K. (1997) · IEEE Transactions on Signal Processing · doi:10.1109/78.650093 · Cited by 10,172 · cited 1×
“As the baselines, we include the ASTNN [44] trained from scratch, which is a state-of-the-art model for code classification on the OJ dataset, and TextCNN [67] and BiLSTM [68] trained with 100% of the training data, which are widely used for text classification.”
An efficient k-means clustering algorithm: analysis and implementation
Kanungo, T., Mount, D. M., Netanyahu, N. S., Piatko, C. D., Silverman, R., & Wu, A. Y. (2002) · IEEE Transactions on Pattern Analysis and Machine Intelligence · doi:10.1109/tpami.2002.1017616 · Cited by 5,660
Research works printed but not linked: 2
- R. Zhang, P. Isola, and A. A. Efros, "Colorful image col- orization," in European conference on computer vision, 2016, pp. 649-666.
- U. Alon, S. Brody, O. Levy, and E. Yahav, "code2seq: Generating sequences from structured representations of code," in ICLR, 2019.
Cited by
Items 101–159 of 159
A Novel Method for Code Clone Detection Based on Minimally Random Kernel Convolutional Transform
Abdelkader, M. (2024) · IEEE Access · doi:10.1109/access.2024.3484995 · Cited by 4
LSem2Vec: A Simple yet Effective Two-Stage Approach for Source Code EmbeddingPreprint
Xian, Z., Cui, C., Huang, R., Fang, C., & Chen, Z. (2024) · arXiv (Cornell University) · doi:10.48550/arxiv.2409.14644 · Cited by 4
De-duplicating Silent Compiler Bugs via Deep Semantic Representation
Chen, J., Fan, X., Yang, C., Liu, S., & Sun, J. (2025) · Proceedings of the ACM on software engineering. · doi:10.1145/3729375 · Cited by 3
SICode: Embedding-Based Subgraph Isomorphism Identification for Bug Detection
Gong, Y., Nie, J., You, W., Shi, W., Huang, J., Liang, B., & Zhang, J. (2024) · IEEE International Conference on Program Comprehension (ICPC) · doi:10.1145/3643916.3646556 · Cited by 3
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Hussain, A., Rabin, M. R. I., Xu, B., Lo, D., & Alipour, M. A. (2023) · doi:10.1109/intense59150.2023.00007 · Cited by 3
Yu, Y., Huang, Z., Shen, G., Li, W., & Shao, Y. (2023) · Science China Information Sciences · doi:10.1007/s11432-021-3665-1 · Cited by 3
Self-citationExploring JVM Garbage Collector Testing with Event-Coverage
Zheng, K., Wang, Z., Zhao, Y., Chen, J., You, H., Wang, H., Du, Y., & Gao, T. (2026) · ACM Transactions on Software Engineering and Methodology · doi:10.1145/3733598 · Cited by 3
(2025) · doi:10.18653/v1/2025.findings-naacl.370 · Cited by 2
Self-citationBoosting Metamorphic Relation Prediction via Code Representation Learning: An Empirical Study
Zheng, X., Jiang, M., & Zhou, Z. Q. (2024) · Software Testing Verification and Reliability · doi:10.1002/stvr.1889 · Cited by 2
VarGAN: Adversarial Learning of Variable Semantic Representations
Lin, Y., Wan, C., Bai, S., & Gu, X. (2024) · IEEE Transactions on Software Engineering · doi:10.1109/tse.2024.3391730 · Cited by 2
A Survey of the Full Process of Code Search Based on Deep Learning
Fang, M., Hu, H., Hu, F., & Liu, J. (2025) · Concurrency and Computation Practice and Experience · doi:10.1002/cpe.70277 · Cited by 2
PATVD:Vulnerability Detection Based on Pre-training Techniques and Adversarial Training
Yu, W., Kou, G., Liu, Q., Zhang, H., & Wang, Q. (2022) · IEEE Smart World Congress (SWC) · doi:10.1109/smartworld-uic-atc-scalcom-digitaltwin-pricomp-metaverse56740.2022.00253 · Cited by 2
Martinet, T., Cleuziou, G., Exbrayat, M., & Flouvat, F. (2024) · Frontiers in artificial intelligence and applications · doi:10.3233/faia240733 · Cited by 2
Fajriyah, R. F., & Nugroho, Y. S. (2025) · Jurnal Pendidikan dan Teknologi Indonesia · doi:10.52436/1.jpti.817 · Cited by 2
Training on Clean Data but Getting Backdoored Models! A Poisoning Attack on Code Encoders
Xiao, Y., Liu, X., Yang, Z., Bo, L., & Sun, X. (2026) · ACM/IEEE International Conference on Software Engineering: Companion Proceedings (ICSE-Companion) · doi:10.1145/3744916.3773236 · Cited by 1
Quantifying cross-language code reuse via function-level clone detection
Rong, Y., & Zhou, Y. (2025) · Journal of King Saud University - Computer and Information Sciences · doi:10.1007/s44443-025-00362-2 · Cited by 1
Dong, J., Fan, G., Yu, Y.-M., Liang, Y., Ye, Y., Yu, H., & Chen, W. (2025) · IEEE Annual International Computer Software and Applications Conference (COMPSAC) · doi:10.1109/compsac65507.2025.00150 · Cited by 1
Self-citationSimple and efficient Hash sketching for tree-structured data
Wu, W., Jiang, M., Luo, C. W., & Li, F. (2024) · Expert Systems with Applications · doi:10.1016/j.eswa.2024.125973 · Cited by 1
Code Clone Detection Based on Contrastive Learning
Xie, C., Liang, Y., Lv, Q., & Wan, Z. (2024) · IEEE International Conference on Software Engineering and Artificial Intelligence (SEAI) · doi:10.1109/seai62072.2024.10674596 · Cited by 1
Source Code Representations of Deep Learning for Program Repair
Chen, Z. (2023) · KTH Publication Database DiVA (KTH Royal Institute of Technology) · Cited by 1
On the role of context in AI-driven program repair and test generation
Nashid, N. (2026) · cIRcle (University of British Columbia) · Cited by 1
Beyond Test Cases: Multi-Agent Collaboration for Detecting Errors in Full-Score Code Implementations
Li, Y., Liu, J., Hu, Y., Liu, C., Zhang, Y., Yin, L., & Dong, W. (2025) · Proceedings/Proceedings of the ... International Conference on Software Engineering and Knowledge Engineering · doi:10.18293/seke2025-053 · Cited by 1
A Code Comment Generation Method Based on Information Retrieval and Code Structure
Zhou, Y., Li, D., Zhang, H., Xiang, X., Jiang, X., & Liu, H. (2024) · International Symposium on Artificial Intelligence and Intelligent Manufacturing (AIIM) · doi:10.1109/aiim64537.2024.10934152 · Cited by 1
JG2Time: A Learned Time Estimator for Join Operators Based on Heterogeneous Join-Graphs
Miao, H., Chen, J., Lin, Y., Xu, M., Han, Y., & Gao, J. (2023) · Lecture notes in computer science · doi:10.1007/978-3-031-30637-2_9 · Cited by 1
Using Machine Learning to Identify Patterns in Learner-Submitted Code for the Purpose of Assessment
Tarcsay, B., Tellez, F. P., & Vasić, J. (2023) · Lecture notes in computer science · doi:10.1007/978-3-031-33783-3_5 · Cited by 1
A Comprehensive Evaluation of Large Language Models for Method Name PredictionPreprint
Qian, H., Xu, T., Ding, Z., Liu, W., Zhu, S., Yin, J., Feng, X., Fang, C., Zhao, J., & Sun, W. (2024) · SSRN Electronic Journal · doi:10.2139/ssrn.4886577
A Survey of Learning-based Method Name Prediction
Qian, H., Liu, W., Xu, T., Yin, J., Feng, X., Sun, W., Ding, Z., Chen, Y., Miao, Y., Li, J., et al. (2026) · ACM Transactions on Software Engineering and Methodology · doi:10.1145/3771999
Hesamolhokama, M., Sadeghi, A., Moeini, K., Rohani, B., Fazli, M., & Habibi, J. (2026) · arXiv (Cornell University) · doi:10.48550/arxiv.2608.22383
LevDetectCode: Zero-Shot Detection of AI-Generated Code Using Levenshtein Distance
Fu, J., Shen, G., Huang, Z., Yu, Y., & Zhao, Y. D. (2025) · International Journal of Software Engineering and Knowledge Engineering · doi:10.1142/s0218194025500524
Self-citationStructural Syntax Network for Code ClassificationPreprint
Shah, M., Patel, R., & Terry, A. (2023) · Preprints.org · doi:10.20944/preprints202312.0805.v1
Feature Slice Matching for Precise Bug Detection
Ma, K., Huang, J., You, W., Liang, B., Wu, J., Wu, Y., & Gong, Y. (2026) · Proceedings of the ACM on software engineering. · doi:10.1145/3797080
Recommendation System for Finding Semantically Similar Fragments of Program Code
Зорин, В. И., & Lipachev, E. K. (2026) · Automatic Documentation and Mathematical Linguistics · doi:10.3103/s0005105526700573
Enhancing Representations Based on Inherent Information
Zhuang, Z., & Zhang, P. (2024) · IEEE Annual International Computer Software and Applications Conference (COMPSAC) · doi:10.1109/compsac61105.2024.00160
A Method for Detecting Numerical Defects in Deep Learning Programs Based on Abstract Interpretation
Xu, R., Dong, Y., Li, Y., Zeng, Q., & Dong, W. (2025) · International Conference on Computer Science, Engineering, and Education (CSEE) · doi:10.1109/csee64583.2025.00037
Zero-Shot Code Representation Learning via Prompt TuningPreprint
Cui, N., Gu, X., & Shen, B. (2024) · arXiv (Cornell University) · doi:10.48550/arxiv.2404.08947
A 5 Year Bibliometric Review of Programming Language Research Dynamics in Southeast Asia (2018-2023)
Delmo, A. L., Despi, J. R., & Arpon, P. K. J. (2024) · Asian Journal of Research in Computer Science · doi:10.9734/ajrcos/2024/v17i2420
Contextual Transformer-based Node Embedding for Vulnerability Detection using Graph Learning
Gear, J., Xu, Y., Foo, E., Gauravaram, P., Jadidi, Z., & Simpson, L. R. (2024) · IEEE International Conference on Trust, Security and Privacy in Computing and Communications (TrustCom) · doi:10.1109/trustcom63139.2024.00282
A Framework for Software Code and Model Smell Detection through Self-Supervised Learning
Alazba, A. (2024) · Research Publication Repository of King Fahd University of Petroleum and Minerals (King Fahd University of Petroleum and Minerals)
Deep Learning for Source Code Vulnerability Detection using Code Graphs
Gear, J. (2025) · QUT ePrints (Queensland University of Technology) · doi:10.5204/thesis.eprints.260434
Beryllium: Neural Search for Algorithm ImplementationsPreprint
Kulkarni, A., Chakraborty, M., Sium, Y. A., Valluri, S. C., Le, W., & Li, Q. (2023) · arXiv (Cornell University) · doi:10.48550/arxiv.2305.15690
SemanticCloneBenchを用いた深層学習に基づくコードクローン検出手法の評価
鶴, 智., 松下, 誠., & 肥後, 芳. (2024) · Institutional Repositories DataBase (IRDB) · doi:10.14923/transinfj.2023jdp7022
Lost in The Latent Space: Understanding, Auditing, and Evaluating Machine Learning Models for Code
Majdinasab, V. (2025) · PolyPublie (École Polytechnique de Montréal)
Next Generation Mutation Testing: Continuous, Predictive, and ML-enabled
MA, W. (2022) · Open Repository and Bibliography (University of Luxembourg)
Automation in Open Source Software: A GitHub Marketplace Analysis
Saroar, S. G. (2023) · YorkSpace (York University)
AST GRAPH FEATURES FOR CODE SIMILARITY SCREENING IN A CONTROLLED SYNTHETIC STUDY
Nurcahyo, R., Putri, A. R. W., & Yusuf, T. A. (2026) · International Journal of Cyber Engineering · doi:10.68404/ijce.v2i1.25
Extracting library features from incomplete code on Stack Overflow
Velázquez-Rodríguez, C. (2024) · VUBIR (Vrije Universiteit Brussel)
Leytón, G. (2025) · Univalle Digital Repository (University of Valle)
Analysing the Behaviour of Tree-Based Neural Networks in Regression TasksPreprint
Samoaa, P., Farahani, M., Longa, A., Leitner, P., & Chehreghani, M. H. (2024) · arXiv (Cornell University) · doi:10.48550/arxiv.2406.11437
Dong, Z. (2024) · Institutional Repositories DataBase (IRDB)
A Recommendation System for Finding Semantically Similar Fragments of Program Code
Зорин, В. И., & Lipachev, E. K. (2026) · Russian Digital Libraries Journal · doi:10.26907/1562-5419-2026-29-3-751-781
Su, T., Chen, M., Cheng, H., & Yan, Z. (2025) · International Conference on Education Technology and Computer · doi:10.1109/icetc66579.2025.11387161
Sun, L., Huang, Y., Ma, L., & Wang, Z. (2026) · arXiv (Cornell University) · doi:10.48550/arxiv.2610.39519
Geng, M., Duan, B., Guo, Y., Chen, H., Liu, B., & Shi, Z. (2024) · International Conference on Image Processing, Computer Vision and Machine Learning (ICICML) · doi:10.1109/icicml63543.2024.10958089
自動テスト生成技術を利用した機能等価メソッドデータセットの構築
肥後, 芳. (2023) · Institutional Repositories DataBase (IRDB)
VulSEG: Enhanced graph-based vulnerability detection system with advanced text embedding
Cai, W., Liu, X., & Gao, L. (2025) · Information and Software Technology · doi:10.1016/j.infsof.2025.108007
Research on code defect detection technology based on multimodal representation learning
Xiao, P., Luo, K., Hao, W., & Xiao, Q. (2026) · International Conference on Computer Graphics, Artificial Intelligence, and Data Processing (ICCAID) · doi:10.1117/12.3102255
Analysis of Method Name Prediction in the Era of Large Language Model
Ding, Z. (2026) · UNSWorks (University of New South Wales, Sydney, Australia) · doi:10.26190/unsworks/32441
KG-Commit: A Dynamic Knowledge Graph for Online Just-in-Time Software Defect Prediction
Hesamolhokama, M., Aghbash, M. S. B., Rohani, B., Fazli, M., & Habibi, J. (2026) · arXiv · doi:10.48550/arxiv.2609.06272
Metadata
- Authors
- Bui, N. D. Q., Yu, Y., & Jiang, L.
- Venue
- 2021 IEEE/ACM 43rd International Conference on Software Engineering (ICSE)
- Publisher
- IEEE
- Published
- 2021-05
- Pages
- 1186-1197
- OpenAlex
- W3162962341
- Cited by
- 102
- References
- 75
- FWCI
- 18.81
- Type
- conference paper
- Language
- en
- Open access
- closed
- Funders
- Ministry of Education
- Royal Society
About these checks
Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.
Statistics and arithmetic are recomputed, not judged.
Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.
What counts as a claim ›How we measure confidence ›How we check this ›
Are you an author, or do you see a problem with this page? Request a review
Data sources
Bibliographic data: Semantic Scholar, OpenAlex, Crossref.
Contains information from the Semantic Scholar Academic Graph Datasets, made available under the ODC Attribution License (ODC-BY 1.0).
Semantic Scholar’s data is described in: Kinney, R., et al. (2023). The Semantic Scholar Open Data Platform. arXiv:2301.10140.