paper-with-me

홈 › Papers

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

2023-11-10 · Zixiang Xian, Rubing Huang, Dave Towey, Chunrong Fang, Zhenyu Chen

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.

📄 PDF Abstract BibTeX arXiv:2311.08157

Code (1)

iamfaith/transformcode 공식 구현 pytorch

Tasks

Clone DetectionCode SearchContrastive LearningData AugmentationMethod name predictionTransfer Learning

Methods 이 논문이 사용한 방법론

Multi-Head Attention 설명 없음
Attention 설명 없음
Linear Layer A Linear Layer is a projection $\mathbf{XW + b}$.
Residual Connection 설명 없음
BPE Byte Pair Encoding, or BPE, is a subword segmentation algorithm that encodes rare and unknown words as sequences of subword units. The intuition is that various word…
Dropout Dropout is a regularization technique for neural networks that drops a unit (along with connections) at training time with a specified probability $p$ (a common value is…
Adam 설명 없음
Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…

Similar Papers 제목 키워드 기반

An Effective Approach to Embedding Source Code by Combining Large Language and Sentence Embedding Models

2024-09-23 · Zixiang Xian, Chenhui Cui, Rubing Huang, Chunrong Fang 외

The advent of large language models (LLMs) has significantly advanced artificial intelligence (AI) in software engineering (SE), with source code embeddings playing a crucial role in tasks such as source code clone detec…

Clone DetectionDomain AdaptationSentenceSentence Embedding+2

A Goal-Driven Tree-Structured Neural Model for Math Word Problems

2019-08-10 · Zhipeng Xie and Shichao Sun

Most existing neural models for math word problems exploit Seq2Seq model to generate solution expressions sequentially from left to right, whose results are far from satisfactory due to the lack of goal-driven mechani…

MathMath Word Problem Solving

Learning subtree pattern importance for Weisfeiler-Lehmanbased graph kernels

2021-06-08 · Dai Hai Nguyen, Canh Hao Nguyen, Hiroshi Mamitsuka

Graph is an usual representation of relational data, which are ubiquitous in manydomains such as molecules, biological and social networks. A popular approach to learningwith graph structured data is to make use of graph…

Graph Classification

GraphTreeGen: Subtree-Centric Approach to Efficient and Supervised Graph Generation

2025-08-13 · Yitong Luo, Islem Rekik arxiv

Brain connectomes, representing neural connectivity as graphs, are crucial for understanding brain organization but costly and time-consuming to acquire, motivating generative approaches. Recent advances in graph generat…

Graph Generation

Data Augmentation for Machine Translation via Dependency Subtree Swapping

2023-07-13 · Attila Nagy, Dorina Petra Lakatos, Botond Barta, Patrick Nanys 외

We present a generic framework for data augmentation via dependency subtree swapping that is applicable to machine translation. We extract corresponding subtrees from the dependency parse trees of the source and target s…

Data AugmentationMachine TranslationTranslation