The Research Report
Severity‑Aware Calibration of Prompt‑Injection Detectors under Attack Shift
Introduction
Prompt‑injection attacks threaten the reliability of large language model (LLM) systems that accept user input. A common defense is a detector that scores each input and lets downstream components decide whether to accept or block it. The detector must be accurate and trustworthy in its confidence. When the model that the detector protects faces new kinds of attacks, the confidence that the detector reports can become misleading. The paper Severity‑Aware Calibration of Prompt‑Injection Detectors under Attack Shift examines this problem.
Threat Model and Attack Shift
The authors define an attack shift as a change in the distribution of attacks that is not represented in the clean benchmark used to set the detector’s operating point. They consider five realistic shift scenarios that include indirect behavior‑hijack injection, where the attacker tricks the system without changing the obvious prompt pattern. The shift can happen for any of the three detectors they study:
- ProtectAI‑v2 – a commercial detector from the ProtectAI project.
- Prompt‑Guard‑2 checkpoint A – the first publicly released checkpoint.
- Prompt‑Guard‑2 checkpoint B – the second publicly released checkpoint.
Each detector is evaluated at a single threshold that was calibrated on a static clean benchmark. The threshold is frozen and applied across all shift scenarios.
Study Design
The authors introduce a severity metric S. The metric measures how confident the detector is on the attacks it fails to catch. In other words, when the detector a false negative, S records the detector’s confidence that the input was safe. They also compute the standard false‑negative rate (FNR) and a pooled calibration error that aggregates confidence across all inputs.
The evaluation proceeds as follows:
- Run each detector on a large set of crafted attacks for each shift.
- Record the detector’s binary decision and the confidence score.
- Compute S, FNR, and calibration error for every shift.
Key Findings
Near‑Certain Misses
Across every shift and every detector the severity on missed attacks stays between 0.99 and 1.00. This means that when the detector fails, it does so with near‑certain confidence. The false‑negative rate varies widely – from 0.01 for some shifts to 0.97 for others – but the confidence on those misses is always high.
Behavior‑Hijack Injection Blind Spot
All three detectors confidently pass the indirect behavior‑hijack injection class. This class is a blind spot that appears across two vendors and a four‑fold size range of model parameters.
Calibration Error Hides the Problem
Standard pooled calibration error reports a value of 0.06 for one detector, suggesting it is well calibrated. When the same detector is evaluated only on the attack data the error jumps to 0.91. The pooled metric therefore hides a serious mis‑calibration on adversarial inputs.
Content‑Keying as Root Cause
The authors trace the failure to content‑keying rather than the structure of the injection. An instruction‑tuned model that judges the content of the prompt shows the same blind spot. The paper also releases a black‑box rewriter that deliberately modifies inputs to trigger confident misses. The rewriter is most effective on the most dangerous attack class.
Practical Guidance for Prompt Engineers
- Measure Severity – In addition to false‑negative rate, record the detector’s confidence on misses. A high severity score signals a dangerous false negative.
- Test Under Shift – Run detectors on a diverse set of recent attacks. Do not rely on a single static benchmark.
- Calibrate Dynamically – Re‑calibrate thresholds when the attack distribution changes. Use separate calibration on clean data and attack data.
- Guard Against Content‑Keying – Include content‑keying tests in your evaluation suite. Verify that the detector does not rely solely on superficial token patterns.
- Ensemble Multiple Detectors – Combining detectors with different training data can reduce the chance of a shared blind spot.
- Log Confidence Scores – Store confidence scores for every decision. This enables post‑mortem analysis when an attack slips through.
Deployment Recommendations
The paper’s code and data are public. Prompt engineers can reproduce the evaluation pipeline and integrate it into their CI/CD workflow. A recommended workflow is:
- Generate a set of synthetic attacks covering known shift classes.
- Run each detector on the attacks and collect confidence.
- Compute severity and calibration error.
- Adjust the threshold until severity on misses drops below an acceptable level (for example 0.7).
- Deploy the updated threshold and monitor real‑world logs for anomalies.
Future Directions
- Richer Attack Taxonomies – The current five shift scenarios capture many realistic attacks, but additional vectors such as multi‑turn conversational hijack should be explored.
- Adaptive Calibration – A calibration method that updates thresholds in response to live confidence distributions could keep the detector reliable over time.
- Explainable Detection – Providing human‑readable reasons for a detection decision would help operators understand why a detector is overly confident on a miss.
- Robust Rewriter Detection – The released black‑box rewriter demonstrates a new class of adversarial inputs. Defenses that detect rewriting patterns could further improve security.
Conclusion
The study shows that confidence scores from prompt‑injection detectors can be dangerously misleading when the attack distribution shifts. Severity‑aware calibration reveals that missed attacks are almost always reported with high confidence. Engineers should incorporate severity measurement, dynamic calibration, and content‑keying checks into their security pipelines. By doing so they can prevent false negatives from giving a false sense of safety and can maintain robust defenses as attack tactics evolve.
Word count: PLACEHOLDERWORDCOUNT
Timestamp UTC: PLACEHOLDER_TIMESTAMP