How each approach works
Both approaches inspect text that may contain an injection attempt, and both produce a signal that a runtime policy can act on. They differ in where that signal comes from, and therefore in how they fail.
Trained classifier
A trained classifier is usually faster, cheaper, and more consistent. Its judgment is bound by its training distribution, so inputs that differ from what it was trained on are the main source of risk.
LLM-as-judge
An LLM-as-judge can reason about novel phrasing and context. It is slower and less deterministic, and it can itself be targeted by the text it inspects.
Comparing reliability criteria
This comparison uses four reliability criteria. Each one should be measured on your own test data rather than assumed.
- Detection quality
- Recall and precision on direct and indirect injection.
- Adversarial robustness
- Behavior under obfuscated, multilingual, and multi-turn attacks.
- Operational fit
- Latency, cost per request, and consistency under load.
- Auditability
- Whether each decision can be logged, reproduced, and reviewed.
| Criterion | Trained classifier | LLM-as-judge |
|---|---|---|
| Detection quality | Bound by its training distribution. | Can reason about novel phrasing and context. |
| Adversarial robustness | Limited where attacks fall outside its training distribution. | Can itself be targeted by the text it inspects. |
| Operational fit | Usually faster and cheaper. | Slower. |
| Auditability | Usually more consistent. | Less deterministic. |
Failure modes and limits
- Classifier: performance is limited by its training distribution, so attacks unlike its training data are a primary concern.
- LLM-as-judge: the judge reads the same untrusted text it is asked to evaluate, so it can itself be prompt-injected. Slower responses and less deterministic outputs also affect operations and review.
Choosing an approach, or layering both
For tool-calling agents, the stronger design is to treat detection as one signal inside a layered runtime policy enforcement model. In that model, the detection approach you choose works alongside:
- runtime policy enforcement that acts on the detection signal;
- least-privilege agent permissions and tool approvals that limit impact when detection fails;
- audit logging of inputs, scores, rationale, and policy action.
Measure each detector on your own test data before deciding how to combine them.
Evaluation criteria for runtime governance tooling
Use these questions when assessing any detector or governance tool:
- What recall and precision does the detector achieve on direct and indirect injection, and on which test set and date?
- How was it tested against adaptive, obfuscated, multilingual, and multi-turn attacks, and by whom?
- Can the detector itself be prompt-injected, and what controls limit that risk?
- What are p50 and p95 latency and cost per request at your expected volume?
- Are decisions deterministic and logged with inputs, scores, rationale, and policy action?
- Do permissions and tool approvals still limit impact when detection fails?