mlsanityData to 7 Oct 2026

TransformCode: A Contrastive Learning Framework for Code Embedding via Subtree Transformation

arXiv 2311.08157 ↗First posted 10 Nov 2023cs.SE cs.AIcited by 4

Not on the map. Why?

Abstract (arXiv)

Artificial intelligence (AI) has revolutionized software engineering (SE) by enhancing software development efficiency. The advent of pre-trained models (PTMs) leveraging transfer learning has significantly advanced AI for SE. However, existing PTMs that operate on individual code tokens suffer from several limitations: They are costly to train and fine-tune; and they rely heavily on labeled data for fine-tuning on task-specific datasets. In this paper, we present TransformCode, a novel framework that learns code embeddings in a contrastive learning manner. Our framework is encoder-agnostic and language-agnostic, which means that it can leverage any encoder model and handle any programming language. We also propose a novel data-augmentation technique called abstract syntax tree (AST) transformation, which applies syntactic and semantic transformations to the original code snippets, to generate more diverse and robust samples for contrastive learning. Our framework has several advantages over existing methods: (1) It is flexible and adaptable, because it can easily be extended to other downstream tasks that require code representation (such as code-clone detection and classification); (2) it is efficient and scalable, because it does not require a large model or a large amount of training data, and it can support any programming language; (3) it is not limited to unsupervised learning, but can also be applied to some supervised learning tasks by incorporating task-specific labels or objectives; and (4) it can also adjust the number of encoder parameters based on computing resources. We evaluate our framework on several code-related tasks, and demonstrate its effectiveness and superiority over the state-of-the-art methods such as SourcererCC, Code2vec, and InferCode.

Key facts. Cited by 4 papers in the map (data through 7 Oct 2026). Builds on 53 of its 102 references that are in the map. First posted on arXiv 10 Nov 2023.

Builds on

53 of 102 references.

References · 53

  1. 2017Attention Is All You Needcited by 59,932
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  3. 2020Language Models are Few-Shot Learnerscited by 32,199
  4. 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,084
  5. 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,266
  6. 2020A Simple Framework for Contrastive Learning of Visual Representationscited by 11,979
  7. 2016Semi-Supervised Classification with Graph Convolutional Networkscited by 11,282
  8. 2018Representation Learning with Contrastive Predictive Codingcited by 7,662
  9. 2019Momentum Contrast for Unsupervised Visual Representation Learningcited by 7,482
  10. 2016XGBoost: A Scalable Tree Boosting Systemcited by 5,120
  11. 2020Bootstrap your own latent: A new approach to self-supervised Learningcited by 4,712
  12. 2022Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedbackcited by 3,634
38 more
  1. 2015Neural Machine Translation of Rare Words with Subword Unitscited by 2,898
  2. 2020Exploring Simple Siamese Representation Learningcited by 2,853
  3. 2020Improved Baselines with Momentum Contrastive Learningcited by 2,282
  4. 2021SimCSE: Simple Contrastive Learning of Sentence Embeddingscited by 2,168
  5. 2016Convolutional Neural Networks on Graphs with Fast Localized Spectral Filteringcited by 2,085
  6. 2018Unsupervised Feature Learning via Non-Parametric Instance-level Discriminationcited by 1,838
  7. 2020Big Self-Supervised Models are Strong Semi-Supervised Learnerscited by 1,375
  8. 2019Contrastive Multiview Codingcited by 1,297
  9. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  10. 2014Convolutional Neural Networks for Sentence Classificationcited by 1,124
  11. 2018Self-Attention with Relative Position Representationscited by 1,112
  12. 2015Gated Graph Sequence Neural Networkscited by 792
  13. 2018Subword Regularization: Improving Neural Network Translation Models with Multiple Subword Candidatescited by 632
  14. 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
  15. 2021Unified Pre-training for Program Understanding and Generationcited by 361
  16. 2022Text and Code Embeddings by Contrastive Pre-Trainingcited by 358
  17. 2019A Multiscale Visualization of Attention in the Transformer Modelcited by 292
  18. 2019Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networkscited by 266
  19. 2018code2vec: Learning Distributed Representations of Codecited by 249
  20. 2019Unsupervised Embedding Learning via Invariant and Spreading Instance Featurecited by 231
  21. 2017Learning to Represent Programs with Graphscited by 219
  22. 2020Data Augmentation for Graph Neural Networkscited by 200
  23. 2018code2seq: Generating Sequences from Structured Representations of Codecited by 177
  24. 2020Deep Learning based Vulnerability Detection: Are We There Yet?cited by 142
  25. 2020A Transformer-based Approach for Source Code Summarizationcited by 129
  26. 2014Learning to Executecited by 105
  27. 2020Retrieval-Augmented Generation for Code Summarization via Hybrid GNNcited by 89
  28. 2020Contrastive Code Representation Learningcited by 76
  29. 2020Detecting Code Clones with Graph Neural Networkand Flow-Augmented Abstract Syntax Treecited by 68
  30. 2020Self-Supervised Contrastive Learning for Code Retrieval and Summarization via Semantic-Preserving Transformationscited by 49
  31. 2015SourcererCC: Scaling Code Clone Detection to Big Codecited by 40
  32. 2021Code Structure Guided Transformer for Source Code Summarizationcited by 29
  33. 2020InferCode: Self-Supervised Learning of Code Representations by Predicting Subtreescited by 23
  34. 2023CodeTF: One-stop Transformer Library for State-of-the-art Code LLMscited by 21
  35. 2018Oreo: Detection of Clones in the Twilight Zonecited by 19
  36. 2019A Literature Study of Embeddings on Source Codecited by 18
  37. 2020TreeCaps: Tree-Based Capsule Networks for Source Code Processingcited by 16
  38. 2020Modeling Functional Similarity in Source Code with Graph-Based Siamese Networkscited by 10

50 most cited of 53 All 53 (JSON)

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 1; 2025: 2; 2026: 1.

4 papers.