|
# Identifier-Renaming |
|
|
|
<!-- Provide a quick summary of what the model is/does. --> |
|
Generating higher quality variable names for code by renaming masked variable names. |
|
## Model Details |
|
|
|
### Model Description |
|
|
|
<!-- Provide a longer summary of what this model is. --> |
|
|
|
|
|
|
|
- **Model type:** Masked Language model |
|
- **Language(s) (NLP):** Coded in Python to handle Java code |
|
- **Finetuned from model:** GraphCodeBERT |
|
|
|
### Model Sources [optional] |
|
|
|
<!-- Provide the basic links for the model. --> |
|
|
|
- **Repository:** https://anonymous.4open.science/r/Identifier-Renaming-653F |
|
|
|
## Uses |
|
|
|
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. --> |
|
Input Java code snippets with all instances of a particular variable name replaced by "[MASK]"<br> |
|
Input the number of tokens desired in the variable name (how long should it be). Else, input "0" to get a random number of tokens sampled from |
|
training data distribution<br> |
|
The code snippets must ideally be entire classes for best results. A prediction for the masked variable name is presented as output. |
|
|
|
### Out-of-Scope Use |
|
|
|
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. --> |
|
This non-fine-tuned version of the model is designed for generic code completion tasks. The fine-tuned model is designed to focus solely on identifier names.<br> |
|
Ensure all instances of a particular variable name are masked. |
|
|
|
## Bias, Risks, and Limitations |
|
|
|
<!-- This section is meant to convey both technical and sociotechnical limitations. --> |
|
Training is only done for a relatively small dataset and few epochs, and thus, the model might be under-trained. <br> |
|
Even with the correct output, the syntax of the model can be occasionally dubious.<br> |
|
The model is not perfect, and identifier renamings must be reviewed till performance in test settings is not evaluated. |
|
|
|
|
|
### Recommendations |
|
|
|
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. --> |
|
|
|
Use the model as described and verify outputs before using them. |
|
## How to Get Started with the Model |
|
|
|
Clone the repository and load model state dict using 'model_26_2' |
|
|
|
|
|
### Training Details |
|
|
|
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. --> |
|
Trained on a subset of a dataset of 1000 classes with 612 lines of code on average for 3 epochs and a Learning Rate of 2e-5. |
|
|
|
|
|
|
|
## Evaluation |
|
227 Java classes used for evaluation |
|
|
|
<!-- This section describes the evaluation protocols and provides the results. --> |
|
Perplexty of Base Model: 37580<br> |
|
Perplexity of Fine-tuned Model: 23 |
|
|
|
|
|
|
|
#### Metrics |
|
|
|
<!-- These are the evaluation metrics being used, ideally with a description of why. --> |
|
Perplexity is used to evaluate the performance of the model. It judges how surprising it is for a model to predict the given text. |
|
|
|
|
|
<!-- Relevant interpretability work for the model goes here --> |
|
|
|
|
|
|
|
|
|
|