Methods
Model
Base model: protectai/deberta-v3-base-prompt-injection-v2 at revision 90c9989b1a342275dd0d1a95aad283c04e075671, an existing DeBERTa-v3-base sequence classifier (labels SAFE / INJECTION). No new architecture or head: the whole model is fine-tuned, and the detection score is logit(INJECTION) − logit(SAFE). The unmodified base model is reported as the comparison arm.
Data
Agentic Prompt-Injection Boundary Pairs (CC BY 4.0), pinned at commit 30af820d. Each pair holds one text that preserves an intended authorization boundary and one that tries to cross it. The author's splits are grouped by scenario:
| Split | Rows | Attack / benign | Scenarios |
| Train | 840 | 420 / 420 | 35 |
| Validation | 120 | 60 / 60 | 5 |
| Test | 240 | 120 / 120 | 10 |
Pre-training checks used train and validation only: no duplicate texts and no pair or scenario overlap between them. The test split was not read until all three runs had finished and the thresholds were frozen; it was then checked (hash, schema, duplicates, pairs, and no scenario or pair overlap with train or validation) before any scoring. Only the text is used as input; no metadata.
Training
Three runs with seeds 42, 43 and 44 and an identical recipe, all reported (no best-seed selection): 3 epochs (159 optimizer steps), AdamW with learning rate 2e-5 and weight decay 0.01, 9 warm-up steps then linear decay, effective batch 16 (4 × 4 accumulation; each epoch has 210 micro-batches, so its last optimizer step accumulates only 2), max length 512 tokens, binary cross-entropy on the score with positive weight 1. Training ran on Apple MPS in fp32, which is not bit-deterministic.
Thresholds and baselines
Each model's threshold was chosen on validation data only: the most attacks caught with at most 1 of 60 benign false alarms. Full-precision thresholds: base model 14.985377311706543; seed 42 −2.541528105735779; seed 43 −2.8378076553344727; seed 44 −2.841301918029785. Thresholds and two simple baselines were frozen before the test set was read once:
- Phrase-list baseline: word pairs that occur in at least 10 training rows of one class and none of the other. It was chosen after a validation diagnostic, so it is an adaptive baseline.
- Length baseline: flag any text of 32 or more tokens.