You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# 🚀 Improving Source Code Similarity Detection with GraphCodeBERT and Additional Feature Integration
1
2
2
-
# Improving Source Code Similarity Detection with GraphCodeBERT and Additional Feature Integration
3
-
This repository contains the implementation of a novel approach for source code similarity detection that integrates an additional output feature into the classification process to enhance model performance. The approach is based on the GraphCodeBERT model, which has been extended with a custom output feature layer and a concatenation mechanism to improve feature representation. The model has been trained and evaluated on the IR-Plag dataset, demonstrating significant improvements in precision, recall, and f-measure. The full implementation, including model architecture, training strategies, and evaluation metrics, is available in this repository.
3
+
This repository contains the implementation of a novel approach for source code similarity detection that integrates an additional output feature into the classification process to enhance model performance. The approach is based on the **GraphCodeBERT** model, which has been extended with a custom output feature layer and a concatenation mechanism to improve feature representation. The model has been trained and evaluated on the **IR-Plag dataset**, demonstrating significant improvements in precision, recall, and f-measure. The full implementation, including model architecture, training strategies, and evaluation metrics, is available in this repository.
Accurate and efficient detection of similar source code fragments is crucial for maintaining software quality, improving developer productivity, and ensuring code integrity. With the rise of deep learning (DL) and natural language processing (NLP) techniques, transformer-based models have become a preferred approach for understanding and processing source code.
10
13
11
-
In this project, we extend the capabilities of GraphCodeBERT—a transformer model specifically designed to process the structural and semantic properties of programming languages. By integrating an additional output feature layer and using a concatenation mechanism, our approach enhances the model's ability to represent source code, leading to better performance in similarity detection tasks.
14
+
In this project, we extend the capabilities of **GraphCodeBERT**—a transformer model specifically designed to process the structural and semantic properties of programming languages. By integrating an additional output feature layer and using a concatenation mechanism, our approach enhances the model's ability to represent source code, leading to better performance in similarity detection tasks.
12
15
13
-
### Repository Contents
16
+
### 📂 Repository Contents
14
17
15
-
-`graphcodebert_fint.ipynb`: Jupyter Notebook that includes the full implementation of the model, from data loading and preprocessing to training, evaluation, and results interpretation. Detailed comments and documentation are provided within the notebook. It is optimized to be used in Google Colab since the use of a GPU is highly recommended.
16
-
-`fine-tunning-graphcodebert-karnalim-with-features.py`: The source code in the form of a standard python app.
18
+
-**`graphcodebert_fint.ipynb`**: A Jupyter Notebook that includes the full implementation of the model, from data loading and preprocessing to training, evaluation, and results interpretation. Detailed comments and documentation are provided within the notebook. **It is optimized to be used in Google Colab since the use of a GPU is highly recommended.**
19
+
-**`fine-tunning-graphcodebert-karnalim-with-features.py`**: The source code in the form of a standard Python app.
17
20
21
+
---
18
22
19
23
## 🛠️ Methodology
20
24
21
-
### Model Architecture
22
-
The model is an extension of GraphCodeBERT, which is a transformer-based model pre-trained on large corpora of code and designed to capture both textual and structural properties of code. We introduce a custom output feature layer and concatenate the pooled output of the transformer with this processed feature, allowing the model to learn a richer representation of the source code.
25
+
### 🔍 Model Architecture
26
+
27
+
The model is an extension of **GraphCodeBERT**, a transformer-based model pre-trained on large corpora of code and designed to capture both textual and structural properties of code. We introduce a custom output feature layer and concatenate the pooled output of the transformer with this processed feature, allowing the model to learn a richer representation of the source code.
28
+
29
+
### 📊 Dataset
30
+
31
+
We utilize the **IR-Plag dataset**, which is specifically designed for benchmarking source code similarity detection techniques, particularly in academic plagiarism contexts. The dataset contains 467 code files, with 355 labeled as plagiarized. The diversity in coding styles and structures within this dataset makes it ideal for evaluating the effectiveness of our model.
23
32
24
-
### Dataset
25
-
We utilize the IR-Plag dataset, which is specifically designed for benchmarking source code similarity detection techniques, particularly in academic plagiarism contexts. The dataset contains 467 code files, with 355 labeled as plagiarized. The diversity in coding styles and structures within this dataset makes it ideal for evaluating the effectiveness of our model.
33
+
### 🏋️ Training and Evaluation
26
34
27
-
### Training and Evaluation
28
35
The training process included random splits of the dataset into training, validation, and test sets. Key metrics such as precision, recall, and f-measure were computed to evaluate the model's performance. The notebook documents the training arguments, including batch size, number of epochs, and learning rate adjustments.
29
36
37
+
---
30
38
31
-
## 📈 Results
32
-
Our experimental results show that the integration of an additional output feature significantly enhances the model's performance. Specifically, our extended version of GraphCodeBERT achieved the highest precision, recall, and f-measure compared to other state-of-the-art techniques.
39
+
## 📈 Results
40
+
41
+
Our experimental results show that the integration of an additional output feature significantly enhances the model's performance. Specifically, our extended version of **GraphCodeBERT** achieved the highest precision, recall, and f-measure compared to other state-of-the-art techniques.
33
42
34
43
The table below summarizes the performance of various approaches:
0 commit comments