Downloads · 30 days
5
10% of all-time downloads
alvi42/prompt-injection-guard-v2
prompt-injection-guard-v2 is a text classification model from alvi42. Use it when you need a label for a piece of text. The card lists the license as mit.
DeBERTa-v3-base fine-tuned for binary prompt injection classification. Trained on the original 8,183-example dataset plus 1,687 synthetic examples targeting 5 documented v1 failure patterns.
Downloads · 30 days
5
10% of all-time downloads
All-time downloads
52
Public
Parameters
184M
740 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors738 MB · 99%
From the Hugging Face model README
DeBERTa-v3-base fine-tuned for binary prompt injection classification. Trained on the original 8,183-example dataset plus 1,687 synthetic examples targeting 5 documented v1 failure patterns.
| Benchmark | v1 | v2 | Delta |
|---|---|---|---|
| split_test (n=1,754) | 0.9957 | 0.9932 | -0.0025 |
The standard test set is saturated (v1 already missed only 7 of 1,754 examples). v2 was not measured to beat v1 on this benchmark by design intent of the synthetic data, which targets categories underrepresented in split_test. On a held-out adversarial slice built from the failure clusters (n=651, injection-heavy), v2 achieves 0.99 injection recall and 1.00 benign recall.
9,870 examples: 8,183 original (5 public datasets, deduplicated) + 1,687 synthetic examples generated via Claude Sonnet, deduplicated against existing training data via sentence embeddings, cross-validated with Claude Haiku (99.2% label agreement).
Synthetic data targets 5 failure clusters identified from v1 error analysis: non-English injections, very short injections, indirect jailbreaks framed as hypotheticals, legitimate role-play requests, and instruction-adjacent coding phrasing.
See the GitHub repository for the complete failure analysis, synthetic data pipeline, and quality filter documentation.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("alvi42/prompt-injection-guard-v2")
model = AutoModelForSequenceClassification.from_pretrained("alvi42/prompt-injection-guard-v2")