acceptodds
Under review as a conference paper at ICLR 2027

SpanGuard: Decoupling Instruction Localization from Authorization for Lightweight IPI Defense

Abstract

LLM-based guardrails have shown strong effectiveness against indirect prompt injection (IPI), especially when powered by highly capable language models. However, their effectiveness depends heavily on model capability: once the guardrail model becomes smaller or weaker, detection performance can degrade substantially. This raises a natural question: can we retain strong IPI defense while relying only on a small LLM? To understand why strong models are needed, we revisit what an LLM guardrail actually does. Detecting an IPI requires it to simultaneously locate potentially injected instructions within heterogeneous tool outputs and determine whether those instructions are authorized by the user's request. We find that the challenge for small models arises largely from having to satisfy both requirements jointly, rather than from either subproblem alone. This observation suggests a different path toward lightweight defense: explicitly decouple localization from decision-making. In particular, we find that localization can be handled without strong language-model reasoning, as injected instructions are often semantically discontinuous with their surrounding content and can therefore be partitioned into local regions through lightweight, unsupervised segmentation. Once the observation is partitioned into local regions, the remaining authorization check becomes a localized judgment that can be handled by a small LLM. Building on this insight, we design a lightweight IPI guardrail that performs attack-agnostic localization followed by block-level authorization judgment with a small language model. By separating where to look from what to decide, our approach substantially reduces the capability required of the guardrail model while preserving strong defense performance. Empirically, our guardrail achieves a 0.32% attack success rate with negligible loss in benign utility, while remaining effective with substantially smaller models. These results show that strong IPI defense need not rely on strong LLMs when localization and decision-making are explicitly decoupled.

Primary area:
alignment, fairness, safety, privacy, and societal considerations
Keywords:
indirect prompt injection, LLM security, guardrails, prompt injection detection, LLM agents, safety of AI agents

Reviews

Among:
Shape:
1234this paper, Bottom 27%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 2.00 over 3 reviews, above 27% of the others.
Reviewer_4dh5OpenReview ↗
Rating
2
Confidence
3
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

This paper proposes SpanGuard, an indirect prompt injection (IPI) defense for LLM agents that decouples instruction localization from authorization. It segments tool outputs using semantic continuity and next-token NLL, then applies an LLM judge to identify instructions and determine whether they are authorized based on the user's request and provenance. Evaluations on AgentDojo compare SpanGuard with 13 baselines across two victim models, with additional ablations and adaptive-attack experiments.

Critical strengths
  1. Separating instruction localization from authorization reduces the context that the judge must analyze.
  2. The approach requires no victim-model retraining and incorporates provenance-aware authorization and conservative filtering.
  3. The paper compares 13 baselines and includes victim-model, guardrail-scale, and ablation studies.
Critical weaknesses
  1. Insufficient isolation of the core mechanism. The ablations do not establish whether semantic-continuity and NLL-based segmentation outperform simpler segmentation strategies. The whole-output ablation achieves zero ASR but only 19.59% utility, illustrating that low ASR alone does not demonstrate an effective defense. 2 Limited adaptive robustness evidence. The evaluation does not sufficiently test attacks that smooth semantic transitions or distribute instructions across blocks. SpanGuard also does not outperform every competing defense in all reported adaptive settings.
  2. Incomplete characterization of trade-offs and generalization. The fail-safe policy may remove legitimate content, while the evaluation provides limited insight into such false positives and focuses on AgentDojo's serialized tool outputs.
  3. Unclear end-to-end cost. Localization relies on Qwen2.5-7B for embeddings and NLL scoring. Without a component-level latency or cost breakdown, the practical extent of the lightweight advantage is difficult to assess.
Questions for authors
  1. Can you compare the proposed segmentation with sentence-level, fixed-size, and random contiguous segmentation while keeping the authorization and filtering procedures unchanged?
  2. How robust is SpanGuard against adaptive attacks that minimize semantic discontinuities or distribute a malicious instruction across multiple blocks?
  3. Can you quantify benign-content removal and its impact on task completion, and explain cases where utility under attack exceeds benign utility?
  4. How sensitive are the results to segmentation thresholds, and can you report latency and cost breakdowns for localization versus LLM-based judging?
6 comments

We sincerely thank the reviewer for the thoughtful feedback and constructive suggestions. We appreciate the recognition of SpanGuard's decoupled design and security benefits. The comments have helped us further examine the localization mechanism, adaptive robustness, benign utility, and computational efficiency. We address the concerns point by point below.

Q1: Can you compare the proposed segmentation with sentence-level, fixed-size, and random contiguous segmentation while keeping the authorization and filtering procedures unchanged?

To evaluate the effectiveness of our localization strategy, we compare whole-output authorization with four segmentation alternatives, keeping the authorization judge and filtering procedure unchanged.

Table 1. Comparison of different segmentation strategies.

UnitBUUAASRJudgments/task
Whole output73.20%19.59%0.00%6.8
Sentence75.26%53.61%21.65%114.4
Fixed-size73.03%35.90%29.92%77.2
Random74.69%28.11%33.81%57.8
Block (Ours)71.13%69.07%2.06%36.8

Whole-output authorization achieves 0% ASR, demonstrating that our small judge can effectively identify unauthorized instructions when localization is simplified to a binary classification of whether the entire output contains an injection. However, removing the entire output also discards benign content, resulting in only 19.59% UA and preventing the agent from completing its original task.

Our segmentation strategy addresses this limitation by separating injected instructions from surrounding benign content while preserving the integrity of the instructions for authorization. As shown in Table 1, it substantially improves UA to 69.07% while maintaining a low ASR of 2.06%. In contrast, sentence-level, fixed-size, and random segmentation fail to achieve a comparable security–utility balance. These results demonstrate that effective localization enables the judge to make reliable block-level decisions while avoiding unnecessary removal of benign content, thereby helping the agent recover its ability to complete the user's task.

Furthermore, our semantic segmentation requires only 36.8 judgments per task, substantially fewer than the alternative fine-grained strategies (57.8–114.4), further reducing authorization overhead.

Q2: How robust is SpanGuard against adaptive attacks that minimize semantic discontinuities or distribute a malicious instruction across multiple blocks?

We introduce two targeted adaptive attack variants to challenge the two central components of SpanGuard:

  • Smooth transitions: the attacker constructs payloads with smooth semantic transitions between benign and malicious sentences, aiming to evade localization.
  • Fragmented instructions: the attacker distributes an injected instruction across multiple records, aiming to prevent the authorization judge from recognizing the complete malicious intent within individual blocks.

We evaluate these attacks using GPT-4.1-mini as the attacker. The results are shown in Table 2.

Table 2. SpanGuard's robustness against targeted adaptive attacks.

DefensePlainSmoothFragmented
No defense64.5%74.2%51.6%
SpanGuard9.7%6.5%12.9%

SpanGuard maintains low ASR under both targeted variants. Notably, smooth transitions do not increase ASR (6.5% vs. 9.7% in the plain setting). As demonstrated in Table 1, even when semantic boundaries are obscured, whole-output authorization can still identify the presence of injected instructions. Thus, disrupting segmentation alone does not suffice to evade SpanGuard, since the authorization judge can still recognize the attack at a coarser granularity. Fragmented instructions are more challenging, increasing ASR to 12.9%, although distributing instructions across separate records can also make them harder for the victim agent to interpret and execute. These results further demonstrate SpanGuard's robustness against attacks targeting its localization and authorization stages. This additional evaluation is included in Appendix A.6 of the revised manuscript.

Q3: Can you quantify benign-content removal and its impact on task completion, and explain cases where utility under attack exceeds benign utility?

We additionally evaluate benign utility on τ\tau-bench (Yao et al., 2024; Barres et al., 2025), an agent benchmark involving tool interactions, using two victim models: GPT-6-Luna and GPT-4.1-mini. We evaluate 25 tasks each in the Airline and Retail domains, adopting a Pass3\text{Pass}^3 criterion, where a task is considered successful only if all three independent trials succeed. As shown in Table 3, SpanGuard achieves comparable task success rates to no defense across both victim models, with only a modest utility reduction on GPT-4.1-mini. Interestingly, SpanGuard achieves higher success rates than no defense with GPT-6-Luna. We attribute this improvement to variations in the victim model's responses rather than gains from the defense itself.

Table 3. Benign task success rates on τ\tau-bench with two victim models.

Victim ModelDefenseAirlineRetailPooled
GPT-6-LunaNo defense41.3%73.3%57.3%
SpanGuard45.3%80.0%62.7%
GPT-4.1-miniNo defense51.1%80.0%65.6%
SpanGuard46.7%75.6%61.1%

We further analyzed the 167,356 content blocks processed during the benign utility evaluation with GPT-6-Luna. SpanGuard removed only 17 blocks (0.010%), none of which changed the corresponding task outcomes. We identify two typical sources of false removals: (1) instructions unrelated to the user's task, which the judge considers unauthorized and whose removal generally does not affect task completion; and (2) instructions from external sources that the user has implicitly authorized (e.g., asking the agent to follow instructions in an email), where the judge may fail to recognize this delegation. The latter reflects a trade-off between utility and security, whose appropriate balance depends on the application scenario.

Regarding why utility under attack can exceed benign utility, SpanGuard is designed to remove the core unauthorized instructions rather than necessarily eliminate every part of an injected payload. The remaining content may contain prompt-engineering elements that reinforce the agent's instruction-following behavior. Once the core malicious objective is removed, these elements can sometimes help the agent complete the original task. We believe this phenomenon also exposes a limitation in the default agent configuration of AgentDojo: its system prompts may not sufficiently reinforce instruction-following behavior, allowing external content to inadvertently improve task compliance.

Yao, S., Shinn, N., Razavi, P., & Narasimhan, K. (2024). $\tau $-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains. arXiv preprint arXiv:2406.12045.

Barres, V., Dong, H., Ray, S., Si, X., & Narasimhan, K. (2025). τ2\tau^ 2-Bench: Evaluating Conversational Agents in a Dual-Control Environment. arXiv preprint arXiv:2506.07982.

Reviewer_qUkYOpenReview ↗
Rating
2
Confidence
4
Informativeness
2
Presentation
3
Soundness
3
Read review
Paper summary

Build a prompt injection detector, using small models.

Critical strengths
  • Studies a relevant, practical problem.
  • A strong, prompting-based solution that provides strong security against adaptive optimization-based attacks would be amazing to have.
  • Achieves better security than other prompting-based defenses.
  • Has a reasonably good evaluation against adaptive optimization-based attacks.
  • Offers some new ideas about a path to improve detection of prompt injection attacks.
  • Reasonably good utility on Llama 3.3 70B on AgentDojo.
Critical weaknesses
  • The evaluation is not up to current standards. GPT-4.1-mini and Llama 3.3 70B are very old models, by current standards. I'd be interested to see an evaluation with modern models. Using modern models can make a big difference to performance on agentic tasks. There is a substantial drop in benign utility on AgentDojo for GPT-4.1-mini; if modern models experienced a similar drop, I suspect the defense would not be acceptable.
  • The evaluation of impact on (bneign) utility only considers AgentDojo. It has become standard to evaluate on a large suite of utility benchmarks, as some defenses will have good utility on some benchmarks and bad on a few benchmarks, and that is important to know. Table stakes these days for a defense is that it must maintain very good benign utility (e.g., 1 percentage point utility drop or less) across a wide suite of benchmarks.
  • The paper does not evaluate the cost of detection. By running a small model on many small blocks, the cost might be much higher than running it on the entire input, because of the overhead for each block (the zero-shot prompt and user message must be included in the input to the authorization LLM for each block). Therefore, it's important to evaluate the cost of the detector. I suspect that SpanGuard with 7B model might cost significantly more than the competing schemes with 7B model, so it might not actually be a fair comparison (in Table 1). A fair comparison should ensure a similar budget/cost for detection. Probably cost should be evaluated by using an API provider.
  • I would find the security eval against adaptive attack a bit more convincing if the paper also evaluated against some SOTA defenses based on post-training the model. The paper uses an adaptive attack that might be good, but is slightly non-standard and slightly old (e.g., uses Gemini-2.5-Flash as the attacker model), so adding that comparison would help give me more confidence in the eval. This might not be a critical enough weakness to warrant rejection, though.

Detailed comments (not critical weaknesses):

(5) I suggest that you introduce the concept of provenance here. What do you mean by that, conceptually, and why is it important?

(6): I don't like your notation. I think a better notation would be o′=[ri∣di=1]o' = [r_i | d_i=1]. S\mathcal{S} is never defined. I don't like the notation dii=1md_i {}_{i=1}^m, that is not standard notation.

Sec 4.2: The localization phase seems a bit ad-hoc.

The focus on sentence-level units seems like it might have problems generalizing. Some tool-call outputs are not natural languages structured into sentences. Some might have other formats, e.g., HTML, XML, JSON, etc. etc., which need not have any sentence structure. This might lead to very coarse units, which might make the authorization model ineffective.

I don't understand why the unit refinement method would be useful. In ordinary natural language text, I would not expect there to be much similarity between adjacent words in the same sentence.

Threshold calibration seems to require labeled examples. Where do you get the labels from? Does the same threshold work for a range of different formats of tool outputs?

Sec 4.3: I don't understand what you mean by "the field from which the block originates". Please explain this better. How is it extracted? Why is it important?

How is the tool call specified? Do you include the entire tool call, with all its parameters?

Sec 5.3: The latency evals don't say whether they take into account batching. Batching is essential for acceptable performance. Probably latency eval should be done by using an API provider, and using parallel API queries.

Sec 5.5: "Number of judgements" doesn't matter. What matters is cost. I don't see any reason to optimize or reduce "number of judgements"; but there would be reason to optimize/minimize cost. Hopefully fewer judgements will reduce cost, because of the overhead for each judgement, but this would be more convincing with evaluation of cost.

Table 6: Including provenance information significantly harms benign utility. Do you have any understanding or hypothesis of why? I'm not sure whether harming benign utility, in exchange for reducing ASR a bit, is a good tradeoff.

Appendix A.1: Putting untrusted data like the fragment into the user prompt seems like a bad idea. That seems like it could introduce direct prompt injection attacks, where the user message overrides the system message. Moreover current models expect and look for and try to follow instructions in the user prompt. Current models are not super robust at enforcing that the system prompt takes precedence over the user message. I think all untrusted contents, such as the block/fragment, should be in a tool-call-output message, as models as trained to not follow instructions in there.

For similar reasons, including tool call arguments in the user message seems risky to me.

There is an opportunity to evaluate whether performance can be further improved, and cost further reduced, by fine-tuning the authorization model rather than using zero-shot prompting.

It's my feeling that this paper is not up to the standard for ICLR 2027. I'd suggest updating the experiments to use modern models (GPT Luna 6.1 is quite inexpensive), then send to Euro S&P or ASIACCS.

Questions for authors

Are you able to evaluate utility on a variety of utility benchmarks?

Are you able to give higher confidence in the security against adaptive optimization-based attacks, e.g., by comparing to a model-training defense, and/or by using a strong attack that is a bit more standard in the best recent papers?

Are you able to show how well your scheme works with modern models?

11 comments

We sincerely thank the reviewer for the careful assessment and constructive feedback. We appreciate the recognition of SpanGuard's practical motivation and security performance, as well as the detailed suggestions on strengthening the evaluation and clarifying the methodology. The feedback has helped us further improve the paper, and we address the comments point by point below.

Q1: Are you able to evaluate utility on a variety of utility benchmarks?

We additionally evaluated benign utility on τ\tau-bench (Yao et al., 2024; Barres et al., 2025), an agent benchmark involving tool interactions, using two victim models: GPT-6-Luna and GPT-4.1-mini. We evaluated 25 tasks each in the Airline and Retail domains, adopting a Pass3\text{Pass}^3 criterion: a task is considered successful only if all three independent trials succeed. As shown in Table 1, SpanGuard achieves comparable success rates to no defense across both victim models, with only a modest utility reduction on GPT-4.1-mini. Interestingly, SpanGuard yields higher success rates with GPT-6-Luna than no defense. We attribute this improvement to variations in the victim model's responses across independent trials, rather than a direct utility gain from SpanGuard, which is designed to preserve task-relevant content rather than improve task execution.

We further analyzed the 167,356 content blocks processed during the benign utility evaluation with GPT-6-Luna. SpanGuard removed only 17 blocks (0.010%), none of which changed the corresponding task outcomes. This is consistent with one type of false positive in SpanGuard: removing instructions unrelated to the user's original task, which typically does not prevent task completion. We have included these results in Appendix A.4.

Table 1. Benign task success rates on τ\tau-bench with two victim models.

Victim ModelDefenseAirlineRetailPooled
GPT-6-LunaNo defense41.3%73.3%57.3%
SpanGuard45.3%80.0%62.7%
GPT-4.1-miniNo defense51.1%80.0%65.6%
SpanGuard46.7%75.6%61.1%

Yao, S., Shinn, N., Razavi, P., & Narasimhan, K. (2024). $\tau $-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains. arXiv preprint arXiv:2406.12045.

Barres, V., Dong, H., Ray, S., Si, X., & Narasimhan, K. (2025). τ2\tau^ 2-Bench: Evaluating Conversational Agents in a Dual-Control Environment. arXiv preprint arXiv:2506.07982.

Q2: Are you able to give higher confidence in the security against adaptive optimization-based attacks, e.g., by comparing to a model-training defense, and/or by using a strong attack that is a bit more standard in the best recent papers?

We first compare SpanGuard with Meta-SecAlign (Chen et al., 2025), a post-training defense, under evolutionary and greedy search attacks, using Llama-3.3-70B as the victim model. As shown in Table 2, SpanGuard consistently outperforms Meta-SecAlign, while combining the two defenses further improves robustness, demonstrating their complementary benefits.

Table 2. Adaptive attack comparison of SpanGuard, Meta-SecAlign, and their combination.

DefenseEvolutionaryGreedy
No defense70.6%58.8%
SpanGuard17.6%17.6%
Meta-SecAlign29.4%29.4%
Meta-SecAlign + SpanGuard5.9%0.0%

Second, we further strengthen the adaptive attacks to target the specific components of SpanGuard. Our search procedure is adapted from AttriGuard (He et al., 2026) and uses GPT-4.1-mini as the attacker model (rather than Gemini-2.5-Flash). We extend the original attack with two targeted payload variants: Smooth, which smooths semantic transitions between sentences to evade segmentation, and Fragmented, which splits an injected instruction across multiple records to evade block-level authorization. As shown in Table 3, SpanGuard maintains low ASR under both targeted variants. Notably, smooth transitions do not increase ASR (6.5% vs. 9.7% in the plain setting). Even when semantic boundaries are obscured, whole-output authorization can still identify injected instructions, so disrupting segmentation alone does not suffice to evade SpanGuard. Fragmented instructions are more challenging, increasing ASR to 12.9%, although distributing instructions across separate records can also make them harder for the victim agent to interpret and execute. These results further demonstrate SpanGuard's robustness against attacks targeting its localization and authorization stages. We have included this analysis in Appendix A.6.

Table 3. Adaptive attack results across different payload styles.

DefensePlainSmoothFragmented
No defense64.5%74.2%51.6%
SpanGuard9.7%6.5%12.9%

Chen, S., Zharmagambetov, A., Wagner, D., & Guo, C. (2025). Meta secalign: A secure foundation llm against prompt injection attacks. arXiv preprint arXiv:2507.02735.

He, Y., Zhu, H., Li, Y., Shao, S., Yao, H., Liu, Z., & Qin, Z. (2026). AttriGuard: Defeating indirect prompt injection in LLM agents via causal attribution of tool invocations. Proceedings of the 35th USENIX Security Symposium (USENIX Security 26) (pp. 1547–1566). USENIX Association. https://www.usenix.org/conference/usenixsecurity26/presentation/he-yu

Q3: Are you able to show how well your scheme works with modern models?

We additionally evaluated SpanGuard using GPT-6-Luna as the victim model, with PromptArmor (Shi et al., 2025) and no defense as baselines. As shown in Table 4, direct attacks achieve the highest ASR against the undefended model (14.29%), while the other attack types have substantially lower ASRs. This may indicate that GPT-6-Luna has been safety-aligned to recognize and resist common prompt-injection patterns. Nevertheless, SpanGuard further reduces the overall ASR from 4.92% to 0.16%, achieving zero ASR on five of the six attack types. This demonstrates that SpanGuard provides additional protection even when the victim model already exhibits resistance to common attacks.

SpanGuard's BU decreases from 88.42% to 84.21% (4.21 percentage points). Our error analysis attributes this entire decrease to tasks in which users ask the agent to follow instructions contained in external content. The authorization judge often considers these instructions insufficiently authorized because the user did not directly specify them, and consequently removes them. We consider this a reasonable security-utility trade-off: prioritizing security may invalidate some user-authorized instructions embedded in external content, but helps prevent unauthorized instructions from influencing the agent. We have included these results in Appendix A.7.

Table 4. Results on GPT-6-Luna as the victim model.

VictimDefenseBUD-UAD-ASRIP-UAIP-ASRSM-UASM-ASRIA-UAIA-ASRII-UAII-ASRTK-UATK-ASROverall UAOverall ASR
GPT-6 LunaNo defense88.42%86.67%14.29%90.48%0.95%87.62%7.62%89.52%0.00%91.43%3.81%91.43%2.86%89.52%4.92%
PromptArmor87.37%83.81%5.71%91.43%0.00%87.62%0.95%87.62%0.95%91.43%0.00%90.48%0.00%88.73%1.27%
SpanGuard84.21%73.33%0.95%80.95%0.00%76.19%0.00%78.10%0.00%81.90%0.00%80.00%0.00%78.41%0.16%

D: Direct; IP: Ignore-Prev.; SM: System Message; IA: InjecAgent; II: Important Instructions; TK: Tool Knowledge.

Shi, T., Zhu, K., Wang, Z., Jia, Y., Cai, W., Liang, W., ... & Song, D. (2025). Promptarmor: Simple yet effective prompt injection defenses. arXiv preprint arXiv:2507.15219.

Reviewer_2iXjOpenReview ↗
Rating
2
Confidence
2
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

This paper argues that LLM-based guardrails against indirect prompt injections (IPI) need strong models because a single model must both locate injected instructions and judge whether they are authorized. The authors propose SpanGuard, which first splits tool outputs into blocks using an unsupervised NLL-based segmentation calibrated only on benign data, and then lets a small LLM judge each block using the user task and tool provenance. On AgentDojo with a Qwen2.5-7B guardrail, SpanGuard reports attack success rates of 0.32% and 0.00% for GPT-4.1-mini and Llama-3.3-70B with a small utility loss against thirteen baselines, and the paper further evaluates guardrail scale and family, latency, adaptive attacks, and ablations.

Critical strengths
  1. The idea of separating where to look from what to decide is clear and intuitive, and Figures 1 and 2 explain it well.
  2. The localization stage needs no training and no attack samples, which is attractive in practice.
  3. The comparison is broad, covering thirteen baselines on two victim models with a per-attack breakdown.
  4. The paper includes scaling, latency, adaptive attack, and ablation experiments, and the appendix provides the full judge prompt and attack templates.
Critical weaknesses
  1. The central claim that small models fail mainly because localization and authorization are coupled is not directly tested. Table 5 even shows that the same judge applied to the whole output already reaches 0.00% ASR, which suggests that segmentation mainly improves utility rather than security. Please add a controlled comparison that applies the same judge to the full output, to ground-truth injection spans, and to SpanGuard blocks, so that the effect of decoupling can be separated from that of the judge prompt design.
  2. All results come from AgentDojo, whose attacks are fixed templates starting with obvious markers such as “TODO:” or “IMPORTANT!!!”. Such markers naturally produce a high NLL and may favor the segmentation, which weakens the attack-agnostic claim. Figure 4 also shows that the median NLL at injection ends lies below the threshold, so many boundaries seem to be missing. Please report boundary detection accuracy, evaluate on another benchmark or on injections without such markers, and provide the missing segmentation details.
  3. The adaptive attacks in Table 4 use a generic mutation search on a small set of cases rather than attacks that target SpanGuard, for example splitting an instruction across blocks, blending it smoothly into the host text, or phrasing it as data, which the judge prompt treats as harmless. SpanGuard’s ASR also rises from 0.32% to 12.9% under Evolutionary search, so “highly resistant”seems too strong. Please add SpanGuard-specific adaptive attacks or discuss these limitations.
  4. The lightweight claim is overstated. Localization also uses the Qwen2.5-7B model, SpanGuard is slower than PromptArmor and CausalArmor (Table 3), and its BU drops to about 0.2 to 0.5 with small guardrail models in Figure 3, so its low ASR at small scales may partly come from removing most of the content. Please clarify which model performs localization in the scaling experiments and qualify the efficiency and small-model claims.

Minor comments:

  1. Eqs. (5) and (11) write “∈ 0, 1” instead of ∈ {0, 1}, and Eq. (6) is missing the braces around d_i.
  2. Naming is inconsistent, e.g., “tool filter”, “Tool filter”, and “tool_filter”; “Llama Guard 3” and “Llama-Guard-3”; “injecagent” and “InjecAgent”; and “gpt-4.1-mini” in Table 1 vs. “GPT-4.1-mini” in the text.
  3. “Six LLM families” counts Qwen2.5 and Qwen3 separately, and the Figure 3 panel labeled “Llama-3.1” includes the 1B and 3B Llama-3.2 models.
  4. The captions of Table 1, Figure 3, and Tables 2 to 4 should state the victim model, the number of cases, and the abbreviations used (e.g., Imp.-Instr. and Tool-Know.).
  5. “NLL” is used in Figure 2 before it is defined, and “IPI” is defined twice.
  6. References lose capitalization (e.g., “Agentdojo”, “llm”, “Promptarmor”) and show stray braces in “{StruQ}” and “{LLM}”.
Questions for authors
  1. Does decoupling actually drive the security gains?
  2. How robust is localization beyond AgentDojo's template attacks?
  3. How lightweight is SpanGuard really?
6 comments

We sincerely thank the reviewers for their valuable suggestions on the decoupling of localization and authorization, adaptive robustness, and computational efficiency. These comments have helped us strengthen our evaluation and clarify the contributions of SpanGuard. We have conducted additional experiments to address these concerns.

Q1: Does decoupling actually drive the security gains?

We thank the reviewer for this insightful suggestion. We agree that segmentation primarily improves utility rather than being necessary for achieving low ASR. To investigate the respective contributions of localization and authorization, we conduct a controlled comparison using the same Judge under three different judgment granularities: the entire tool output, SpanGuard's localized blocks, and ground-truth injection spans.

Table 1: Comparison of judgment granularities. Injection Recall measures the proportion of injected blocks successfully identified by the Judge, while False Removal Rate measures the proportion of benign content characters erroneously removed.

Judgment GranularityInjection RecallFalse Removal RateUAASR
No Defense (Reference)----59.4%78.1%
Whole Output100.0%59.0%23.4%0.0%
SpanGuard Blocks (Ours)100.0%1.1%71.9%0.0%
Ground-Truth Spans100.0%0.0%76.6%0.0%

The results reveal distinct contributions of the two components. First, the Judge achieves 100% injection recall and 0% ASR across all three granularities, demonstrating that our Judge can reliably identify and reject injected instructions without requiring precise segmentation to achieve attack prevention. However, applying it to the entire output leads to substantial removal of benign content, severely degrading task utility. In contrast, SpanGuard's localization substantially reduces false removal, allowing the agent to retain task-relevant information and recover its original task performance while maintaining the same security level. Its performance also approaches that of ground-truth segmentation.

Overall, these results clarify that the key benefit of our decoupled design is not simply achieving lower ASR, but improving the security–utility trade-off. The Judge provides reliable authorization decisions, while attack-agnostic localization enables precise block-level sanitization. Together, they prevent injected instructions from influencing the agent while preserving sufficient benign information for task completion.

Q2: How robust is localization beyond AgentDojo's template attacks?

We thank the reviewer for highlighting the need to evaluate SpanGuard beyond AgentDojo. We therefore conducted additional experiments on ASB (Zhang et al., 2025) and InjecAgent (Zhan et al., 2024), using GPT-4.1-mini as the victim model and PromptArmor (Shi et al., 2025) as a baseline.

On ASB, SpanGuard achieves the best overall UA and ASR among the evaluated defenses, and performs best in most individual attack settings. Note that ASB's ASR measures whether injected content is identified as successful by its benchmark-specific evaluation, rather than whether the agent actually executes the injected task. Its ASR is therefore not directly comparable to that of AgentDojo and tends to be higher. On InjecAgent, SpanGuard achieves an overall ASR of 0.4%, comparable to PromptArmor (0.5%) and substantially lower than no defense (16.7%). Together, these results provide further evidence of SpanGuard's effectiveness across different benchmarks and attack settings.

Table 2. Results on ASB using GPT-4.1-mini as the victim model. Bold numbers indicate the best results among all defense methods.

DefenseClean BUNaive UANaive ASRFake-Compl. UAFake-Compl. ASREscape-Chr. UAEscape-Chr. ASRCtx.-Ignoring UACtx.-Ignoring ASRCombined UACombined ASROverall UAOverall ASR
No defense78.0%45.7%76.4%45.7%67.3%37.5%74.5%37.0%72.6%31.7%69.2%39.5%72.0%
PromptArmor74.0%49.5%51.4%54.8%29.3%44.2%54.3%59.6%8.2%58.7%7.2%53.4%30.1%
SpanGuard76.0%58.2%9.6%60.6%4.8%55.3%10.6%59.1%10.1%53.4%10.6%57.3%9.1%

Table 3. Results on InjecAgent using GPT-4.1-mini as the victim model. Bold numbers indicate the best results among all defense methods.

DefenseDirect Harm Valid RateDirect Harm ASRData Stealing Valid RateData Stealing ASROverall Valid RateOverall ASR
No defense92.4%10.0%91.7%23.0%92.0%16.7%
PromptArmor80.0%1.0%78.7%0.0%79.3%0.5%
SpanGuard84.5%0.8%81.8%0.0%83.1%0.4%

Regarding the NLL distributions in Figure 4, we clarify that SpanGuard is not designed to recover the complete start and end boundaries of injected content. Instead, its goal is to localize the core unauthorized instructions for removal. Therefore, an injection-end boundary falling below the segmentation threshold does not necessarily indicate a failure: the critical instruction may already have been isolated by a boundary within the injected region, without requiring the entire payload to be segmented out.

To further evaluate the practical effectiveness of localization, we conduct controlled segmentation ablations, keeping the authorization judge and filtering procedure unchanged. As shown in Table 4, our semantic segmentation achieves 69.07% UA and 2.06% ASR, substantially outperforming alternative segmentation strategies in security–utility balance. It also requires only 36.8 judgments per task, compared with 57.8–114.4 for the other fine-grained strategies. These results demonstrate that our segmentation effectively isolates critical injected instructions while preserving surrounding benign content, directly improving end-to-end defense performance and reducing authorization overhead.

Table 4. Comparison of different segmentation strategies.

UnitBUUAASRJudgments/task
Whole output73.20%19.59%0.00%6.8
Sentence75.26%53.61%21.65%114.4
Fixed-size73.03%35.90%29.92%77.2
Random74.69%28.11%33.81%57.8
Block (Ours)71.13%69.07%2.06%36.8

Shi, T., Zhu, K., Wang, Z., Jia, Y., Cai, W., Liang, W., ... & Song, D. (2025). Promptarmor: Simple yet effective prompt injection defenses. arXiv preprint arXiv:2507.15219.

Zhang, H., Huang, J., Mei, K., Yao, Y., Wang, Z., Zhan, C., ... & Zhang, Y. (2025, May). Agent security bench (asb): Formalizing and benchmarking attacks and defenses in llm-based agents. In International Conference on Learning Representations (Vol. 2025, pp. 35331-35366).

Zhan, Q., Liang, Z., Ying, Z., & Kang, D. (2024, August). Injecagent: Benchmarking indirect prompt injections in tool-integrated large language model agents. In Findings of the Association for Computational Linguistics: ACL 2024 (pp. 10471-10506).

Q3: How lightweight is SpanGuard really?

We characterize the lightweight property of SpanGuard along two dimensions: model and memory requirements, and inference latency. We discuss each aspect separately below.

Model and memory requirements. First, we clarify that the segmentation model and the authorization Judge use the same model scale throughout our experiments, including the model-scaling experiments in Figure 3. This controlled setup allows us to fairly evaluate how the overall defense model scale affects performance; the segmentation model is not fixed at 7B. Importantly, however, the two stages do not require the same level of model capability. To demonstrate this, we conducted an additional experiment using a 0.5B model for segmentation and a 7B model for authorization, achieving 73.2% BU and 0.0% ASR. This result shows that localization can be handled by a substantially smaller model, while the main model-capability requirement lies in the authorization stage.

Figure 3 characterizes the performance degradation when scaling down both components, rather than claiming that SpanGuard remains fully usable with arbitrarily small models. To further illustrate its practical operating points, we compare SpanGuard with other LLM-based defenses at smaller model scales across three model families. As shown in Table 5, SpanGuard maintains relatively high utility and low ASR with 7B Qwen2.5, 4B Qwen3, and 3B Llama-3.1 models, offering a favorable security-utility trade-off at these scales. These results suggest that SpanGuard can provide effective protection without relying on the larger models often used by LLM-based defenses.

Table 5. Comparison with LLM-based defenses at representative model scales, using GPT-4.1-mini as the victim model.

FamilyModel SizeMethodBUASR
Qwen2.57BSpanGuard (ours)72.2%0.0%
PromptArmor72.2%13.4%
AttriGuard58.8%17.5%
Qwen34BSpanGuard (ours)75.3%3.1%
PromptArmor78.4%8.3%
AttriGuard69.1%30.9%
Llama-3.13BSpanGuard (ours)68.0%4.1%
PromptArmor71.1%48.5%
AttriGuard48.5%18.6%

Inference latency. Regarding efficiency, we acknowledge that SpanGuard does not achieve the lowest inference latency. Whole-input methods such as PromptArmor and CausalArmor have lower latency in our current evaluation. Instead, SpanGuard's lightweight advantage lies primarily in its smaller model-scale requirements and the associated memory footprint. It is also faster than action-based methods such as AttriGuard and MELON. We further break down SpanGuard's latency per tool output: 1.152 s in total, with 0.188 s for segmentation and 0.964 s for authorization. Since block-level authorization calls are independent, they can be executed concurrently to further reduce latency. We disable parallel execution in our reported measurements for fair comparison, leaving room for additional latency improvements in practical deployments.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.