Text Classification
Transformers
Safetensors
English
distilbert
prompt-injection
security
cybersecurity
llm-security
ml-intern
text-embeddings-inference
Instructions to use av-codes/pi-detector-distilbert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use av-codes/pi-detector-distilbert with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="av-codes/pi-detector-distilbert")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("av-codes/pi-detector-distilbert") model = AutoModelForSequenceClassification.from_pretrained("av-codes/pi-detector-distilbert") - Notebooks
- Google Colab
- Kaggle
Best checkpoint - DistilBERT prompt injection detector, F1=1.0 val, 0.959 test
Browse files- config.json +36 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +15 -0
- trainer_state.json +116 -0
- training_args.bin +3 -0
config.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation": "gelu",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"DistilBertForSequenceClassification"
|
| 5 |
+
],
|
| 6 |
+
"attention_dropout": 0.1,
|
| 7 |
+
"bos_token_id": null,
|
| 8 |
+
"dim": 768,
|
| 9 |
+
"dropout": 0.1,
|
| 10 |
+
"dtype": "float32",
|
| 11 |
+
"eos_token_id": null,
|
| 12 |
+
"hidden_dim": 3072,
|
| 13 |
+
"id2label": {
|
| 14 |
+
"0": "safe",
|
| 15 |
+
"1": "injection"
|
| 16 |
+
},
|
| 17 |
+
"initializer_range": 0.02,
|
| 18 |
+
"label2id": {
|
| 19 |
+
"injection": 1,
|
| 20 |
+
"safe": 0
|
| 21 |
+
},
|
| 22 |
+
"max_position_embeddings": 512,
|
| 23 |
+
"model_type": "distilbert",
|
| 24 |
+
"n_heads": 12,
|
| 25 |
+
"n_layers": 6,
|
| 26 |
+
"pad_token_id": 0,
|
| 27 |
+
"problem_type": "single_label_classification",
|
| 28 |
+
"qa_dropout": 0.1,
|
| 29 |
+
"seq_classif_dropout": 0.2,
|
| 30 |
+
"sinusoidal_pos_embds": false,
|
| 31 |
+
"tie_weights_": true,
|
| 32 |
+
"tie_word_embeddings": true,
|
| 33 |
+
"transformers_version": "5.8.1",
|
| 34 |
+
"use_cache": false,
|
| 35 |
+
"vocab_size": 30522
|
| 36 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f3ec844b481b829bfd89701701cf86ed6be606573f76e8ec3fa27b135dfc2387
|
| 3 |
+
size 267832560
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"cls_token": "[CLS]",
|
| 4 |
+
"do_lower_case": true,
|
| 5 |
+
"is_local": false,
|
| 6 |
+
"local_files_only": false,
|
| 7 |
+
"mask_token": "[MASK]",
|
| 8 |
+
"model_max_length": 512,
|
| 9 |
+
"pad_token": "[PAD]",
|
| 10 |
+
"sep_token": "[SEP]",
|
| 11 |
+
"strip_accents": null,
|
| 12 |
+
"tokenize_chinese_chars": true,
|
| 13 |
+
"tokenizer_class": "BertTokenizer",
|
| 14 |
+
"unk_token": "[UNK]"
|
| 15 |
+
}
|
trainer_state.json
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"best_global_step": 99,
|
| 3 |
+
"best_metric": 1.0,
|
| 4 |
+
"best_model_checkpoint": "./pi-detector/checkpoint-99",
|
| 5 |
+
"epoch": 1.0,
|
| 6 |
+
"eval_steps": 500,
|
| 7 |
+
"global_step": 99,
|
| 8 |
+
"is_hyper_param_search": false,
|
| 9 |
+
"is_local_process_zero": true,
|
| 10 |
+
"is_world_process_zero": true,
|
| 11 |
+
"log_history": [
|
| 12 |
+
{
|
| 13 |
+
"epoch": 0.010101010101010102,
|
| 14 |
+
"grad_norm": 1.3391671180725098,
|
| 15 |
+
"learning_rate": 0.0,
|
| 16 |
+
"loss": 0.6838793754577637,
|
| 17 |
+
"step": 1
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"epoch": 0.10101010101010101,
|
| 21 |
+
"grad_norm": 1.2506626844406128,
|
| 22 |
+
"learning_rate": 1.8000000000000001e-06,
|
| 23 |
+
"loss": 0.6808025042215983,
|
| 24 |
+
"step": 10
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"epoch": 0.20202020202020202,
|
| 28 |
+
"grad_norm": 1.1518597602844238,
|
| 29 |
+
"learning_rate": 3.8000000000000005e-06,
|
| 30 |
+
"loss": 0.6861461639404297,
|
| 31 |
+
"step": 20
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"epoch": 0.30303030303030304,
|
| 35 |
+
"grad_norm": 1.91855788230896,
|
| 36 |
+
"learning_rate": 5.8e-06,
|
| 37 |
+
"loss": 0.6577313423156739,
|
| 38 |
+
"step": 30
|
| 39 |
+
},
|
| 40 |
+
{
|
| 41 |
+
"epoch": 0.40404040404040403,
|
| 42 |
+
"grad_norm": 1.835654854774475,
|
| 43 |
+
"learning_rate": 7.800000000000002e-06,
|
| 44 |
+
"loss": 0.5954501628875732,
|
| 45 |
+
"step": 40
|
| 46 |
+
},
|
| 47 |
+
{
|
| 48 |
+
"epoch": 0.5050505050505051,
|
| 49 |
+
"grad_norm": 1.999822735786438,
|
| 50 |
+
"learning_rate": 9.800000000000001e-06,
|
| 51 |
+
"loss": 0.5008408069610596,
|
| 52 |
+
"step": 50
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"epoch": 0.6060606060606061,
|
| 56 |
+
"grad_norm": 2.83133864402771,
|
| 57 |
+
"learning_rate": 1.18e-05,
|
| 58 |
+
"loss": 0.37516820430755615,
|
| 59 |
+
"step": 60
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"epoch": 0.7070707070707071,
|
| 63 |
+
"grad_norm": 1.6260528564453125,
|
| 64 |
+
"learning_rate": 1.38e-05,
|
| 65 |
+
"loss": 0.29813175201416015,
|
| 66 |
+
"step": 70
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"epoch": 0.8080808080808081,
|
| 70 |
+
"grad_norm": 1.7019435167312622,
|
| 71 |
+
"learning_rate": 1.58e-05,
|
| 72 |
+
"loss": 0.2266446352005005,
|
| 73 |
+
"step": 80
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"epoch": 0.9090909090909091,
|
| 77 |
+
"grad_norm": 1.1480830907821655,
|
| 78 |
+
"learning_rate": 1.7800000000000002e-05,
|
| 79 |
+
"loss": 0.17041007280349732,
|
| 80 |
+
"step": 90
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"epoch": 1.0,
|
| 84 |
+
"eval_accuracy": 1.0,
|
| 85 |
+
"eval_f1": 1.0,
|
| 86 |
+
"eval_loss": 0.032340291887521744,
|
| 87 |
+
"eval_precision": 1.0,
|
| 88 |
+
"eval_recall": 1.0,
|
| 89 |
+
"eval_runtime": 0.2543,
|
| 90 |
+
"eval_samples_per_second": 503.339,
|
| 91 |
+
"eval_steps_per_second": 15.729,
|
| 92 |
+
"step": 99
|
| 93 |
+
}
|
| 94 |
+
],
|
| 95 |
+
"logging_steps": 10,
|
| 96 |
+
"max_steps": 495,
|
| 97 |
+
"num_input_tokens_seen": 0,
|
| 98 |
+
"num_train_epochs": 5,
|
| 99 |
+
"save_steps": 500,
|
| 100 |
+
"stateful_callbacks": {
|
| 101 |
+
"TrainerControl": {
|
| 102 |
+
"args": {
|
| 103 |
+
"should_epoch_stop": false,
|
| 104 |
+
"should_evaluate": false,
|
| 105 |
+
"should_log": false,
|
| 106 |
+
"should_save": true,
|
| 107 |
+
"should_training_stop": false
|
| 108 |
+
},
|
| 109 |
+
"attributes": {}
|
| 110 |
+
}
|
| 111 |
+
},
|
| 112 |
+
"total_flos": 32576631053856.0,
|
| 113 |
+
"train_batch_size": 16,
|
| 114 |
+
"trial_name": null,
|
| 115 |
+
"trial_params": null
|
| 116 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ae22f7875c9b5a884d3c1d28b340e1a4ddf3dd21a23f7ab1eece96a498a9a384
|
| 3 |
+
size 5329
|