Skip to content

Commit f63ca31

Browse files
Update README.md
1 parent e241c22 commit f63ca31

File tree

1 file changed

+62
-2
lines changed

1 file changed

+62
-2
lines changed

README.md

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,62 @@
1-
# graphcodebert-feature-integration
2-
Improving Source Code Similarity Detection with GraphCodeBERT and Additional Feature Integration
1+
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.
4+
5+
[![arXiv](https://img.shields.io/badge/arXiv-2405.02095-b31b1b.svg)](https://arxiv.org/abs/2405.02095)
6+
7+
8+
## 🌍 Introduction
9+
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+
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.
12+
13+
### Repository Contents
14+
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.
16+
17+
18+
## 🛠️ Methodology
19+
20+
### Model Architecture
21+
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.
22+
23+
### Dataset
24+
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.
25+
26+
### Training and Evaluation
27+
The model was trained using PyTorch and the Hugging Face Transformers library. 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.
28+
29+
30+
## 📈 Results
31+
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.
32+
33+
The table below summarizes the performance of various approaches:
34+
35+
| Approach | Precision | Recall | F-Measure |
36+
|----------------------------------|-----------|--------|-----------|
37+
| CodeBERT | 0.72 | 1.00 | 0.84 |
38+
| Output Analysis | 0.88 | 0.93 | 0.90 |
39+
| Boosting (XGBoost) | 0.88 | 0.99 | 0.93 |
40+
| Bagging (Random Forest) | 0.95 | 0.97 | 0.96 |
41+
| GraphCodeBERT | 0.98 | 0.95 | 0.96 |
42+
| **Our GraphCodeBERT variant** | **0.98** | **1.00**| **0.99** |
43+
44+
45+
## 📚 Reference
46+
47+
If you use this work, please cite:
48+
49+
```
50+
@misc{martinezgil2024advanced,
51+
title={Advanced Detection of Source Code Clones via an Ensemble of Unsupervised Similarity Measures},
52+
author={Jorge Martinez-Gil},
53+
year={2024},
54+
eprint={2405.02095},
55+
archivePrefix={arXiv},
56+
primaryClass={cs.SE}
57+
}
58+
```
59+
60+
## 📄 License
61+
62+
The project is provided under the MIT License.

0 commit comments

Comments
 (0)