Practical technical guides / Recent development: arXiv 2611.08834 (6 November 2026), prompt injection guards on legal contracts

A Prompt Injection Guard That Flags Any Chunk Flags Most Long Contracts: Measure Document-Level False Positives First

A 6 November 2026 paper found injection guards flagging up to 92 percent of contracts in its corpus and 100 percent of CUAD. Why any-chunk rules compound, and how to measure.

By Sandeep Belgavi · Published 2026-11-09

Why any-chunk rules flag long documents
Original explanatory diagram; synthetic values where shown.

A 6 November 2026 paper found injection guards flagging up to 92 percent of contracts in its corpus and 100 percent of CUAD. Why any-chunk rules compound, and how to measure.

A guard that flagged nearly every contract

Prompt injection guards are small classifiers placed in front of a model: text goes in, a score comes out, and anything above a threshold is blocked or routed for review. They are usually evaluated on short prompts. On 6 November 2026, Mark Heimann, Katherine Taylor and Bruno Jacob posted a paper (arXiv 2611.08834) that measured eleven open-weights guards where many teams now deploy them: in front of an LLM that reviews long legal contracts.

The headline numbers are stark. On the authors' corpus of 683 commercial contracts, document-level false positive rates reached 92.39 percent, and on the public CUAD corpus of 510 contracts two guards flagged 100 percent of documents. Two guards scored below chance on paired AUC on the authors' corpus, and a third on CUAD. A baseline of five regular expressions was not Pareto-dominated by any guard in the panel.

This guide is not a review of those guards. It explains the mechanism behind such numbers, which applies to any chunked detector on long documents, and turns it into a measurement you can run on your own documents before trusting a guard. The interactive lab lets you vary the mechanism; its documents and scores are synthetic and are not the paper's data.

How a guard sees a long document

A guard has a small context window, so a long document is cut into chunks. The paper used non-overlapping 512-token windows for most guards, and 2,048-token windows for two whose vendors recommend them. Then a rule turns chunk scores into a document decision. The paper's rule, which is also the usual deployment rule, is: a document is flagged if any chunk scores above the threshold, here each vendor's default of 0.5.

That rule has two consequences, and they pull in opposite directions.

False positives compound with document length. If a benign chunk has probability p of scoring above the threshold, and a document has n chunks scored independently, the chance that at least one fires is 1 - (1 - p)^n. A per-chunk false positive rate of 8 percent sounds tolerable. Over 14 chunks it gives 1 - 0.92^14, about 69 percent of benign documents flagged. Real chunk scores are not independent, but the direction holds.

Real payloads are diluted. A planted instruction is a sentence or two in a window of hundreds of tokens. The paper scored identical payloads alone and embedded in their host documents. For payloads written in the style of prompt injections, most guards scored them above the threshold in isolation, yet once embedded the same payloads were flagged as rarely as 2 percent of the time, a dilution effect the authors call out explicitly.

Put together, a guard can flag most of a long corpus while missing most of the attacks in it. Many of the documents it does flag for containing an attack are flagged because some other chunk tripped the threshold.

Chunk count is a property of the tokenizer and the corpus

The paper makes a point that is easy to miss: the same 683 documents produced 10,054 chunks under one guard's tokenizer, 10,388 under another's and 12,185 under a third's. CUAD had a nearly identical median number of chunks per document but a heavier tail, carrying 45 percent more chunks from 25 percent fewer documents. Because a document is flagged if any chunk fires, that difference alone moves document-level rates between corpora. A false positive rate measured on one corpus, or with one chunk size, does not transfer to another.

The mechanism in the lab

The lab generates 300 synthetic benign documents (median about 6,000 tokens) and 60 injected copies, each carrying a 60-token payload at a random position. A benign chunk's score is drawn from a fixed distribution; a chunk containing payload tokens gets a score that shrinks with the share of the chunk the payload occupies. With the default "noisy guard" settings, 512-token chunks and the any-chunk rule:

Setting (model)Chunk FPRDocument FPRFlagged injectedPayload chunk actually fired
512 tokens, any chunk, threshold 0.57.9%65.7%60.0%3.3%
2,048 tokens8.0%28.0%21.7%10.0%
threshold 0.91.3%16.7%18.3%1.7%
at least 2 chunks7.9%28.7%23.3%3.3%
plus a second stage (recall 0.95, FPR 1%)7.9%0.3%56.7%3.3%

The "flagged injected" column looks like recall, but the last column shows that the payload's own chunk scored above the threshold in only 3.3 percent of injected documents. In the first row, 34 of the 36 flagged injected documents were flagged by benign chunks. Measured naively, this guard appears to catch 60 percent of attacks while barely detecting the attacks at all.

Larger chunks reduce false positives because there are fewer chunks to fire, but they dilute payloads further: the median payload chunk score fell from 0.31 to 0.15 in the model. Raising the threshold or requiring two chunks lowers false positives and destroys what little real detection there was, because a payload usually occupies one chunk.

The paper itself compares each injected document with its own unmodified host ("paired AUC"), for the reason the table shows: scores on injected documents correlated strongly with the host's score before any injection.

A verifying second stage

The paper's constructive result is a cascade. Prompted LLMs resolved the tested failures, and a cascade in which a mid-tier model's positives were adjudicated by a frontier model was 6.5 times cheaper than using the frontier model alone, while approaching its performance. The authors report the cost at list price on one corpus and do not measure latency.

The lab's second stage is a fixed-rate stand-in for such a verifier, not a model. With a verifier that confirms 95 percent of truly injected documents and 1 percent of benign ones, document false positives fall from 65.7 to 0.3 percent, at the cost of 233 second-stage calls for 360 documents. Recall can only fall in a cascade: the second stage sees only what the first stage flagged.

Measure on your own documents first

Before deploying a guard on long documents, measure four things on a sample of your own benign documents and a set of planted payloads:

  1. Chunk-level false positive rate at your threshold, with your chunk size and the guard's own tokenizer.
  2. Document-level false positive rate under the aggregation rule you will deploy. Compare it with 1 - (1 - p)^n to see how much correlation helps.
  3. Paired detection: for each injected document, does the guard score it higher than its own clean host, and does the payload's chunk fire? A guard whose decision does not change when you insert the payload is not detecting the payload.
  4. Isolation versus embedding: score each payload alone and inside a host. A large gap means dilution, which chunk size and overlap will affect.
def doc_flagged(chunk_scores, threshold=0.5, k=1):
    return sum(s >= threshold for s in chunk_scores) >= k

def payload_fired(chunk_scores, payload_chunks, threshold=0.5):
    return any(chunk_scores[i] >= threshold for i in payload_chunks)

The companion example reproduces the table above from a seeded generator and asserts the relationships, so you can see the arithmetic before you apply it to real scores.

Failure modes

  • Reporting chunk metrics for a document decision. A guard card that says "2 percent false positives" on short prompts says little about 20-chunk documents.
  • Counting coincidental flags as detections. Without checking which chunk fired, recall is inflated by benign false positives.
  • Tuning on one document type. The paper found that guard rankings did not transfer between two legal review tasks; one guard moved from 0.369 to 0.765 paired AUC. Validate per document type.
  • Treating the guard as the only control. The authors note that ingestion and the reviewer prompt are other places to intervene. A guard that blocks a contract also blocks the business process; decide whether to block, route or annotate.

What remains uncertain

The paper measures eleven specific guards on legal contracts, with one proprietary and one public corpus, and its cascade costs come from one corpus and one question. Its numbers should not be applied to other document types without testing. The lab's model assumes independent benign chunk scores and a simple dilution curve; real guards differ in both. What carries over is the method: measure at the document level, attribute detections to the payload, and test on your own text.

Interactive experiment

Guard flags per document: chunk counts, thresholds and a verifying second stage. Synthetic browser-local fixtures, adjustable inputs, decision traces and JSON export.

Primary references and authorship

Sources dated on or before 9 November 2026. Original explanation and synthetic examples by Sandeep Belgavi. Companion code: Sandeep-BA/agent-decision-lab/examples/python/guard_document_rates. Views are my own and do not represent any employer, past or present.