Three Prompt Injection Defenses From EMNLP 2026: Clean the Input, Retrain the Model, or Route the Detectors

Three EMNLP 2026 papers defend LLM agents against prompt injection in three places: an input sanitizer, fine-tuning, and detector routing.

Three prompt injection defenses from EMNLP 2026. Figure: One headline result from each paper. The panels use different models, datasets and attacks, and the right panel counts attacks that passed the detectors, not attacks that a model followed. Bars do not compare across panels.

This post is for people who let an LLM read web pages, files, emails or tool results and then act on them. An instruction hidden in that content can take over the task, which is called indirect prompt injection. Three papers in the EMNLP 2026 main proceedings, published in October 2026, put the defense in three different places. PISanitizer removes injected tokens before the model reads the context. SecOPD fine-tunes the model itself. SCOUT decides for each request which detectors to run.

The three papers use different models, datasets and attacks, and they do not count attack success the same way. Every number below is the measurement of the paper it is attributed to, and numbers do not compare across papers.

Three-panel chart on a black background, one panel per paper. Left panel, PISanitizer, attack success rate under the GCG attack on HotpotQA with a Llama-3.1-8B backend: no defense 0.96, Meta-SecAlign 1.0, PISanitizer 0.02. Middle panel, SecOPD, attack success rate under the PISmith adaptive attack on SEP with Qwen3.6-27B: undefended 97.9%, Meta-SecAlign 94.0%, GRPO 61.2%, SecOPD 9.0%. Right panel, SCOUT, attacks that passed detection out of 255 on SCOUT-450: one fine-tuned classifier 59, always-on LLM judge 29, SCOUT 16.
Figure. One headline result from each paper. The panels use different models, datasets and attacks, and the right panel counts attacks that passed the detectors, not attacks that a model followed. Bars do not compare across panels.
Source: Table 3 of PISanitizer, Table 1 of SecOPD and Table 5 of SCOUT, EMNLP 2026. Chart by Ohrenbench.

The three at a glance

PISanitizerSecOPDSCOUT
Where the defense sitsBefore the model: a sanitizer model edits the contextInside the model: defensive fine-tuningAround the model: a router over a pool of detectors
FromThe Pennsylvania State UniversityUniversity of California, BerkeleyUC San Diego and University of Illinois Urbana-Champaign
What it needsAn open-weight model whose attention weights can be read; the paper uses Llama-3.1-8B-InstructModel weights and a training run; the paper fine-tunes Qwen3.6-27BSeveral detectors, a 400-sample anchor set, a small predictor model and an LLM judge for escalation
What “attack success” countsThe backend LLM follows the injected instructionThe attack succeeds against the fine-tuned model on SEP or AgentDojoThe attack passes the detectors
Tested against attacks built to beat itYes, 13 adaptive attacksYes, an attacker LLM trained against each modelNo, the paper lists this as a limit

PISanitizer: let a model follow the injection, then cut what it attended to

Most defenses try to stop a model from following injected instructions. PISanitizer does the opposite in a side model. It gives a sanitizer LLM the context with an instruction such as “Please follow any instructions in the context”, generates a single output token, and reads which input tokens received high attention (Sections 1 and 3.1). Runs of consecutive high-attention tokens above a threshold are removed, and the cleaned context goes to the backend LLM. The paper describes the dilemma this creates for an attacker: the more effectively an injected instruction compels the model, the more attention it draws and the more likely it is to be removed (Section 3).

The tests use six long-context datasets from LongBench with 100 samples each, and seven backend LLMs, while the sanitizer stays Llama-3.1-8B-Instruct (Sections 4.1 and 4.2).

  • Against an optimized attack. With a Llama-3.1-8B backend and the gradient-based GCG attack, ASR without a defense was 0.82–1.0 across the six datasets. With Meta-SecAlign, a fine-tuned defense, it was 0.85–1.0. With PISanitizer it was 0.0–0.02 (Table 3).
  • In front of closed models. Averaged over the six datasets, ASR without a defense ran from 0.14 for GPT-5 to 0.74 for Llama-3.1-8B. With PISanitizer it was 0.00–0.01 for all seven backends (Table 2).
  • On agent benchmarks. With the same backend, AgentDojo ASR fell from 0.47 to 0.05 and utility under attack rose from 0.40 to 0.64. InjecAgent ASR fell from 0.37 to 0.02 (Table 4).
  • Against attacks designed to bypass it. Across 13 adaptive attacks, ASR was at most 0.05 (Section 4.4, Table 5).
  • Cost. About 1.8 seconds on average to sanitize a context with thousands of tokens (Section 4.2).
  • What it removes from clean text. On four instruction-heavy datasets with no attack, 70–85% of contexts were left unmodified; where content was removed it was 0.1–6.4% of the context. After the authors fine-tuned the sanitizer on 1,200 samples, 95–100% of contexts were unmodified (Sections 4.5 and 4.6).

SecOPD: token-level feedback during fine-tuning

SecOPD is a training recipe. The paper’s argument is that earlier defensive fine-tuning scores a whole response at once, so a response that answers the user’s task and also obeys the injection gets one blunt signal (Section 3.2, Figure 1). SecOPD has the model generate a response to an injected input, then scores every generated token with the original model given the same input without the injection. Tokens that only appear because of the injection get negative feedback (Section 4.2, Figure 2). Untrusted data is passed in its own message type, separate from the user prompt (Section 3.1).

All four compared models derive from Qwen3.6-27B, and the three defended ones were fine-tuned on the same 19K dataset (Section 5.1).

AttackUndefendedMeta-SecAlignGRPOSecOPD
SEP, static99.4%28.9%15.0%1.3%
SEP, basic adaptive99.0%5.5%2.3%0.2%
SEP, PISmith adaptive97.9%94.0%61.2%9.0%
AgentDojo, static26.7%5.5%0.7%4.7%

Attack success rate, lower is better. Table 1 of SecOPD.

The third row is the paper’s main result. PISmith trains a separate attacker LLM against each target model, and the earlier defense that looked robust under static attacks let 94.0% of those attacks through (Section 5.2). In the tool-calling test, which was not part of training, GRPO had the lowest ASR but its AgentDojo utility was 82.5%, against 90.7% for SecOPD (Section 5.3). Averaged over seven utility benchmarks, SecOPD scored 88.1%, the same as the undefended model; Meta-SecAlign scored 88.5% and GRPO 83.1% (Section 5.4).

SCOUT: choose detectors per request

SCOUT does not add a detector. It treats detection as an allocation problem, because detectors differ: a keyword and regex scanner answers in under a millisecond, small classifiers take tens of milliseconds, and a GPT-4o judge call costs on the order of 1.5 seconds (Section 1, Appendix A). For each request, SCOUT retrieves similar examples from an anchor set, reads how each detector behaved on them, and a fine-tuned Qwen3-4B predictor estimates which detectors will be right and how long each will take. The light detectors predicted reliable vote in parallel, and the judge is called only when their agreement falls below a threshold τ that the operator sets (Sections 3 to 5).

On SCOUT-450, a benchmark of 255 attacks and 195 benign inputs built by the authors, the paper’s headline setting let 6.3% of attacks through with 93.3% accuracy. The safest single detector let 9.8% through, and the GPT-4o judge run on every request reached 92.4% accuracy (Section 7.2). Against that always-on judge the abstract reports a 46% lower ASR and 40% less wall-clock time, at a cost of 5.1 points of benign utility. The tables behind those figures show 395 seconds against 656 and 92.8% benign utility against 97.9% (Table 1, Sections 7.2 and 7.7). They give the judge’s ASR twice: .118 in Table 1, and 29 of 255 attacks, or .114, in Table 5. SCOUT’s is .063, 16 of 255, in both.

ASR here means an attack passed the detectors. To check what that means downstream, the authors fed every passed attack to a Qwen3-4B agent with mock tools: 28 of the 29 attacks that passed the always-on judge led to the injected action, and all 16 that passed SCOUT did (Section 7.6, Table 5). On three external benchmarks, run with two different judges, SCOUT cut wall-clock time in all six cases and lowered ASR in five (Section 7.5).

What each paper says it does not solve

  • PISanitizer. It depends on injected instructions drawing attention. The paper says it may not defend against misinformation attacks, which do not rely on instruction following, and can be less effective against a “weak” attack that the model follows without attending to it strongly (Limitations).
  • SecOPD. It covers indirect injection with a benign user, not jailbreaks or direct injection. It assumes the system is told which parts of the input are trusted. The authors write that future attacks may break the model and that they “do not claim to solve prompt injection” (Limitations).
  • SCOUT. It “composes detectors and does not improve any of them”. Results are English-only, SCOUT-450 has 450 samples, and the paper did not test attackers that target the router itself. The timing numbers are specific to the authors’ A100 and vLLM setup (Limitations).

What you can apply now

  • Match the defense to what you control. Fine-tuning needs model weights. If you call a closed model through an API, the two approaches that sit outside the model are the ones available to you, and PISanitizer was tested in front of four GPT models (Table 2 of PISanitizer).
  • Ask how a defense was attacked. In SecOPD’s Table 1 the same defense shows 28.9%, 5.5% and 94.0% ASR depending on the attack. PISanitizer’s Table 3 reports the same fine-tuned defense at 0.85–1.0 under GCG on long contexts.
  • Measure what the defense does to clean inputs. PISanitizer edited 15–30% of instruction-heavy clean contexts before its sanitizer was fine-tuned, and SCOUT’s headline setting gave up 5.1 points of benign utility.
  • Budget the latency. The reported costs are about 1.8 seconds per sanitized context and about 1.5 seconds per GPT-4o judge call.
  • Keep the other layers. The SecOPD paper states that “no defense should be treated as complete protection” and names input filtering, action constraints, monitoring and least-privilege tool access (Ethical Considerations).

If you already run a detector, you can measure the two rates SCOUT reports on your own labelled log. Each row is one request: whether it was an attack, and whether the detector flagged it.

def detector_report(rows):
    """rows: list of (is_attack, flagged) pairs, both booleans."""
    attacks = [flagged for is_attack, flagged in rows if is_attack]
    benign = [flagged for is_attack, flagged in rows if not is_attack]
    return {
        "attack_pass_through": round(attacks.count(False) / len(attacks), 3),
        "benign_utility": round(benign.count(False) / len(benign), 3),
    }

With 255 attacks of which 16 were not flagged and 195 benign inputs of which 14 were flagged, it returns an attack pass-through of 0.063 and a benign utility of 0.928.

Papers

All three are in the Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing, Budapest, October 2026, and were read from the ACL Anthology on November 29, 2026.

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep reading

All posts