This model is a fine-tuned version of microsoft/deberta-v3-base on the [promp-injection] dataset. It achieves the following results on the evaluation set:
This model detects prompt injection attempts and classifies them as "INJECTION". Legitimate requests are classified as "LEGIT". The dataset assumes that legitimate requests are either all sorts of questions of key word searches.
If you are using this model to secure your system and it is overly "trigger-happy" to classify requests as injections, consider collecting legitimate examples and retraining the model with the [promp-injection] dataset.
import argparse
import torch
from openmind import pipeline, is_torch_npu_available
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--model_name_or_path",
default=None,
type=str,
help="Path to model",
required=False,
)
args = parser.parse_args()
return args
if __name__=="__main__":
args = parse_args()
if is_torch_npu_available():
device = "npu:0"
else:
device = "cpu"
#推理
classifier = pipeline('text-classification', model=args.model_name_or_path, device=device)
print(classifier('The camera quality of this phone is amazing.'))Based in the [promp-injection] dataset.
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|---|---|---|---|---|
| No log | 1.0 | 69 | 0.2353 | 0.9741 |
| No log | 2.0 | 138 | 0.0894 | 0.9741 |
| No log | 3.0 | 207 | 0.0673 | 0.9914 |
deepset is the company behind the production-ready open-source AI framework Haystack.
Some of our other work:
For more info on Haystack, visit our GitHub repo and Documentation.
We also have a Discord community open to everyone!
Twitter | LinkedIn | Discord | GitHub Discussions | Website | YouTube
By the way: we're hiring!