GraphCodeBERT vulnerability classifier (CPU-trained, 20K balanced subset)
Browse files- README.md +102 -0
- config.json +95 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +18 -0
- training_args.bin +3 -0
README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
base_model: huggingface/CodeBERTa-small-v1
|
| 4 |
+
tags:
|
| 5 |
+
- security
|
| 6 |
+
- vulnerability-detection
|
| 7 |
+
- code-analysis
|
| 8 |
+
- multi-label-classification
|
| 9 |
+
- graphcodebert
|
| 10 |
+
- owasp
|
| 11 |
+
- cwe
|
| 12 |
+
- generated_from_trainer
|
| 13 |
+
model-index:
|
| 14 |
+
- name: graphcodebert-vuln-classifier
|
| 15 |
+
results: []
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
| 19 |
+
should probably proofread and complete it, then remove this comment. -->
|
| 20 |
+
|
| 21 |
+
# graphcodebert-vuln-classifier
|
| 22 |
+
|
| 23 |
+
This model is a fine-tuned version of [huggingface/CodeBERTa-small-v1](https://huggingface.co/huggingface/CodeBERTa-small-v1) on an unknown dataset.
|
| 24 |
+
It achieves the following results on the evaluation set:
|
| 25 |
+
- Loss: 0.1884
|
| 26 |
+
- Macro F1: 0.1157
|
| 27 |
+
- Micro F1: 0.7043
|
| 28 |
+
- Weighted F1: 0.8779
|
| 29 |
+
- Macro Precision: 0.0871
|
| 30 |
+
- Macro Recall: 0.2759
|
| 31 |
+
- F1 Safe: 0.9464
|
| 32 |
+
- F1 Cwe-20: 0.0312
|
| 33 |
+
- F1 Cwe-22: 0.0
|
| 34 |
+
- F1 Cwe-78: 0.0
|
| 35 |
+
- F1 Cwe-79: 0.0
|
| 36 |
+
- F1 Cwe-89: 0.6
|
| 37 |
+
- F1 Cwe-94: 0.4348
|
| 38 |
+
- F1 Cwe-119: 0.1290
|
| 39 |
+
- F1 Cwe-125: 0.1333
|
| 40 |
+
- F1 Cwe-190: 0.4
|
| 41 |
+
- F1 Cwe-200: 0.0
|
| 42 |
+
- F1 Cwe-264: 0.0
|
| 43 |
+
- F1 Cwe-269: 0.0
|
| 44 |
+
- F1 Cwe-276: 0.0
|
| 45 |
+
- F1 Cwe-284: 0.0
|
| 46 |
+
- F1 Cwe-287: 0.0
|
| 47 |
+
- F1 Cwe-310: 0.0
|
| 48 |
+
- F1 Cwe-327: 0.0
|
| 49 |
+
- F1 Cwe-330: 0.0
|
| 50 |
+
- F1 Cwe-352: 0.0
|
| 51 |
+
- F1 Cwe-362: 0.0
|
| 52 |
+
- F1 Cwe-399: 0.1818
|
| 53 |
+
- F1 Cwe-401: 0.0
|
| 54 |
+
- F1 Cwe-416: 0.0
|
| 55 |
+
- F1 Cwe-434: 0.0
|
| 56 |
+
- F1 Cwe-476: 0.2105
|
| 57 |
+
- F1 Cwe-502: 0.2857
|
| 58 |
+
- F1 Cwe-601: 0.0
|
| 59 |
+
- F1 Cwe-787: 0.2326
|
| 60 |
+
- F1 Cwe-798: 0.0
|
| 61 |
+
- F1 Cwe-918: 0.0
|
| 62 |
+
|
| 63 |
+
## Model description
|
| 64 |
+
|
| 65 |
+
More information needed
|
| 66 |
+
|
| 67 |
+
## Intended uses & limitations
|
| 68 |
+
|
| 69 |
+
More information needed
|
| 70 |
+
|
| 71 |
+
## Training and evaluation data
|
| 72 |
+
|
| 73 |
+
More information needed
|
| 74 |
+
|
| 75 |
+
## Training procedure
|
| 76 |
+
|
| 77 |
+
### Training hyperparameters
|
| 78 |
+
|
| 79 |
+
The following hyperparameters were used during training:
|
| 80 |
+
- learning_rate: 5e-05
|
| 81 |
+
- train_batch_size: 8
|
| 82 |
+
- eval_batch_size: 16
|
| 83 |
+
- seed: 42
|
| 84 |
+
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
|
| 85 |
+
- lr_scheduler_type: cosine
|
| 86 |
+
- lr_scheduler_warmup_steps: 50
|
| 87 |
+
- num_epochs: 2
|
| 88 |
+
|
| 89 |
+
### Training results
|
| 90 |
+
|
| 91 |
+
| Training Loss | Epoch | Step | Validation Loss | Macro F1 | Micro F1 | Weighted F1 | Macro Precision | Macro Recall | F1 Safe | F1 Cwe-20 | F1 Cwe-22 | F1 Cwe-78 | F1 Cwe-79 | F1 Cwe-89 | F1 Cwe-94 | F1 Cwe-119 | F1 Cwe-125 | F1 Cwe-190 | F1 Cwe-200 | F1 Cwe-264 | F1 Cwe-269 | F1 Cwe-276 | F1 Cwe-284 | F1 Cwe-287 | F1 Cwe-310 | F1 Cwe-327 | F1 Cwe-330 | F1 Cwe-352 | F1 Cwe-362 | F1 Cwe-399 | F1 Cwe-401 | F1 Cwe-416 | F1 Cwe-434 | F1 Cwe-476 | F1 Cwe-502 | F1 Cwe-601 | F1 Cwe-787 | F1 Cwe-798 | F1 Cwe-918 |
|
| 92 |
+
|:-------------:|:-----:|:----:|:---------------:|:--------:|:--------:|:-----------:|:---------------:|:------------:|:-------:|:---------:|:---------:|:---------:|:---------:|:---------:|:---------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|
|
| 93 |
+
| 0.4733 | 1.0 | 250 | 0.2105 | 0.0955 | 0.7880 | 0.8794 | 0.0730 | 0.2053 | 0.9539 | 0.05 | 0.0 | 0.0 | 0.0 | 0.5455 | 0.3704 | 0.08 | 0.2 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.2857 | 0.1818 | 0.0 | 0.2941 | 0.0 | 0.0 |
|
| 94 |
+
| 0.4130 | 2.0 | 500 | 0.1884 | 0.1157 | 0.7043 | 0.8779 | 0.0871 | 0.2759 | 0.9464 | 0.0312 | 0.0 | 0.0 | 0.0 | 0.6 | 0.4348 | 0.1290 | 0.1333 | 0.4 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.1818 | 0.0 | 0.0 | 0.0 | 0.2105 | 0.2857 | 0.0 | 0.2326 | 0.0 | 0.0 |
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
### Framework versions
|
| 98 |
+
|
| 99 |
+
- Transformers 5.6.1
|
| 100 |
+
- Pytorch 2.11.0+cu130
|
| 101 |
+
- Datasets 4.8.4
|
| 102 |
+
- Tokenizers 0.22.2
|
config.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_cross_attention": false,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"RobertaForSequenceClassification"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"classifier_dropout": null,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"eos_token_id": 2,
|
| 11 |
+
"hidden_act": "gelu",
|
| 12 |
+
"hidden_dropout_prob": 0.1,
|
| 13 |
+
"hidden_size": 768,
|
| 14 |
+
"id2label": {
|
| 15 |
+
"0": "LABEL_0",
|
| 16 |
+
"1": "LABEL_1",
|
| 17 |
+
"2": "LABEL_2",
|
| 18 |
+
"3": "LABEL_3",
|
| 19 |
+
"4": "LABEL_4",
|
| 20 |
+
"5": "LABEL_5",
|
| 21 |
+
"6": "LABEL_6",
|
| 22 |
+
"7": "LABEL_7",
|
| 23 |
+
"8": "LABEL_8",
|
| 24 |
+
"9": "LABEL_9",
|
| 25 |
+
"10": "LABEL_10",
|
| 26 |
+
"11": "LABEL_11",
|
| 27 |
+
"12": "LABEL_12",
|
| 28 |
+
"13": "LABEL_13",
|
| 29 |
+
"14": "LABEL_14",
|
| 30 |
+
"15": "LABEL_15",
|
| 31 |
+
"16": "LABEL_16",
|
| 32 |
+
"17": "LABEL_17",
|
| 33 |
+
"18": "LABEL_18",
|
| 34 |
+
"19": "LABEL_19",
|
| 35 |
+
"20": "LABEL_20",
|
| 36 |
+
"21": "LABEL_21",
|
| 37 |
+
"22": "LABEL_22",
|
| 38 |
+
"23": "LABEL_23",
|
| 39 |
+
"24": "LABEL_24",
|
| 40 |
+
"25": "LABEL_25",
|
| 41 |
+
"26": "LABEL_26",
|
| 42 |
+
"27": "LABEL_27",
|
| 43 |
+
"28": "LABEL_28",
|
| 44 |
+
"29": "LABEL_29",
|
| 45 |
+
"30": "LABEL_30"
|
| 46 |
+
},
|
| 47 |
+
"initializer_range": 0.02,
|
| 48 |
+
"intermediate_size": 3072,
|
| 49 |
+
"is_decoder": false,
|
| 50 |
+
"label2id": {
|
| 51 |
+
"LABEL_0": 0,
|
| 52 |
+
"LABEL_1": 1,
|
| 53 |
+
"LABEL_10": 10,
|
| 54 |
+
"LABEL_11": 11,
|
| 55 |
+
"LABEL_12": 12,
|
| 56 |
+
"LABEL_13": 13,
|
| 57 |
+
"LABEL_14": 14,
|
| 58 |
+
"LABEL_15": 15,
|
| 59 |
+
"LABEL_16": 16,
|
| 60 |
+
"LABEL_17": 17,
|
| 61 |
+
"LABEL_18": 18,
|
| 62 |
+
"LABEL_19": 19,
|
| 63 |
+
"LABEL_2": 2,
|
| 64 |
+
"LABEL_20": 20,
|
| 65 |
+
"LABEL_21": 21,
|
| 66 |
+
"LABEL_22": 22,
|
| 67 |
+
"LABEL_23": 23,
|
| 68 |
+
"LABEL_24": 24,
|
| 69 |
+
"LABEL_25": 25,
|
| 70 |
+
"LABEL_26": 26,
|
| 71 |
+
"LABEL_27": 27,
|
| 72 |
+
"LABEL_28": 28,
|
| 73 |
+
"LABEL_29": 29,
|
| 74 |
+
"LABEL_3": 3,
|
| 75 |
+
"LABEL_30": 30,
|
| 76 |
+
"LABEL_4": 4,
|
| 77 |
+
"LABEL_5": 5,
|
| 78 |
+
"LABEL_6": 6,
|
| 79 |
+
"LABEL_7": 7,
|
| 80 |
+
"LABEL_8": 8,
|
| 81 |
+
"LABEL_9": 9
|
| 82 |
+
},
|
| 83 |
+
"layer_norm_eps": 1e-05,
|
| 84 |
+
"max_position_embeddings": 514,
|
| 85 |
+
"model_type": "roberta",
|
| 86 |
+
"num_attention_heads": 12,
|
| 87 |
+
"num_hidden_layers": 6,
|
| 88 |
+
"pad_token_id": 1,
|
| 89 |
+
"problem_type": "multi_label_classification",
|
| 90 |
+
"tie_word_embeddings": true,
|
| 91 |
+
"transformers_version": "5.6.1",
|
| 92 |
+
"type_vocab_size": 1,
|
| 93 |
+
"use_cache": false,
|
| 94 |
+
"vocab_size": 52000
|
| 95 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7c2863b59f345fa82b44d21d25483aa4ddd11665213b069e302f9a815985add4
|
| 3 |
+
size 333911404
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<s>",
|
| 5 |
+
"cls_token": "<s>",
|
| 6 |
+
"eos_token": "</s>",
|
| 7 |
+
"errors": "replace",
|
| 8 |
+
"is_local": false,
|
| 9 |
+
"local_files_only": false,
|
| 10 |
+
"mask_token": "<mask>",
|
| 11 |
+
"max_len": 512,
|
| 12 |
+
"model_max_length": 512,
|
| 13 |
+
"pad_token": "<pad>",
|
| 14 |
+
"sep_token": "</s>",
|
| 15 |
+
"tokenizer_class": "RobertaTokenizer",
|
| 16 |
+
"trim_offsets": true,
|
| 17 |
+
"unk_token": "<unk>"
|
| 18 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:faf024c35995c1b5bd61eaa1ad4ddbbfca5175a19eb3f2e13c5cb7779bdbc19c
|
| 3 |
+
size 5329
|