Text Classification
Transformers
Safetensors
English
deberta-v2
prompt-injection
prompt-injection-detection
llm-security
llm-safety
ai-safety
deberta
Eval Results (legacy)
text-embeddings-inference
Instructions to use JHC04567/spid-deberta-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JHC04567/spid-deberta-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="JHC04567/spid-deberta-base")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("JHC04567/spid-deberta-base") model = AutoModelForSequenceClassification.from_pretrained("JHC04567/spid-deberta-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -43,6 +43,11 @@ model-index:
|
|
| 43 |
|
| 44 |
# SPID: Split-based Prompt Injection Detector
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
**SPID** is a lightweight (184M, ~1.5GB) pre-filter that blocks common prompt injection attacks before they reach expensive LLM APIs. By catching obvious attacks locally—even on CPU—SPID reduces API costs while large LLMs handle legitimate traffic.
|
| 47 |
|
| 48 |
The key innovation is **fragment-based detection**: SPID splits input into fragments and classifies each independently, catching compound attacks where a malicious instruction hides behind a benign prefix.
|
|
@@ -55,7 +60,7 @@ The key innovation is **fragment-based detection**: SPID splits input into fragm
|
|
| 55 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 56 |
import torch
|
| 57 |
|
| 58 |
-
model_id = "
|
| 59 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 60 |
model = AutoModelForSequenceClassification.from_pretrained(model_id)
|
| 61 |
|
|
|
|
| 43 |
|
| 44 |
# SPID: Split-based Prompt Injection Detector
|
| 45 |
|
| 46 |
+
<p align="center">
|
| 47 |
+
<img src="spid_architecture.png" width="85%">
|
| 48 |
+
</p>
|
| 49 |
+
|
| 50 |
+
|
| 51 |
**SPID** is a lightweight (184M, ~1.5GB) pre-filter that blocks common prompt injection attacks before they reach expensive LLM APIs. By catching obvious attacks locally—even on CPU—SPID reduces API costs while large LLMs handle legitimate traffic.
|
| 52 |
|
| 53 |
The key innovation is **fragment-based detection**: SPID splits input into fragments and classifies each independently, catching compound attacks where a malicious instruction hides behind a benign prefix.
|
|
|
|
| 60 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 61 |
import torch
|
| 62 |
|
| 63 |
+
model_id = "JHC04567/spid-deberta-base"
|
| 64 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 65 |
model = AutoModelForSequenceClassification.from_pretrained(model_id)
|
| 66 |
|