PIMiner: A prompt-injection red-teaming agent system that transfers across models without retrainingAgent Against Agent: An Agentic System for Automatic Prompt Injection Red Teaming
PIMiner's ASR@10 on IPIArena for Gemini-2.5-Pro is 76.2%, and the authors state that strategies can transfer to unseen targets.
Training is grey-box, observing each step's output of the target agent (including the injection step); testing is black-box, with only the final output and success ground truth. The attacker injects text into the untrusted context, with an iteration limit of Nmax per sample (default 10). The victim system is an LLM agent that can call external tools.
- LLM agents can be behaviorally altered by embedded instructions when reading untrusted contexts such as tool outputs. The authors state that RL red-teaming often requires many target queries and transfers poorly, while search-based methods cannot reuse past attack experience.
- During training, PIMiner writes attack success or failure into strategy files and updates the strategy library. The router loads only Top-K strategies; the attacker iterates combining sample history and same-dataset memory; the digester merges or creates strategies by mechanism. At test time, the library can be used directly on unseen targets.
- On IPIArena, ASR@10 for Gemini-2.5-Pro is 76.2%, and on AgentDojo it is 86.7%; for Claude-Opus-4.5 it is 4.8% and 3.3%. On InjecAgent, PIMiner's ASR@10 is 1.0.
- Section 6 states that this work mainly uses the Claude Code model to reduce inference cost, and gives an additional API cost of about $20 for target queries in the training phase. Experiments cover IPIArena, AgentDojo, and InjecAgent; external defenses were not evaluated. The paper does not report the number of repetitions.
- Evaluated models
- Gemini-2.5-ProDeepSeek-V4-ProGPT-4oGPT-4o-miniGPT-5-nanoGPT-5GPT-5.1GPT-4.1-nanoClaude-Haiku-4.5Claude-Sonnet-4.5Claude-Opus-4.5
- Benchmarks
- IPIArenaAgentDojoInjecAgent
- Metrics
- ASR@NASR@1ASR@5ASR@10
The researchers propose PIMiner, an agentic system for prompt injection red-teaming that builds a strategy library during training across multiple (dataset, target model) combinations, and at test time the library transfers directly to unseen target LLMs without additional training, requiring only about 10 queries per test sample. On IPIArena, PIMiner achieves attack success rates of 76.2% for Gemini-2.5-Pro, 61.9% for GPT-5.1, and 42.9% for Claude-Sonnet-4.5; on AgentDojo, 86.7%, 53.3%, and 40.0%, respectively. The authors note that existing reinforcement learning-based prompt injection red-teaming methods produce attack models that generalize poorly to new target LLMs. Code is publicly available.
Related events and news
0 events · 2 news mentions
News that mentions this paper
- Adversa AIcites the paper's id or linkAdversa AI 汇总 2026 年 9 月智能体安全资源 37 项
Agent against agent: an agentic system for automatic prompt injection red teaming
- Failure-Firstcites the paper's id or linkFailure-First AI 安全日报:Google DeepMind 三天内连发两款机器人模型
“Agent Against Agent: An Agentic System for Automatic Prompt Injection Red Teaming” — Wang, Yin, Geng et al., 5 August.
Paper analysis
What problem does this paper attempt to solve?
PIMiner performs prompt injection red-teaming with a transferable strategy library, narrowing the gap between search-based and RL-based methods.
Search-based prompt injection red-teaming cannot accumulate reusable knowledge, and RL attack models often transfer poorly to new target LLMs.
- Scenario: The authors state LLM agents read web pages, documents, and tool outputs, and adversaries can embed instructions in these untrusted contexts. The authors consider red-teaming useful both for pre-deployment evaluation and for collecting successful attacks to train guardrails, improve alignment, and train subsequent attack models.
- Existing Limitations: The authors state that methods like RL-Hammer and PISmith often require tens of thousands of target queries for training and transfer poorly to new target LLMs; GPT-Red improves generalization to unseen defenders but is computationally close to fine-tuning a frontier LLM. TAP, PAIR, and Strategy-based Search search from scratch per sample, which the authors state underperforms RL.
- Hypothesis: The authors attribute the gap to search-based methods' inability to distill historical interactions into reusable attack knowledge.
- This Paper: Proposes PIMiner. Builds a strategy library from scratch on a sequence of (dataset, target model) pairs; at test time, the library can be directly applied to unseen target LLMs without further training. Per-sample queries to the target are few, e.g., 10.
- Threat Model:
- Objective: Generate injections for (instruction I, untrusted context C, injection task G) that cause the agent to execute G. Success is determined by ground-truth indicators; ASR@N means at least one success within N attempts.
- Knowledge: Training is grey-box, observing each step's output, including the step where injection occurs; testing is black-box, with only the final output and success ground truth, following PISmith.
- Capability: Write injection text into C, up to Nmax rounds per sample. The authors state that during training, one can build a simulated environment close to the target, citing Claw Code, Codex CLI, Gemini CLI, and Claude Code as support for this assumption.
- Victim System: LLM agents that can call external tools and act autonomously. Experiments use IPIArena, AgentDojo, and InjecAgent.
What related research exists?
The authors divide automatic red teaming into RL-based and search-based, and argue that the latter lacks attack knowledge that can be accumulated and reused.
Related work in Section 2 is divided into automatic red teaming and agent design; defenses are placed in Appendix A.
RL-Based Red Teaming
- RL-Hammer (2025): Uses GRPO to optimize the attack LLM. The authors state that learned patterns may transfer across samples within the same dataset and target, but transfer to new target LLMs is limited.
- PISmith (2026): Uses entropy regularization and other techniques to stabilize RL training. §5.3 states it is the strongest RL baseline available at the time; its numbers are quoted directly by the authors from that paper, not rerun in this work.
- GPT-Red (citation without year): Trained on multiple defensive agents to generalize to unseen defenders. The authors state that fine-tuning a frontier-scale attack LLM has a compute budget close to a full RL post-training run.
Search-Based Methods and Strategy Libraries
- PAIR, TAP, etc.: Iteratively rewrite injections for each test sample without training an attack model. The authors state they search from scratch and do not consolidate past experience into reusable knowledge, so they are generally inferior to RL methods.
- AutoDAN-Turbo (ICLR 2025): Self-explores and updates a strategy library in jailbreaking. The authors state that jailbreak strategies mainly rely on harmful targets, while prompt injection must simultaneously consider benign user tasks and injected tasks, so they are not the same problem.
- strategy-based search, DTap-Red: Use a pre-given strategy library to guide search. The authors state these libraries are not dynamically updated for new tasks.
Agent System Design
- Heuristic and Automatic Design: ReAct and ToolLLM are manual heuristics; AutoHarness, agentic supernet, and TextGrad are automatic optimization. The authors state that red teaming requires multiple target queries per sample, which is too expensive in practice for large-scale trial and error, so PIMiner uses a heuristic structure and then tests it with ablations.
Baselines, Defenses, and Positioning
- Baselines and Benchmarks: Static handcrafted templates; search-based TAP, PAIR, Strategy; RL-based Vanilla GRPO, RL-Hammer, PISmith. Benchmarks are IPIArena and AgentDojo, plus 30 test samples from InjecAgent.
- Defenses: Appendix A divides defenses into external methods such as detection, sanitization, and safety policies, and internal alignment. The authors state that external methods may be bypassed by adaptive attacks targeting detectors or sanitizers, add overhead, or depend on explicit tool interfaces and policies, and may reduce utility, so this work only red teams internal alignment.
- Positioning: The authors state that this work discovers strategies from scratch and continuously updates the library based on experience across different user tasks, injected tasks, and target models, to narrow the gap between search-based and RL-based red teaming, without needing retraining at test time.
How does the paper address this problem?
PIMiner uses a strategy library, router, iterative attack, and digester to write attack experience into transferable memory.
Overall, this is a search-based red-teaming agent with hierarchical memory: PIMiner. During training, it attacks and updates the library across a sequence of dataset–target model pairs; at test time, it uses the final library ST to generate injections for new pairs, by default without further updating the library.
Problem Setting
- A sample is (target instruction, injectable untrusted context, injection task). The long-term memory S is updated from S0, which contains only structure files, to ST. The same dataset can be paired with different target LLMs.
- The authors mention that real deployments could use test-time training to write test experience back into S. Appendix E states: in this paper, the strategy library is frozen during the test phase and the digester is not invoked.
- Design constraints are written in §4.1: it must both improve hit rate and not put all history into the context, because multi-round per-sample iteration amplifies the cost of each token.
Three-Layer Memory and Four Components
- Long-term memory is the strategy library, across dataset–model pairs. Within-dataset memory is the compressed experience of finished samples in the current pair. Within-sample memory is the current sample's past injections, visible trajectories, success or failure, and attacker analysis.
- The four components are the strategy library, strategy router, iterative attack module, and experience digester (Figure 1). The router only loads relevant long-term strategies into the attacker; within-dataset memory is first compressed into a summary.
Strategy Library and Routing
- Each strategy is a Markdown file containing the target LLM scope, task scope, injection template, context examples, failure conditions, etc. (Table 4). The router uses only the scope section and examples; the attacker and digester read the full text.
- For a sample, Top-K is selected. The paper's routing formula is Ŝ=RouterK(x,M,{ψ(s)},scold): ψ is the routing summary, s_cold defaults to _TEMPLATE.md; when no strategy is available, the attacker generates from scratch. Appendix C gives the router prompt. Experiments default to K=3.
Iterative Attack
- The j-th round injection is generated by p=Attacker(Ŝ,E,H,x,M), with j from 1 to Nmax. H is used to rewrite against observed failures, not to independently sample new variants.
- E is assembled by Curate from trajectories of earlier samples in the same pair, with a default cap of 20K characters. The authors note that PAIR has only H. It stops on a hit or when Nmax is exhausted. Experiments default to Nmax=10.
- Within a pair, rolling parallelism is used with a default pool size of 5: when one sample finishes, the next is added, and later-started samples can see the E of finished samples. Different pairs are executed sequentially. Appendix D gives the attacker prompt and Curate.
Digester and Implementation
- After a pair is fully finished, the digester processes hits by mechanism rather than surface wording: if covered, append an example; if the mechanism is the same but the scope is broader, add an example and relax the scope and template; if no existing mechanism fits, create a new file. Failed samples undergo miss-pattern analysis; repeated failures lower the scope and write failure conditions; even a round with no hits still updates the library. Modifications must cite specific attack examples. Appendix E gives the digestion protocol.
- Orchestration uses Python and Bash. The router, attacker, and digester are mutually isolated Claude Code sessions, with prompts assembled and outputs parsed by Python. The default backbone is Claude-Opus-4.7; training uses xhigh reasoning effort, testing uses low. The authors state that training and testing can use different backbones.
What experiments did the paper conduct?
On IPIArena, ASR@10 is 76.2% for Gemini-2.5-Pro and 4.8% for Claude-Opus-4.5.
Experimental Setup
- Backbone and Metrics: Default backbone Claude-Opus-4.7; training with xhigh, testing with low reasoning effort. K=3, Nmax=10. ASR@N means at least one success within N attempts; unless otherwise stated, N=10. The paper does not report the number of repetitions, nor does it specify the LLM judge model; success or failure is indicated by benchmark ground truth.
- Training Sequence: 8 pairs, i.e., the training splits of IPIArena and AgentDojo, paired respectively with GPT-5-nano, GPT-5, Claude-Haiku-4.5, Claude-Sonnet-4.5. These four models served as targets during training; Gemini-2.5-Pro, DeepSeek-V4-Pro, GPT-4o-mini, GPT-5.1, and Claude-Opus-4.5 in Figure 2 did not.
- Data: IPIArena has 41 items in total, 20 training and 21 test; the text states it covers tool use, coding, and computer-use, and the test domains in Table 3 are Tool 11, Browser 5, Coding 5. AgentDojo randomly sampled 20 training and 30 test items, with the test set being banking 4, Slack 3, travel 6, workspace 17. Additionally, 30 test samples from InjecAgent were used for baseline comparison.
- Targets Under Test: Figure 2 shows Gemini-2.5-Pro, DeepSeek-V4-Pro, GPT-4o-mini, GPT-5-nano, GPT-5, GPT-5.1, Claude-Haiku-4.5, Claude-Sonnet-4.5, Claude-Opus-4.5. DeepSeek-V4-Pro removed test samples with image inputs; the text does not give the count after removal. Baseline comparison additionally uses GPT-4.1-nano.
- Baselines: Static handcrafted templates; search-based TAP, PAIR, Strategy; RL-based Vanilla GRPO, RL-Hammer, PISmith. The authors state that because RL evaluation is expensive, the baseline numbers are taken directly from PISmith's results.
Main Results
The table below lists only numbers explicitly written as ASR@10 in the text. Figure 2 also plots ASR@1 and ASR@5; plain text cannot map bars not named in the text to models column by column, so those cells are not transcribed.
Swipe horizontally to read the table
Target Model Benchmark ASR@10 Source Gemini-2.5-Pro IPIArena 76.2% §5.2, Figure 2 Gemini-2.5-Pro AgentDojo 86.7% §5.2, Figure 2 GPT-4o-mini IPIArena 81.0% §5.2, Figure 2 DeepSeek-V4-Pro AgentDojo 93.3% §5.2, Figure 2 Claude-Sonnet-4.5 IPIArena 42.9% §5.2, Figure 2 Claude-Opus-4.5 IPIArena 4.8% §5.2, Figure 2 Claude-Opus-4.5 AgentDojo 3.3% §5.2, Figure 2 - The ASR in the abstract is not marked with @N: on IPIArena, GPT-5.1 is 61.9%; on AgentDojo, GPT-5.1 is 53.3% and Claude-Sonnet-4.5 is 40.0%. The text does not write ASR@10 numbers for GPT-5, GPT-5-nano, or Claude-Haiku-4.5.
- The authors state that except for Claude-Opus-4.5, attack success rates are high across multiple model families; and that within the GPT family, stronger models are more resistant to injection, with the ordering broadly consistent with earlier IPIArena findings.
- The authors state that PIMiner's ASR@1 on Claude-Sonnet-4.5 on IPIArena is 28.6%; and that in Figure 1 of IPIArena, the average ASR@1 of human attackers is 1.0%. That human number is the authors' restatement of another report, and it is an average of ASR@1, not ASR@10.
Comparison with Existing Red-Teaming Methods
- InjecAgent (Table 1): The RL methods and PIMiner report ASR@10. PIMiner is 1.0 on GPT-4o-mini, GPT-4.1-nano, and GPT-5-nano, the same as PISmith; RL-Hammer is 1.0 on the first two and 0.96 on GPT-5-nano. In the same table, on GPT-5-nano, TAP is 0.08, PAIR is 0.01, Strategy is 0.18, and GRPO is 0.24. The paper does not state whether the static and search-based numbers are ASR@10. The training sequence does not include InjecAgent.
- AgentDojo (Table 2, PISmith and PIMiner are ASR@10): On GPT-4o-mini, PISmith 0.78, PIMiner 0.73; on GPT-4.1-nano, 0.81 and 0.63; on GPT-5-nano, 0.38 and 0.53. The authors state the former is higher than PISmith, the middle is comparable, and the latter is lower, and note that PISmith requires separate training for each target, while GPT-4o-mini and GPT-4.1-nano are unseen targets for PIMiner. GPT-5-nano appeared in the training sequence.
- In the same table, the highest static template is Imp. Instr. at 0.23 on GPT-4o-mini, lower than PIMiner's 0.73 in that row. The authors state that PIMiner is higher than static attacks and conventional search-based attacks.
Memory, Router, and Cross-Attack Models
- Memory: The library is fixed. On IPIArena, average ASR@10 over four training-unseen targets (Gemini-2.5-Pro, DeepSeek-V4-Pro, GPT-4o-mini, GPT-5.1). The authors state that removing either the strategy library or within-dataset memory decreases performance; using both together, compared to an iterative attack with only within-sample memory, is 19.8% higher on Claude-Haiku-4.5 and 17.8% higher on Claude-Sonnet-4.6 (Figure 3). This average does not include Claude-Opus-4.5, which the authors state has low ASR and is not conducive to comparing designs. Figure 3 also labels 13.1, 19.4, 20.6, 32.9, 50.6, 60.5, 64.1, 68.4; plain text cannot map intermediate values to legend entries one by one.
- Router: Figure 5a labels 237K and 136K tokens on Claude-Haiku-4.5, and 236K and 92K on Claude-Sonnet-4.6. The authors state the router reduces input length by 43% and 61%, respectively; ASR decreases by 1.2% on the former and increases by 7.5% on the latter. Figure 5b labels 34.1, 32.9 and 60.9, 68.4.
- Cross-Attack LLM: The library is plugged into PAIR, the router selects 3 strategies, Nmax=10, target GPT-4o-mini, benchmark IPIArena. Attack LLMs are Gemini-2.5-Flash, Gemini-3.1-Flash-Lite, GPT-5.4-nano, GPT-5-mini, GPT-4.1-mini, DeepSeek-V4-Flash. The authors state that Gemini-2.5-Flash's ASR increased from 0.14 to 0.52 (§5.5). Figure 4 also has labels such as 57.1% (12/21); plain text cannot map each bar to a model, so the rest is not transcribed.
Other Ablations and Analyses
- Appendix F: Training produced 7 categories of strategies and 10 strategy files (of which 3 categories each have AgentDojo and IPIArena variants). In Figure 6, Fabricated Procedure Gate has 50 cases and Forged Chat Turn has 29 cases; the authors state these two account for about 80% of all examples; the remaining five categories each have 1–8 cases. Of the 29 cases, 18 correspond to GPT-5-nano; of the 50 cases, 23 correspond to Claude-Haiku-4.5; all 8 cases of Authenticated-Principal Voice Forge correspond to Claude-Sonnet-4.5. The appendix has mechanism descriptions and examples; injection texts are not transcribed here.
- Table 6: The attacker in the training phase uses about 78.0M input tokens and about 1.60M output tokens, estimated at about $115; the mixed target model calls are estimated at about $20. Section 6 states that if the attacker, router, and digester use the Claude Code subscription, the additional API cost is about $20; and states that an RL training example with 10,000 target queries could exceed $100 for GPT-5.
- K and Nmax are fixed at 3 and 10, the parallel pool defaults to 5, and Curate defaults to 20K characters. The paper does not report comparisons for these values.
What are some points that can be further explored?
Section 6 states that the Claude Code model is mainly used; the paper does not separately list subsequent experimental plans.
Limitations and Future Directions Noted by the Authors
- Backbone Choice: Section 6 is titled Discussion and Limitations. It states the pipeline is compatible with different backbone LLMs, but this work primarily uses Claude Code models to reduce inference costs.
- Cost Sentence in the Same Section: If attacker, router, and digester use Claude Code subscriptions, additional API costs for querying target models during training are about $20; contrasted with query counts for RL methods (e.g., 10,000 queries, which could exceed $100 for GPT-5). This is a cost comparison, not a sentence describing pending experiments.
- Conclusion: Section 7 expresses hope that the strategy library can be used for auditing agents and generating training data for defenses. The paper does not frame this as a future experiment plan, nor does it list a separate Future Work entry.
Experimental Coverage
- Main results target the 9 LLMs in Figure 2; baseline comparisons also include GPT-4.1-nano. Training targets are GPT-5-nano, GPT-5, Claude-Haiku-4.5, and Claude-Sonnet-4.5 (§5.1–5.3).
- Data includes 41 IPIArena items (20 training, 21 testing), 20 random AgentDojo training items plus 30 test items, and 30 InjecAgent test items (§5.1, Table 3). DeepSeek-V4-Pro excludes test samples with image inputs; the text does not state the count after exclusion.
- Default backbone is Claude-Opus-4.7, K=3, Nmax=10. Ablations are run on IPIArena with average ASR@10 over 4 training-unseen targets, with test backbones Claude-Haiku-4.5 and Claude-Sonnet-4.6, not including Claude-Opus-4.5. Transfer experiments use 6 attack LLMs targeting GPT-4o-mini (§5.4–5.5).
- Appendix A clarifies that red-teaming targets internal model alignment, not evaluating external detection, filtering, or safety policies, and explains why these external methods are, in the authors' view, inapplicable. Success determination uses benchmark ground-truth indicators; the paper does not specify a review LLM.
- The paper does not report repetitions, variance, or statistical tests, nor agreement between ASR and human judgment. RL baseline numbers are taken from PISmith, not rerun in this work (§5.1). The library is frozen at test time; the text describes test-time training as a user-adaptable setting, not the protocol reported here.
Summarize the main content of the paper
PIMiner distills attack experience into a strategy library, which the authors claim transfers to unseen targets, and reports multiple ASR@10 results.
PIMiner is an agentic system that distills prompt injection red-teaming history into a readable strategy library, used to attack new target LLMs with few queries.
- Problem: The authors state search-based methods search from scratch per sample, while RL methods require many queries and transfer poorly across targets. This work enables the search process to accumulate and reuse attack knowledge.
- Approach: Strategy library, router, iterative attacker, and digester. Memory has three layers: cross-dataset strategies, compressed experience for the same dataset–model pair, and current sample trajectory. Training is grey-box, testing is black-box, and the library is frozen at test time. Default K=3, Nmax=10, backbone is Claude-Opus-4.7.
- Results: In §5.2 ASR@10, Gemini-2.5-Pro achieves 76.2% on IPIArena and 86.7% on AgentDojo; Claude-Opus-4.5 achieves 4.8% and 3.3%. On InjecAgent, PIMiner achieves 1.0 for all three targets in Table 1. On AgentDojo, PIMiner achieves 0.53 for GPT-5-nano and 0.63 for GPT-4.1-nano, while PISmith achieves 0.38 and 0.81 (Table 2).
- Author Conclusions: The authors state the strategies can be directly applied to unseen targets and can also improve PAIR on other attack LLMs (Gemini-2.5-Flash from 0.14 to 0.52). They hope the library can be used for auditing agents and generating defense training data.