Strictly curated data yields 95.97% recall for prompt injection screening with sub-ms linear SVM
A linear character n-gram SVM trained on a mirrored dataset achieves high recall and F1 for prompt injection detection, surpassing a larger model.
AI/ML arXiv 12 Mar 2026 Defense Prototype evidence
Published as “The Mirror Design Pattern: Strict Data Geometry over Model Scale for Prompt Injection Detection”
Why it matters
A lightweight, compiled linear classifier can serve as an effective first-pass L1 filter, dramatically reducing latency and dependency overhead compared to transformer-based detectors.
Summary
A sparsely-featured linear SVM trained on a strictly curated 5,000-sample corpus achieves 0.9207 F1 and 0.9597 recall on a 524-case holdout, running in sub-millisecond latency, and outperforms a 22-million-parameter transformer baseline (0.591 F1, 0.444 recall, 49 ms median latency). The paper shows that disciplined data geometry, not model scale, enables this performance. Evidence comes from a single held-out set with bootstrap confidence intervals, but the holdout is modest in size and the approach still struggles with contextual ambiguity and paraphrased attacks.
What they found 3
- The Mirror-trained linear SVM reaches 95.97% recall and 92.07% F1 on the 524-case holdout.
“obtain 95.97% recall and 92.07% F1 on a 524-case holdout”
- On the same holdout the SVM attains 0.9207 F1, 0.8848 precision, and 0.9597 recall.
“reaches 0.9207 F1, 0.8848 precision, and 0.9597 recall on a 524-case held-out evaluation set”
- The compiled SVM runs in sub-millisecond latency (mean 0.32 ms) versus 49 ms median for Prompt Guard 2.
“the compiled L1 path ran at 0.32 ms mean latency (0.13 ms median, 1.40 ms p95) in the eval harness”
Caveats 7
- The L1 SVM false-positive rate on a hard-benign challenge set is 51.9% at the default threshold, dropping only to 12.3% when the threshold is raised.
- Both the SVM and Prompt Guard 2 plateau around 21% recall on heavily paraphrased attacks from JailbreakBench.
- The holdout used for evaluation is modest (524 cases), leaving broader external validity unproven.
- This paper is a proof of architecture and curation method, not a claim that 5,000 samples are the final production recipe for prompt injection detection.
- The final v5 matrix closed 31 of 32 cells, but it did so by careful sourcing and micro-source construction, and one Russian lane remained an explicit accepted miss.
- Character n-grams are very good at capturing lexical and structural control-plane traces, but they do not robustly resolve contextual ambiguity.
- A security whitepaper quoting a jailbreak prompt can still look too much like an attack (51.9% FPR on the hard-benign challenge set at default threshold).
What’s new here 4
- Introduces the Mirror design pattern that pairs malicious and benign examples in matched geometric cells to eliminate corpus shortcuts.
- Demonstrates that a static, compiled linear character n-gram SVM can achieve high recall and low latency for L1 prompt-injection screening.
- Provides a provenance-first curation and evaluation workflow that records source hashes and cell fills for auditability.
- Shows that the linear model can substantially exceed an off-the-shelf 22M transformer baseline on the same holdout while requiring no runtime model dependencies.