Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

When Benchmarks Lie: Evaluating Malicious Prompt Classifiers Under True Distribution Shift

About

Detecting prompt injection, jailbreak attacks, and harmful requests is critical for deploying LLM-based agents safely, yet current evaluation practices in this literature overestimate generalization. We train activation-based classifiers (linear probes on LLM hidden states) on a benchmark of 18 datasets (prompt attacks plus benign sources) and propose Leave-One-Dataset-Out (LODO) evaluation, where the held-out dataset is never seen during training. Across four LLMs from three families (Llama-3.1-8B, Gemma-3-27B, Qwen-3.5-2B/4B), standard cross-validation reports a pooled AUC 8.0-16.5 points higher than LODO; per-dataset held-out-test-vs-LODO accuracy gaps span 1-25 points. To understand the gap, we analyze the LODO stability of a linear probe's per-feature classifier coefficients, defining a retention metric for sparse-autoencoder (SAE) features that flags dataset-dependent shortcuts. 28-44% of top SAE features are shortcuts across models, a dataset-identity classifier reaches 96.6%, and the dataset-identifying and safety-relevant subspaces partially overlap. Standard domain-generalization fixes such as adversarial training, subspace projection, sample reweighting, and class balancing do not close the gap. Finally, we show LODO-weighted SAE attributions filter dataset artifacts for more reliable per-prompt explanations. We release our framework at https://github.com/maxf-zn/prompt-mining so future prompt-attack classifiers can be evaluated under LODO alongside CV.

Max Fomin• 2026

Related benchmarks

TaskDatasetResultRank
Attack DetectionHarmful Attacks 105K sample set
Detection Rate68
8
Attack DetectionJailbreak Attacks 105K sample set
Detection Rate68
4
Attack DetectionMixed Attacks 105K sample set
Detection Rate77
4
Attack DetectionExtraction Attacks 105K sample set
Detection Rate79
4
Attack DetectionBenign Samples 105K sample set
Benign FPR650
4
Attack DetectionInjecAgent Agentic Attacks
Detection Rate0.99
2
Showing 6 of 6 rows

Other info

Follow for update