Skip to main content

Prompt Injection Detection Tools: How Classifier Guards Work

· By Natalie Walls

Most prompt injection detection tools are text classifiers: a small model reads a prompt or document and labels it as an attack or not, so your app can block, flag or log it before the main model acts on it.

That's useful, but it's one layer. Every vendor below says, in its own docs, that a clean result doesn't prove the text is safe. This post describes what each tool says it does. It isn't a ranking, and we haven't benchmarked them.

How prompt injection detection tools work

The common pattern looks like this:

  1. Your app collects the text the model is about to read: the user's message, plus any retrieved documents, emails, web pages or tool results.
  2. It sends that text to the detector.
  3. The detector returns a label or a score.
  4. Your code decides what to do: block, strip, warn, or just log.

The important design choice is step 1. Indirect injection hides in content the user never typed, so a detector that only sees the chat box misses it. See Indirect Prompt Injection for why that matters.

Four tools and what their docs say

Microsoft Prompt Shields

Prompt Shields is part of Azure AI Content Safety. Its docs split attacks into two kinds: user prompt attacks, which try to change the system's rules, and document attacks, which hide instructions in files, emails, web pages or tool results (Microsoft Learn). The API takes a user prompt and up to five documents and reports whether an attack was detected for each.

A few details from the docs worth knowing:

  • In the standalone API, the service only reports. Your app has to do the blocking.
  • The models are mainly trained and evaluated on English, so Microsoft says to test every language your app uses.
  • Don't send your system prompt to it. System prompts often contain rules that look like attacks and cause false positives.

Meta Llama Prompt Guard 2

Prompt Guard 2 is an open model you run yourself. The 86M version is built on mDeBERTa and labels input as benign or malicious, with a 512 token window, so longer text has to be split into chunks (Hugging Face model card). Meta lists eight languages it was evaluated in, suggests fine-tuning on your own data, and warns that attackers may build inputs specifically to slip past it.

Protect AI deberta-v3-base-prompt-injection-v2

This is an Apache 2.0 classifier fine-tuned from Microsoft's deberta-v3-base, and it's one of the input scanners in the LLM Guard project (Hugging Face model card). The card is upfront about limits: English only, no jailbreak detection, and it shouldn't be run on system prompts. It also says the project is archived and no longer maintained, which matters if you're choosing something to depend on.

Lakera Guard

Lakera Guard is a hosted API, now documented under Check Point AI Guardrails. You send chat messages in the familiar role format, and it screens the latest user message as input, the latest assistant message as output, and tool messages as untrusted content (Lakera docs). The response's main field is a flagged boolean. A detect mode lets you monitor without blocking, which is a sensible way to measure false positives first.

What these tools share

Runs whereScreens documentsLanguage notes
Prompt ShieldsAzure APIYes, up to five per callMainly English training
Prompt Guard 2Your own serversYes, if you send themEight languages evaluated
Protect AI v2Your own serversYes, if you send themEnglish only
Lakera GuardHosted APIYes, tool messagesSee vendor docs

The catch: scores don't transfer well

A detector's benchmark score tells you about the benchmark, not your app. A 2026 study tested fifteen detectors on agent benchmarks and found that rankings didn't carry over between them. The best detector on one benchmark caught only 2% of injections on another at a 1% false positive rate (Liu, arXiv). The author's advice: evaluate on your agent's own tool outputs and check what each detector was trained on.

Simon Willison makes a related point. In web security, catching 95% of attacks is "very much a failing grade" (Simon Willison), because attackers keep trying until something gets through.

How to use a detector well

  • Scan everything the model reads, not just the user's message.
  • Start in log-only mode and measure false positives on real traffic.
  • Keep the real protection elsewhere: least privilege, human approval for risky actions, and output checks. How to Prevent Prompt Injection covers those layers.
  • Retest whenever you change the model, the prompt or the detector.

Want a quick look at what a simple pattern scanner flags? Paste text into our analyzer, then run the canary payloads through your app with the detector switched on.