Specialized prompt injection guards are deployed in front of document analysis systems, but no false positive rate has been published for any of them on legal contracts. We measure eleven open-weights guards on two corpora of legal contracts and find that existing guards struggle: document-level false positive rates are as high as 92.39%; two guards fall below chance on paired AUC; and a five-regex baseline is not Pareto-dominated by any guard in the panel. Controlled probes locate model-specific as well as general failure modes. Prompted LLMs resolve the tested failures, including a second threat category (unauthorized scope claims) on which every guard scores zero. A cascaded LLM solution, where the positives of a mid-tier model are verified by a frontier model, is 6.5x cheaper than using exclusively a frontier model and approaches its performance.
Figures & tables
Figure 1: Pipeline LLM-based guard: single model (left branch) or cascade (right branch) using a cheaper small model and having its positives adjudicated by a frontier model that is less prone to false positives.
Figure 2: Taxonomy of review instructions.
Document FPR
Unauthorized review detection
Detector
Ours
CUAD
Paired AUC
CTRL
Rec. @1% FPR
(683)
(510)
CUAD / Ours
CUAD / Ours
CUAD
Ours
PIGuard
8.64
11.96
0.795 / 0.700
0.546 / 0.533
31.3
4.63
Prompt Guard 1-86M
17.42
6.08
0.652 / 0.702
0.475 / 0.546
23.5
2.78 ∗
Prompt Guard 2-86M
1.02
0.20
0.656 / 0.729
0.525 / 0.625
23.9
21.3
TestSavant
78.62
78.04
0.646 / 0.476 ¶
0.567 / 0.442
6.30 ∗
1.30 ∗
Table 1: Main result. FPR is over every contract in each corpus, while the detection columns are over 9 in-scope payloads spliced into 60 host contracts per corpus, each paired against its own unmodified host; CTRL is over the control payloads. † CTRL ≥ paired AUC, so apparent signal must be perturbation sensitivity rather than detection. ‡ CTRL >0.65 : strong edit-sensitivity even where attack separation is higher. ¶ Below chance. ∗ Unstable value due to a large number of tied scores near 1. § The lexical baseline is a binary rule, so it has no ranking score and no tunable budget; it fires on the payload text so its recall does not vary by corpus. ∗∗ A 1% false-positive budget is not an attainable operating point for LLM arms as the model verdict carries a coarse discrete confidence.
bare
sem.
surface
Scorer
score
addr.
mood
prompt
contr.
Sep.
At ceiling on bare text (deltas uninformative)
deepset
.999
− .000
− .000
+ .000
− .000
+ 0.0
DistilBERT
.999
− .001
− .000
+ .001
+ .001
+ 0.0
PG1-86M
.993
− .068
− .029
+ .007
− .121
− 1.0
Responsive (headroom to move)
Table 2: Factor effects: each column is the mean change from varying one factor with the other four held fixed. addr. = naming an AI system rather than you ; mood = plain modal vs legal deontic; prompt = prepending “Ignore all previous instructions.”; contr. = “Notwithstanding any other provision hereof,”. Sep. is the flag rate on the five harmful intents minus the rate on the benign falsifier.
Figure 3: Flag rates for the six responsive guards (not at ceiling or floor on bare text in Tab. 3 ) on five harmful intents: omit output, report false, cite only here, no determination, and skip re-analysis.
Figure 4: Results on registry and held-out payloads scored in isolation. Bottom five guards are dimmed as they are at ceiling or floor on bare text (Tab. 3 ).
Figure 5: Flag rate on nested mid-document prefixes of varying token lengths. Color encodes failure mode.
clean
review direction
scope
CTRL
Scorer
hosts
prompt
contract
claim
benign
/60
R1–R4
R5–R9
S1–S3
floor
deepset
0 0
4/4 —
5/5 —
3/3 —
—
DistilBERT
0 0
4/4 —
5/5 —
3/3 —
—
ProtectAI v2
11
4/4 9%
3/5 9%
0/3
0 9%
TestSavant
0 4
2/4 100% ¶
1/5 75% ¶
0/3
50%
Table 3: Scoring payloads in isolation versus embedded in hosts. The first fraction is how many of that group’s payloads score ≥0.5 (above the threshold) alone in the window, where dilution cannot occur. The second percentage is the share of those payloads’ injected documents (60 hosts per payload) that are flagged, over hosts that themselves score clean. (—) means the detectors flag the unmodified hosts. The CTRL column is the flag rate on the two benign inserts over the same clean hosts. ¶ : numbers rest on 4 clean hosts (n=8 and n=3).
Figure 6: Document-level paired detection (%) across the threat taxonomy and cost of LLM-based solutions. Cost is list price over the clean arm from logged token counts: cents per contract screened. n=60 hosts from our proprietary corpus per class, each injected version paired against its own unmodified host.
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
Ours
CUAD
Documents
683
510
Chunks
10,054
10,713
Tokens/doc, median
6,327
6,434
mean
7,232
10,461
p10 – p90
245–11,392
1,351–24,530
max
182,367
77,251
Appendix
Table 4: Corpus statistics, tokenized with DeBERTa-v3 at the 510-content-token window used throughout. The medians are nearly identical and the means are not: CUAD’s tail is heavier, so it carries 45% more chunks from 25% fewer documents. Since a document is flagged if any chunk fires, that difference alone can move document-level rates between corpora without any difference in how a detector responds to contract text.
Table 5: The complete T1 override baseline: five patterns, 0.29% document false-positive rate, and recall within two detections of the best neural guard (§ 4 ).
In scope
Scope
Rec.
Clean
Detector
AUC
CTRL
claim
@0.5
hosts
PIGuard
0.884
0.592
0.481
53.6
57
Horizon Labs
0.793
0.613 ‡
0.506
71.5
37
Prompt Guard 2-86M
0.790
0.629 ‡
0.625
21.5
59
ProtectAI v2
0.765
0.342
0.556
21.2
11 §
Prompt Guard 1-86M
0.698
0.571
0.597
22.4
58
Appendix
Table 6: The guard panel on a second review question, Confidentiality Required of Us , over the same 60 hosts and the same payloads as Table 1 . † CTRL ≥ AUC: the detector separates benign inserts at least as well as attacks. ‡ CTRL >0.6 against an AUC under 0.8 : most of the apparent signal is edit sensitivity. § Less than half of the hosts score clean, capping paired recall far below 100%; deepset and DistilBERT flag every host and admit no paired rate at all.
CUAD
Ours
Detector
host
payload
host
payload
host-dominated
PG2-22M
95.5
0 0.1 †
80.8
0 0.5 †
deepset
91.0
0 0.9 †
79.3
0 9.6
DistilBERT
90.6
0 1.4 †
76.4
13.1
ProtectAI v2
89.9
0 0.4 †
97.6
0 0.0 †
Appendix
Table 7: Where a detector’s document score comes from: a balanced 60 hosts × 14 payloads = 840 examples, one per cell, each scored as the maximum over its chunks. Columns are η2 , the between-group share of total sum of squares. r is the correlation between a document’s injected and pre-injection scores. † At or below the null floor of 1.5. η2 is biased upward by roughly (k−1)/(n−1) even for a factor that does nothing: 1.5% for payload at k=14 , n=840 .
Large language models (LLMs) are increasingly deployed in production systems, raising concerns about their exposure to adversarial manipulation through prompt injection and jailbreak attacks. Classifier-based guardrails, such as Prompt Guard 2, are widely used as a first line of defense against such attacks, but their internal decision logic is largely opaque to both defenders and attackers. This paper presents an exploratory case study that applies explainable artificial intelligence (XAI) techniques to analyze how Prompt Guard 2 distinguishes malicious from benign prompts. We conduct four experiments to probe this question empirically. Guided by Vanilla Gradient and SHAP attributions, we find that Prompt Guard 2's decisions rely on the cumulative contribution of many tokens rather than a few dominant ones, yet saliency-guided synonym substitution and sentence-level paraphrasing can flip its predictions while altering only a moderate fraction of the text, in some cases yielding a successful jailbreak against the underlying LLM. A dataset-scale saliency analysis further shows that undetected injection prompts systematically lack the lexical markers the classifier relies on. We discuss the implications of these findings for the design and evaluation of classifier-based guardrails, and argue that explanation methods intended to support transparency can simultaneously lower the cost of constructing successful adversarial bypasses.
Fernando Outeda, Gustavo Betarte, Juan Diego Campo +1
Pedeciba Informática, Uruguay · InCo, Facultad de Ingeniería, Universidad de la República · Departamento de Informática e Inteligencia Artificial, Universidad Católica del Uruguay
In this paper, we evaluate open-source generative LLMs on legal Natural Language Inference (NLI). Legal inspectorial processes take place in specific domains and often deal with confidential data. This creates a need for working with local models that do not require labeled training data. We evaluate our models on the ContractNLI benchmark and two NLI4Wills datasets. We successfully reproduce the baseline for the task (Span NLI BERT) and we evaluate multiple open-source LLMs on the same task. We analyze the invalid rate of the models, and their stability across temperature settings and domains. Among the generative models, Gemma-4 26B performs the best, reaching an accuracy of 81.2%, even outperforming the supervised model on one metric. On accuracy, it is not possible to beat the supervised model with zero-shot approaches. Qwen-3.6 35B performs well on both ContractNLI and additional datasets in the legal wills domain. Our findings indicate that zero-shot, open-source, generative LLMs are a viable alternative for real-world legal NLI when no supervised data is available. Our code is available at https://github.com/fbaratov/contractnli-llms.
Domain-camouflaged injection attacks embed malicious instructions in retrieved content using domain-appropriate vocabulary, evading standard detectors that rely on syntactic injection markers. When detection fails, practitioners need to know which defense architectures reduce attack success. We evaluate five prompting-based defenses (spotlighting, paraphrasing, prompt sandwiching, and two combinations) against domain-camouflaged injection across three model families (Claude Haiku, Llama 3.1 8B, Gemini 2.0 Flash) and three deployment domains (financial, legal, general) using 3,510 trials. Paraphrasing retrieved content before agent processing is the most consistently effective defense in this benchmark, reducing camouflage attack success rate by 55-84% depending on model, and achieves lower attack success rates than our Llama Guard 4 configuration on every model tested. Defense effectiveness is strongly model-dependent: spotlighting halves attack success on Claude Haiku but provides no benefit on Llama 3.1 8B. Financial domain deployments face the highest residual risk at 26-33% baseline attack success rate, with no prompting-based defense fully eliminating the threat on weaker models. These results provide the first systematic evaluation of prompting-based defenses specifically against camouflage-class injection attacks and establish benchmark-based recommendations for practitioners. All tasks use synthetically constructed professional documents; whether these benchmark rankings generalize to real enterprise documents remains an open question.