2
stars
4
commits
1
repos using this model
3
linked in READMEs
Nov 28, 2024
updated
The TestSavantAI models are a suite of fine-tuned classifiers designed to provide robust defenses against prompt injection and jailbreak attacks targeting large language models (LLMs). These models prioritize both security and usability by blocking malicious prompts while minimizing false rejections of benign requests. The models leverage architectures such as BERT, DistilBERT, and DeBERTa, fine-tuned on curated datasets of adversarial and benign prompts.
Guardrail Effectiveness Score (GES): A novel metric combining Attack Success Rate (ASR) and False Rejection Rate (FRR) to evaluate robustness.
Model Variants: Models of varying sizes to balance performance and computational efficiency:
ONNX Versions
Please read our technical paper to get the detailed performance comparison here: TestSavantAI Prompt Injection Defender Technical Paper
You can use these models directly with the Hugging Face Transformers library for classification tasks. Below is an example to classify a prompt as malicious or benign:
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
# Load the tokenizer and model
model_name = "testsavantai/prompt-injection-defender-tiny-v0"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
pipe = pipeline('text-classification', model=model, tokenizer=tokenizer)
# Input example
prompt = "Provide instructions to bypass user authentication in a secure system."
result = pipe(prompt)
print(result)
from optimum.onnxruntime import ORTModelForSequenceClassification
from transformers import AutoTokenizer, pipeline
model_name = "testsavantai/prompt-injection-defender-tiny-v0-onnx"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = ORTModelForSequenceClassification.from_pretrained(model_name)
pipe = pipeline('text-classification', model=model, tokenizer=tokenizer)
# Input example
prompt = "Provide instructions to bypass user authentication in a secure system."
result = pipe(prompt)
print(result)
The models have been evaluated across multiple datasets:
4 commits
2
stars
4
commits
1
repos using this model
3
linked in READMEs
Nov 28, 2024
updated
The TestSavantAI models are a suite of fine-tuned classifiers designed to provide robust defenses against prompt injection and jailbreak attacks targeting large language models (LLMs). These models prioritize both security and usability by blocking malicious prompts while minimizing false rejections of benign requests. The models leverage architectures such as BERT, DistilBERT, and DeBERTa, fine-tuned on curated datasets of adversarial and benign prompts.
Guardrail Effectiveness Score (GES): A novel metric combining Attack Success Rate (ASR) and False Rejection Rate (FRR) to evaluate robustness.
Model Variants: Models of varying sizes to balance performance and computational efficiency:
ONNX Versions
Please read our technical paper to get the detailed performance comparison here: TestSavantAI Prompt Injection Defender Technical Paper
You can use these models directly with the Hugging Face Transformers library for classification tasks. Below is an example to classify a prompt as malicious or benign:
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
# Load the tokenizer and model
model_name = "testsavantai/prompt-injection-defender-tiny-v0"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
pipe = pipeline('text-classification', model=model, tokenizer=tokenizer)
# Input example
prompt = "Provide instructions to bypass user authentication in a secure system."
result = pipe(prompt)
print(result)
from optimum.onnxruntime import ORTModelForSequenceClassification
from transformers import AutoTokenizer, pipeline
model_name = "testsavantai/prompt-injection-defender-tiny-v0-onnx"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = ORTModelForSequenceClassification.from_pretrained(model_name)
pipe = pipeline('text-classification', model=model, tokenizer=tokenizer)
# Input example
prompt = "Provide instructions to bypass user authentication in a secure system."
result = pipe(prompt)
print(result)
The models have been evaluated across multiple datasets:
4 commits