TL;DR
PIMiner is a novel agentic red-teaming system designed to automatically discover and catalog prompt injection strategies against LLM agents. By utilizing a hierarchical memory mechanism, it builds a reusable "strategy library" from scratch that directly transfers to unseen target models at test time. This approach matches the performance of computationally heavy reinforcement learning methods while requiring only a fraction of the queries and cost.
What Problem Does This Paper Address?
Autonomous LLM agents are increasingly deployed in real-world applications where they interact with external tools, APIs, and untrusted data sources (like web pages or emails). This setup leaves them highly vulnerable to prompt injection attacks, where an adversary embeds malicious instructions into the data stream to hijack the agent's behavior.
To defend these systems, developers need automated "red-teaming" tools to find vulnerabilities. Existing automated attack methods fall into two flawed categories:
- Reinforcement Learning (RL)-based approaches: These generate highly effective attacks but require tens of thousands of queries to the target model during training and generalize poorly to new, unseen target LLMs.
- Search-based approaches: These optimize attacks for each sample individually but start from scratch every single time, failing to accumulate or reuse knowledge from past successes or failures.
The authors introduce PIMiner to bridge this gap, creating a system that can learn generalizable attack strategies over time without the massive compute budget of RL.
Methods
PIMiner treats prompt injection red-teaming as an evolutionary, agentic process driven by a hierarchical memory mechanism. Instead of updating model weights, it updates a discrete, human-readable Strategy Library stored as Markdown files.
The system consists of four core components:
- Strategy Library: The long-term memory repository containing abstract attack recipes, target scopes, and successful in-context examples.
- Strategy Router: To prevent the attacker's context window from exploding, this agent reads only the summaries of available strategies and selects the top-$K$ most relevant ones for a given sample.
- Iterative Attack Module: This module refines the injection prompt over a small number of steps (typically 10). It synthesizes three levels of memory: long-term (the routed strategies), intra-dataset (condensed experiences from previous samples in the same dataset), and intra-sample (the step-by-step history of the current attempt).
- Experience Digester: A post-run agent that analyzes the trajectories of both successful and failed attacks. It refines existing strategies, expands their scope, adds explicit failure conditions, or creates entirely new strategy files from scratch.
Datasets
The authors evaluated PIMiner using three prominent prompt injection and agent benchmarks:
- IPIArena: 41 samples spanning tool use, coding, and computer-use environments.
- AgentDojo: A dynamic benchmark for tool-using agents covering workspace management, banking, travel, and Slack.
- InjecAgent: 30 test samples specifically utilized to benchmark PIMiner against standard baseline methods.
Key Insights and Ideas
- Knowledge Accumulation is Key: The primary reason search-based methods lag behind RL is their lack of memory. Retaining and structuring discrete attack knowledge allows search-based agents to match RL performance.
- The Power of the Router: Loading an entire strategy library into an LLM's context window introduces noise and high inference costs. PIMiner's router reduces input token length by 43% to 61% while maintaining or even improving the Attack Success Rate (ASR).
- Attacker-Agnostic Strategies: The strategies discovered by PIMiner are not overfitted to the model that generated them. Strategies distilled using Claude models successfully transferred to completely different attacker architectures, including GPT and Gemini variants.
Key Results
PIMiner demonstrated remarkable effectiveness in exposing vulnerabilities across 9 frontier LLMs:
- High Success Rates: On the IPIArena benchmark, PIMiner achieved a 76.2% ASR against Gemini-2.5-Pro, 61.9% against GPT-5.1, and 42.9% against Claude-Sonnet-4.5. Human red-teaming averages on the same benchmark sit at a mere 1.0% ASR@1.
- Baseline Comparison: On InjecAgent, PIMiner achieved a flawless 100% ASR across GPT-4o-mini, GPT-4.1-nano, and GPT-5-nano, matching state-of-the-art RL methods (PISmith and RL-Hammer) while vastly outperforming traditional search methods like TAP and PAIR.
- Extreme Cost Efficiency: Because it bypasses weight optimization, PIMiner's out-of-pocket training cost was approximately $20 (leveraging a Claude Code subscription), compared to the $100+ required for RL methods that demand over 10,000 target queries.
Limitations and Future Work
- The Frontier Resistance: While PIMiner easily broke most models, Claude-Opus-4.5 demonstrated formidable robustness, holding PIMiner to a low 4.8% ASR on IPIArena and 3.3% on AgentDojo.
- Subscription Dependency: The current cost-efficiency model relies heavily on flat-rate Claude Code subscriptions to handle the high volume of internal agent interactions. Without such a setup, API costs for the frontier-scale attacker model (Claude-Opus-4.7) would scale significantly.
- Future Directions: The authors suggest exploring Test-Time Training (TTT) paradigms, where the strategy library continues to dynamically adapt and update during the deployment/testing phase itself.
Summary updated