Downloads · 30 days
11
55% of all-time downloads
Theworst1/deberta-v3-prompt-injection_1
deberta-v3-prompt-injection_1 is a machine learning model from Theworst1. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft.
A LoRA adapter for prompt injection detection, fine-tuned on top of ProtectAI's DeBERTa v3 base model using a two-stage training approach.
Downloads · 30 days
11
55% of all-time downloads
All-time downloads
20
Public
Repo size
6 MB
Likes
0
Public
Click a slice to open those files.
.json8.7 MB · 59%
From the Hugging Face model README
A LoRA adapter for prompt injection detection, fine-tuned on top of ProtectAI's DeBERTa v3 base model using a two-stage training approach.
This model is a LoRA (Low-Rank Adaptation) fine-tuned version of ProtectAI/deberta-v3-base-prompt-injection for binary sequence classification (safe vs. injection). The model was trained in two stages on different prompt injection datasets to improve generalization.
Stage 1: Fine-tuned on xTRam1/safe-guard-prompt-injection
Stage 2: Continued training on reshabhs/SPML_Chatbot_Prompt_Injection
LoRA Configuration:
["query_proj", "key_proj", "value_proj", "o_proj"]Training Arguments (both stages):
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from peft import PeftModel
# Load base model and tokenizer
base_model_name = "ProtectAI/deberta-v3-base-prompt-injection"
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
model = AutoModelForSequenceClassification.from_pretrained(base_model_name)
# Load LoRA adapter
model = PeftModel.from_pretrained(model, "path/to/deberta-pi-lora-final-adapter")
# Inference
text = "Your input text here"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=256)
outputs = model(**inputs)
prediction = outputs.logits.argmax(-1).item() # 0 = safe, 1 = injection