Trained Here, Tested There: A Cross-Dataset Evaluation of Prompt-Injection Detectors on Five Public Datasets

Classifiers that flag prompt injections are a common first defence for LLM applications, and their reported accuracy usually comes from held-out data drawn from the same sources they were trained on. We test how well such detectors transfer. We evaluate seven detectors on five public datasets: a fixed keyword heuristic, four TF-IDF logistic-regression models each trained on one dataset, and two openly available fine-tuned DeBERTa-v3 classifiers. The datasets are deepset prompt-injections, safe-guard-prompt-injection, jailbreak-classification, SPML and Gandalf ignore-instructions. Every detector scored well on its own source, with AUROC between 0.955 and 0.999. On other sources, the TF-IDF models averaged an AUROC of 0.872 (range 0.727–0.987), and the deepset classifier fell from 0.997 on its own data to 0.666 and 0.789 on two others. Thresholds transferred worse than rankings. Thresholds set for a 1% false-positive rate on the training source gave false-positive rates of 26% or more in five of twelve cross-dataset cases (up to 79.7%), and recall fell as low as 3.5%. The ProtectAI v2 classifier was the most robust, with AUROC of at least 0.979 on three of the four labelled test sets and 100% recall on Gandalf. It still caught only 36.7% of injections in the deepset test set and flagged 12.0% of benign SPML prompts. The keyword heuristic never produced a false positive, but caught only 14–42% of injections. No detector reached 90% recall at 5% or fewer false positives on all four labelled test sets. Exact-text overlap between test and training sets was small, except that 108 safe-guard test prompts also appear in the jailbreak training set. Detector accuracy should be reported across datasets and at a fixed operating point, not only as in-distribution AUROC. Code, logs and derived data to reproduce every number are in the attached archive. Preprint, not peer-reviewed.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-11-25
DOI
https://doi.org/10.5281/zenodo.24543118
Primary Topic
Adversarial Robustness in Machine Learning
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

Trained Here, Tested There: A Cross-Dataset Evaluation of Prompt-Injection Detectors on Five Public Datasets

Akil Hassane
Zenodo (CERN European Organization for Nuclear Research)
Adversarial Robustness in Machine Learning
preprint

Trained Here, Tested There: A Cross-Dataset Evaluation of Prompt-Injection Detectors on Five Public Datasets

Akil Hassane
preprint en

Abstract

Classifiers that flag prompt injections are a common first defence for LLM applications, and their reported accuracy usually comes from held-out data drawn from the same sources they were trained on. We test how well such detectors transfer. We evaluate seven detectors on five public datasets: a fixed keyword heuristic, four TF-IDF logistic-regression models each trained on one dataset, and two openly available fine-tuned DeBERTa-v3 classifiers. The datasets are deepset prompt-injections, safe-guard-prompt-injection, jailbreak-classification, SPML and Gandalf ignore-instructions. Every detector scored well on its own source, with AUROC between 0.955 and 0.999. On other sources, the TF-IDF models averaged an AUROC of 0.872 (range 0.727–0.987), and the deepset classifier fell from 0.997 on its own data to 0.666 and 0.789 on two others. Thresholds transferred worse than rankings. Thresholds set for a 1% false-positive rate on the training source gave false-positive rates of 26% or more in five of twelve cross-dataset cases (up to 79.7%), and recall fell as low as 3.5%. The ProtectAI v2 classifier was the most robust, with AUROC of at least 0.979 on three of the four labelled test sets and 100% recall on Gandalf. It still caught only 36.7% of injections in the deepset test set and flagged 12.0% of benign SPML prompts. The keyword heuristic never produced a false positive, but caught only 14–42% of injections. No detector reached 90% recall at 5% or fewer false positives on all four labelled test sets. Exact-text overlap between test and training sets was small, except that 108 safe-guard test prompts also appear in the jailbreak training set. Detector accuracy should be reported across datasets and at a fixed operating point, not only as in-distribution AUROC. Code, logs and derived data to reproduce every number are in the attached archive. Preprint, not peer-reviewed.

Zenodo (CERN European Organization for Nuclear Research)
Adversarial Robustness in Machine Learning
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon