Lightweight Prompt-Injection Detectors Rely on Surface Cues: An Evaluation under Obfuscation, Indirect Injection, and Hard Negatives

Large language models (LLMs) follow the instruc-tions they read, which makes them vulnerable to prompt in-jection: an attacker writes instructions that override those ofthe developer. A common defense is a lightweight detector thatfilters prompts before they reach the model. Such detectorsare usually evaluated on attacks similar to their training data,which may give an overly optimistic view of their robustness. We evaluate four lightweight detectors (a keyword filter, acharacter n-gram TF-IDF classifier, an embedding-based nearest-neighbor “semantic firewall” and an embedding-based classifier)on the public deepset prompt-injection dataset, under seven testconditions: the original test set, four character-level obfuscations,indirect injection inside benign documents, and hard negatives,i.e., benign prompts that contain words typical of injections. Wefind that all detectors rely on surface cues rather than on theintention of the prompt. The best detector reaches 92.0% F1on the original test set, but leetspeak reduces it to 75.1%, and itflags 63.1% of benign documents in the indirect condition. Threeof the four detectors flag 43–53% of benign hard negatives, andthe semantic firewall detects only 30.0% of injections. We alsoshow that obfuscating only the attacks, a common evaluationshortcut, overestimates robustness: with symmetric obfuscation,the false-positive rate of the embedding classifier rises from 1.8%to 31.0%. These results call for more realistic evaluation oflightweight prompt-injection defense.

Authors

Publication Details

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

Lightweight Prompt-Injection Detectors Rely on Surface Cues: An Evaluation under Obfuscation, Indirect Injection, and Hard Negatives

john glody KUBIKULA-ve
Zenodo (CERN European Organization for Nuclear Research)
Adversarial Robustness in Machine Learning
preprint

Lightweight Prompt-Injection Detectors Rely on Surface Cues: An Evaluation under Obfuscation, Indirect Injection, and Hard Negatives

john glody KUBIKULA-ve
preprint en

Abstract

Large language models (LLMs) follow the instruc-tions they read, which makes them vulnerable to prompt in-jection: an attacker writes instructions that override those ofthe developer. A common defense is a lightweight detector thatfilters prompts before they reach the model. Such detectorsare usually evaluated on attacks similar to their training data,which may give an overly optimistic view of their robustness. We evaluate four lightweight detectors (a keyword filter, acharacter n-gram TF-IDF classifier, an embedding-based nearest-neighbor “semantic firewall” and an embedding-based classifier)on the public deepset prompt-injection dataset, under seven testconditions: the original test set, four character-level obfuscations,indirect injection inside benign documents, and hard negatives,i.e., benign prompts that contain words typical of injections. Wefind that all detectors rely on surface cues rather than on theintention of the prompt. The best detector reaches 92.0% F1on the original test set, but leetspeak reduces it to 75.1%, and itflags 63.1% of benign documents in the indirect condition. Threeof the four detectors flag 43–53% of benign hard negatives, andthe semantic firewall detects only 30.0% of injections. We alsoshow that obfuscating only the attacks, a common evaluationshortcut, overestimates robustness: with symmetric obfuscation,the false-positive rate of the embedding classifier rises from 1.8%to 31.0%. These results call for more realistic evaluation oflightweight prompt-injection defense.

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