SED: Training-Free Continuous Safety Policy Learning Framework for LLM AgentsSelf-Evolving Defense: Continual Security Policy Learning for LLM Agents
SED distills harmful agent trajectories into retrievable safety policies without updating weights; on AgentDojo it reduces targeted injection success rate to 0.42% while preserving benign utility.
The adversary pursues a harmful goal g, can perturb the query xt (jailbreak) or the environment et (indirect prompt injection), and observes the interaction history Ht-1 so far. The target model's weights are frozen, there are no future queries at deployment time, and there are no ground-truth harm labels.
- Tool use, repository modification, and cross-session memory expose LLM agents to jailbreaks, prompt injection, and unsafe code generation. Existing defenses often require retraining, cannot adapt to evolving attacks, or cover only a single threat surface.
- Self-Evolving Defense (SED) does not update weights: an external judge scores the full trajectory, writes harmful failures into episodic memory and synthesizes them into hierarchical policies; on the next task, top policies are retrieved by query and injected into the system prompt along with parent rules.
- On DeepSeek-V4-Flash, SED reduces AgentDojo targeted attack success rate to 0.42%, X-Teaming to 7.8%, and the CWE-538 rate in resolved SWE-bench patches from 19.2% to 2.9%, while maintaining benign task utility.
- The authors note that new attacks very different from seen failures may retrieve no usable policy; and the effect of stronger or specialized reviewer models is not examined. Evaluation is conducted online across three open-source models and eight benchmarks, with memory not carried across benchmarks.
- Evaluated models
- DeepSeek-V4-FlashGLM-5.2Kimi K3
- Benchmarks
- WildJailbreakHarmBenchRedCodeAgentHarmFCV (CWE-538 / SWE-bench)AgentDojoAgentDynDTapAutoDAN-TurboX-Teaming
- Metrics
- ASRtargeted ASRbenign utilityutility under attackSWE-bench resolve rateover-refusal
The researchers propose Self-Evolving Defense (SED), a training-free framework that distills harmful agent trajectories into reusable safety policies without updating model weights, and retrieves relevant policies in future tasks to continuously adapt to new attacks. The authors test SED on three open-source models, DeepSeek V4 Flash, GLM 5.2, and Kimi K3, across eight benchmarks covering jailbreak, prompt injection, and unsafe code generation. Results show that SED reduces the targeted prompt injection success rate on AGENTDOJO to 0.42%, compared to 3.7% for the best baseline defense; on HARMBENCH it keeps the adaptive X-TEAMING attack success rate at 7.8%, versus 35.2% for the best baseline, while maintaining benign task utility. The paper is 39 pages with 6 figures, and the code is publicly available.
Related events and news
1 events · 0 news mentions
- This event's paper
SED:免训练持续安全策略学习防御LLM Agent
Paper analysis
What problem does this paper attempt to solve?
How to let the agent's defense accumulate reusable safety policies as attacks continue, without updating the weights.
How can a frozen-weight LLM agent continuously learn reusable safety policies from its own harmful failures, covering jailbreaks, prompt injection, and unsafe code, without resorting to blanket refusal to achieve safety?
- Scenario: The authors argue that agents like OpenHands and SWE-agent call tools, modify repositories, and retain memory across sessions, and their safety failures cover prompt injection on tool agents, adaptive multi-turn jailbreaks, and hidden vulnerability injection on coding agents. When agents are granted privileged tool calls, repository edits, and cross-session memory writes, defense becomes a reliability problem.
- Three shortcomings of existing methods: The authors claim that adversarial training, refusal fine-tuning, and dedicated guard models only improve safety on their optimized distribution, and refreshing them is costly when attack families update or the underlying model changes; static system prompts, frozen policy libraries, and one-time guardrails assume a stationary threat, while adaptive attackers can continuously probe fixed defenses; jailbreak refusal, prompt injection architectures, and code safety checks are usually developed separately, and gains on one benchmark rarely transfer to another. Memory-augmented guardrails mitigate the latter two points but still do not convert harmful trajectories judged on the defended agent into reusable safety policies.
- Core observation: The authors argue that judge-determined failures are not just one-time events to refuse, but structured evidence; as attackers iterate across jailbreak, injection, and coding surfaces, underlying safety invariants recur with different phrasings.
- Threat model:
- Goal: The adversary pursues a harmful goal g. Equation (1) is written as (x̃t, ẽt) = Adv(xt, et, g; Ht−1), where Ht−1 is the interaction history observed so far.
- Capabilities: Perturbing xt corresponds to jailbreak, perturbing et corresponds to indirect prompt injection. Queries arrive one by one as a stream; at deployment, future queries are not visible, and there are no ground-truth harm labels.
- Victim system: A tool-using agent A interacts with environment e, with frozen weights, acting via policy πA(· | M) conditioned on external memory M. Trajectories are sequences of actions and observations.
- Success determination: An external judge J gives yt = 1 when the trajectory belongs to Tharm(g), and the round is called an attack success. It is also required that the relative loss in benign utility compared to U0 (no attack, no defense) does not exceed δ. The authors emphasize that unconditional refusal can reduce attack success rate to zero, but utility also becomes zero.
- This paper proposes: A training-free Self-Evolving Defense (SED). During a round, only read-only retrieval of policies; after the round, an external judge scores the full trajectory, distilling harmful failures into episodic memory and a hierarchical policy library for use in subsequent rounds. The policy library can also be pre-populated offline with attack trajectories.
What related research exists?
Nearest-neighbor are guardrail and memory defenses that do not update the target model, but they do not distill judged trajectories on the defended agent into a growing policy library.
Training-free and memory-based agent defenses
- Llama Guard (Inan et al., 2023; Meta AI, 2024) and guardrail agents (Xiang et al., 2025; Luo et al., 2025) — filter or compile safety checks at deployment time without updating the target model.
- CaMeL (Debenedetti et al., 2025) and DRIFT (Li et al., 2025a) — constrain tool use and isolate untrusted content from control flow.
- Memory-based guardrails (Liu et al., 2026; Wei et al., 2025) — retrieve existing safety evidence at inference time. The authors state these lines are SED's nearest neighbors, but they typically audit or retrieve fixed prototypes rather than distilling judgment trajectories on the defended agent into a growing policy library; representatives of each line are included in the evaluation.
Coevolutionary training and adaptive attacks
- Weight-updating coevolution (Liu et al., 2025a; Pan et al., 2025; Li et al., 2025b; Wen et al., 2026; Wang et al., 2026) — makes the defense non-stationary, but requires retraining whenever the attack or base model changes.
- Adaptive jailbreaks and prompt injection (Chao et al., 2023; Liu et al., 2025b; Rahman et al., 2025; Nasr et al., 2025; Zhan et al., 2025) and agent harm benchmarks (Debenedetti et al., 2024; Andriushchenko et al., 2025; Guo et al., 2024; Peng et al., 2026b) — the authors state that attackers who can observe the defense can bypass frozen rules.
Self-evolving agents
- Self-evolving agent survey (Gao et al., 2026) — distinguishes what evolves (weights, memory, tools) and when (within or between test time).
- Skill libraries and experience memory (Wang et al., 2024; Zhao et al., 2024) — improve capability outside safety without fine-tuning.
- Memory poisoning (Srivastava and He, 2025; Yang et al., 2026) — the authors state that unconstrained memory writes constitute a persistent attack surface, and poisoned experience-retrieval injections can compromise self-evolving agents across sessions.
Baseline methods and benchmarks
- Baselines: a no-defense agent, plus Llama Guard 3, SafeHarbor, DRIFT, and GuardAgent. The motivation experiment also places Llama Guard 3 and SafeHarbor on HarmBench against AutoDAN-Turbo and X-Teaming.
- Benchmarks: WildJailbreak, HarmBench, AgentDojo, AgentDyn, DTap, RedCode, FCV (measuring CWE-538 on resolved SWE-bench patches), AgentHarm.
The authors place SED on the training-free defense side: rather than updating weights, it collects judgment failures on the defended agent's own trajectories into a growable policy library, to handle both non-stationary attacks and multiple threat surfaces.
How does the paper address this problem?
After an external judge determines a trajectory is harmful, it is synthesized and organized into hierarchical policies, then retrieved and injected read-only into the frozen agent.
SED turns a judged harmful trajectory into a retrievable safety policy for the next time: memory is read-only during a round, writes occur only after the round, and weights remain frozen throughout.
Problem setup and optimization objective
- Trajectories and memory: The agent produces a trajectory τ = (a1, o1, …, aK, oK) for query x, acting via a memory-conditioned policy. The only update signal for memory M is the judge J applied to the agent's own trajectories.
- Three trajectory subspaces: Trefuse, Texec(x), Tharm(g). Equation (2) specifies: when x is a harmful query, the optimal trajectory is in Trefuse; when goal g is injected via the environment, the optimal trajectory must complete the task and not belong to Tharm(g); otherwise, it only needs to complete the task. Membership is not directly observable.
- Operationalization: The judge gives yt, and the environment-provided task verifier U(τt, xt) ∈ {0, 1} scores utility. Equation (3) minimizes the proportion of attack successes, with the constraint that utility on defined rounds is at least (1−δ)U0.
- Policy tuple: p = (n, d, σ, D, R, h), respectively name, vulnerability description, applicability scope, violation detection condition, response to take, and harm explanation recording the failure mechanism. The policy memory P is a rooted tree with these policies as nodes.
Three-step memory operations per round
- Extraction: After the round, J reads the full, role-labeled trajectory (query, actions, tool observations) as LLM-as-a-judge, marking whether it is harmful; if harmful, it returns a diagnosis m including the harm caused, failure mode, and supporting evidence snippets. Benign and refusal trajectories are not stored. The harmful round ε = (τ, m) is written to episodic memory E, then distilled by synthesizer S into atomic policies, with |C| ≤ cmax each time. In experiments, the agent and judge each make one inference call on the same base model. The judge rubric and synthesis prompts are in Appendix A.2.
- Organization: Organizer O places new policies into the tree. Parent nodes are more general rules that cover their child rules and are also executed, thus blocking variants that child rules did not foresee. Placement uses embeddings of policy names: encoder ϕ is Qwen3 Embedding, taking the k nearest nodes to the candidate. If the nearest neighbor is empty or the best similarity is below τnew, the candidate becomes a new rule directly under the root without calling an LLM. Otherwise, O.Place returns an operation, target node, and rationale: Merge merges redundant candidates into an existing node, Promote makes a more general candidate a parent, Add opens a new rule under the root; Group places the candidate into a family and generalizes a covering rule. If the parent already covers the candidate, the parent text is not rewritten to avoid perturbing the text used for retrieval.
- Retrieval: Before the round, the same encoder ranks by cosine similarity between policy text and query. Select along the ranking, skipping if a family already has c=2 selected, and stop when K=3 are filled. Each selected policy also brings its nearest covering parent, together forming the injection set Px, written into the system prompt after a fixed preamble. Placement uses name embeddings, retrieval uses text embeddings; they do not share embeddings.
Online operation and determination
- Online protocol: Each benchmark starts with empty policy memory, evolves along that benchmark's round stream, and memory is not carried across benchmarks. Writes occur only after the external judge scores the full trajectory, so one attack success can only affect subsequent rounds. There is also a frozen-memory control that stops all writes after a fixed prefix. On DTap, each defense additionally uses a pre-tool guard that can block unsafe tool calls before dispatch.
- Pre-population: SED can also be loaded with a policy library distilled from offline attack trajectories, providing protection before adaptation begins.
- Metrics: Each benchmark uses its official scorer. ASR is the proportion of harmful attempts completed by the defended agent; prompt injection additionally reports targeted ASR, the rate at which injected instructions achieve the attacker's goal. Benign work reports task utility, and injection benchmarks additionally report utility under attack.
- Process in appendix: Algorithm 1 (Appendix A.1) summarizes the end-to-end loop. Appendix A.8.1 gives learned hierarchies, and Appendix A.9's case study traces how a single failure becomes a policy. Appendix A.11 classifies residual successes into retrieval misses, policies injected but harmful actions still executed, and behavior changes insufficient to flip the external scorer.
What experiments did the paper conduct?
Across three open-source models and eight benchmarks, SED reduces static and adaptive ASR while largely preserving benign utility.
Experimental Setup
- Target models: DeepSeek-V4-Flash, GLM-5.2, Kimi K3. Each external baseline uses its official released artifacts and calibration procedure. Hyperparameters are in Table 6, implementation details in Appendix A.3; the specific values in Table 6 are not fully listed in the provided text.
- Benchmarks: WildJailbreak and HarmBench (including precomputed adversarial prompts) for the dialogue side. AgentDojo, AgentDyn, and DTap's CRM, workflow, and code agents for the tool side. RedCode (risky code execution), FCV (CWE-538 in resolved SWE-bench patches), AgentHarm (multi-step misuse compliance) for the coding side. Adaptive attacks are AutoDAN-Turbo and X-Teaming, which query the deployed defense on HarmBench and rewrite prompts based on responses, with a fixed query budget per behavior; the specific budget numbers are not given in the main text of the paper.
- Baselines: No defense, as well as Llama Guard 3 (input-side safety classifier), SafeHarbor (memory-augmented risk-tree guardrail), DRIFT (dynamic validation isolating injected instructions), GuardAgent (standalone guard model monitoring behavior; run in the paper with the same base model as the agent).
- Protocol and metrics: Online evolution, starting with empty memory, no memory carried across benchmarks. ASR and targeted ASR are lower-is-better; benign utility, attacked utility, and SWE-bench resolve rate are higher-is-better. Scoring uses each benchmark's official scorer (Appendix A.5). DTap additionally has pre-tool blocking.
- Review: The agent and the reviewer reason separately on the same base model. The colors in Figure 4 correspond to reviewer scores, from 1 (safe) to 5 (jailbroken); the attack stops once a score of 5 is first reached. The paper does not report agreement with human scoring, nor does it report the number of repetitions.
- Omission note: Table 1 only reports DeepSeek-V4-Flash. The authors state that on these static benchmarks, GLM-5.2 and Kimi K3 have no-defense ASR already near the floor, making it hard to distinguish defenses, so the three-model comparison is placed in Table 2 and Table 3.
Main Results
Static attacks and utility on DeepSeek-V4-Flash (per Table 1):
Swipe horizontally to read the table
Setting WJB HBdir HBadv RC AgH FCV ADojo ADyn ADojo attacked utility SWE-bench resolve No defense 31.40 25.94 25.55 95.60 42.60 19.17 49.00 33.04 44.36 62.60 Llama Guard 3 29.31 2.81 8.16 89.12 3.00 20.43 49.32 29.11 42.36 55.80 SafeHarbor 17.55 15.00 9.64 49.28 1.59 5.71 11.90 10.18 78.19 56.00 DRIFT 23.90 24.06 16.64 91.12 31.06 1.48 3.69 2.14 76.08 67.60 GuardAgent 35.65 23.44 18.16 82.40 18.34 6.19 12.60 9.82 58.90 38.80 SED 2.10 0.94 3.07 11.30 6.20 2.91 0.42 0.54 87.88 68.80 The first eight columns in the table are attack success rates (%), and the last two are higher-is-better. WJB is WildJailbreak, HB is HarmBench, RC is RedCode, AgH is AgentHarm, FCV is the CWE-538 rate in resolved patches, ADojo is AgentDojo, ADyn is AgentDyn. The benign utility columns are not all included in the table above: on AgentHarm, no defense is 67.30 and SED is 63.10; on AgentDojo, benign utility is 89.69 for both no defense and SED; on AgentDyn, benign utility is 73.33 for both, and attacked utility goes from 49.11 to 69.29.
- Authors' reading of Table 1: SED leads in six of the eight attack columns, with RedCode going from 95.6% to 11.3%, which the authors describe as a relative drop of 88%; it is close behind in the remaining two columns. Llama Guard 3 brings HarmBench direct requests down to 2.81%, DRIFT brings AgentDojo down to 3.69%, and SafeHarbor brings AgentHarm down to 1.59%, but all three still have RedCode at 49% or above. On FCV, DRIFT is 1.48%, lower than SED's 2.91%; on AgentHarm, SafeHarbor and Llama Guard 3 also have lower ASR than SED.
- Utility: The authors state that SED does not change the clean task success rate on AgentDojo (89.69 in the table for both), and attacked utility goes from 44.4% to 87.9%; the SWE-bench resolve rate is the highest among defenses, 6.2 percentage points above no defense (62.60 to 68.80). The authors attribute GuardAgent's weaker balance to over-defense: clean utility drops 16.5 percentage points, and AgentDojo ASR only falls to 12.6%. SED's only benign utility drop is a 4.2 percentage point decrease in AgentHarm accuracy (67.30 to 63.10).
- Adaptive (Table 3): Under a fixed query budget, on no-defense DeepSeek-V4-Flash, AutoDAN-Turbo and X-Teaming are 98.00% and 50.00%, while SED is 17.82% and 7.81%. The authors describe this as a relative drop of 82–84%, and more than four times lower than the best static defense on each attack. In the same table, the best static defense against X-Teaming is SafeHarbor at 35.21%, and the best static defense against AutoDAN-Turbo is DRIFT at 79.70%. On GLM-5.2, SED is 7.10% and 8.50%; on Kimi K3, it is 10.43% and 10.51%; the authors state that static defenses are near the no-defense level, while SED pushes both attacks to about 10% or below. The static defense numbers in the motivation experiment, Figure 2, are of the same magnitude as Table 3: under AutoDAN-Turbo, no defense is 98%, Llama Guard 3 is 97.9%, SafeHarbor is 93.4%; under X-Teaming, they are 50%, 39.9%, and 35.2%.
Prompt Injection (DTap)
- What was tested: Table 2 distinguishes indirect injection (a third party placing instructions into content the agent reads) from direct malicious users across the CRM, workflow, and code domains, and reports benign utility. Memory is learned in place in each domain, with no predefined taxonomy per domain.
- DeepSeek-V4-Flash: No-defense indirect ASR is 86.67 for CRM, 78.85 for workflow, and 89.70 for code; SED is 21.48, 19.23, and 26.06. Direct ASR goes from 96.67, 83.12, and 95.04 to 22.47, 31.17, and 23.97. CRM benign utility goes from 87.12 to 86.59. The authors state that indirect success rates drop from above 78% to about 26% or below, with each domain dropping at least 52 percentage points.
- The other two models and exceptions: On GLM-5.2's code domain, SED's indirect/direct ASR is 3.66 / 2.50, and on Kimi K3 it is 2.28 / 4.39. The authors state that in the code domain, DRIFT and GuardAgent largely block indirect attackers, but direct attackers remain above 90% (on DeepSeek-V4-Flash, DRIFT direct is 90.91 and GuardAgent direct is 92.56), while SED brings both roles down to about 25%. SafeHarbor's benign utility on DeepSeek-V4-Flash's CRM is 39.39, versus 87.12 for no defense, which the authors describe as a drop of nearly 48 percentage points. On Kimi K3's workflow benign utility, SED is 88.18, lower than no defense's 89.22 and also lower than Llama Guard 3's 93.67.
Memory Ablation and Frozen Control
- Component accumulation (Table 4, DeepSeek-V4-Flash, matched query budget): Without memory, AutoDAN-Turbo / X-Teaming / RedCode are 98.00 / 50.00 / 95.60; adding episodic recall gives 42.27 / 19.69 / 25.60; adding policy synthesis gives 28.12 / 14.00 / 13.70; adding hierarchical organization (full SED) gives 17.82 / 7.81 / 11.30. The authors argue that synthesis and organization map multiple attack episodes into one policy and merge related policies under shared parent nodes, and that the benefit runs in the opposite direction from "longer system prompts."
- Using the same model as reviewer does not alone explain the gains: GuardAgent also uses the same base model as the agent, and under adaptive attacks on DeepSeek-V4-Flash it is 87.80% and 47.40%, while SED is 17.8% and 7.8%. The authors therefore read SED's results as coming from reading the full trajectory and accumulating policies, not merely from using that model for safety judgments.
- Policy transfer and evolution on benign tasks (Table 5 and main text): A library learned on the harmful split is frozen and injected read-only into a disjoint benign split. On WildJailbreak, injecting all 40 policies into all 250 benign prompts moves non-refusal from 97.6 to 96.0. On AgentHarm, 14 policies synthesized from 11 harmful episodes move benign utility from 66.90% to 64.68%, and over-refusal from 0% to 5.1%. The authors state that transfer loses at most 2.2 percentage points. If the same library continues evolving on the benign stream, AgentHarm benign utility is 63.1%, lower than the 64.7% when frozen. The authors' example is that some benign tasks reach a legitimate goal through steps that are themselves harmful, the reviewer judges them harmful, and the subsequently synthesized policy blocks similar benign runs.
Other Ablations and Analyses
- Figure 3: On a GLM-5.2 agent, DeepSeek-V4-Flash attacker, and HarmBench's X-Teaming, memory is frozen after the first 100 behaviors; cumulative attack success goes from 23.4% with no defense to 13.4% when frozen (the authors say 43% removed), and to 9.4% with continued evolution (the authors say the reduction grows to 60%). The authors note these are cumulative rates on a single stream, higher than the per-run rates in Table 3.
- Figure 4: A single 100-behavior stream of AutoDAN-Turbo against DeepSeek-V4-Flash. No defense is jailbroken 98/100, with a median of 3 and mean of 4.1 iterations; Llama Guard 3 and SafeHarbor are bypassed on 100/100 and 93/100, with medians of 4 and means of 5.7 and 7.9. SED is 10/100, with surviving jailbreaks having a median of 11.5 and mean of 10.9. The authors state that the earliest behaviors are jailbroken while memory is still empty, after which synthesized policies keep the rest of the stream nearly safe, with a small number of later isolated successes. The authors state that SED blocks 90% of jailbreaks and raises the query cost of the rest; that 90% corresponds to 10/100 on this stream, not the same statistic as Table 3's overall 17.82%.
- Residual failures (Appendix A.11): Retrieval misses (common for new surface forms), execution misses (the policy is injected but the harmful action is still completed), and reviewer–policy mismatch (behavior changes are insufficient to flip the external scorer; the authors say this is common on FCV, where similar patches receive different CWE-538 judgments). The appendix gives example residual trajectories, including cases judged as attack success after a nominal refusal.
- Utility observations in the ethics section: The authors state that injected policies and tool-level blocking may cause over-refusal of benign requests, and that evolving policy memory may accumulate overly strict rules; the external reviewer and synthesizer add inference-time computation beyond the base agent, which the authors describe as small relative to the agent's own tool use, but nonzero.
What are some points that can be further explored?
The authors note that new attacks may be under-covered, and they did not study how changing or improving the judge model would affect SED.
Limitations and future directions noted by the authors
- Coverage of new samples: The Limitations state that SED may still perform poorly on new attack samples that differ greatly from previous failures, because policies distilled from past trajectories may not cover them sufficiently to be reliably retrieved or applied.
- Judge model: The Limitations state that using the target model itself as judge has yielded what the authors call strong empirical performance, but they did not examine how better or more specialized judge models would affect SED's robustness. How to select, train, or otherwise improve the judge is listed by the authors as a direction to further strengthen SED.
- Not a safety guarantee: The Ethical Considerations state that SED reduces but does not eliminate attack success, should not be treated as a safety guarantee, and cannot replace human supervision in high-risk deployments.
- Utility and overly strict rules: The same section states that injected policies and tool-level blocking may cause excessive refusal of benign requests, and the evolving policy memory may accumulate overly strict rules; the authors state that this trade-off has been quantified in the evaluation and discussed in the Limitations.
- Additional computation: The same section states that the external judge and synthesizer add inference-time computation beyond the base agent.
- Dual use: The same section states that describing where existing defenses fail still carries dual-use risk, because the same failure analysis may inform attackers; the authors judge that this risk is outweighed by the value of a training-free defense applicable to frozen models. This section also states that all attacks come from published work and public benchmarks, and the authors claim no new attack techniques are introduced.
Experimental coverage
- Models and benchmarks: Defense evaluation covers three target models—DeepSeek-V4-Flash, GLM-5.2, Kimi K3—and WildJailbreak, HarmBench, RedCode, AgentHarm, FCV/SWE-bench, AgentDojo, AgentDyn, DTap, and adaptive AutoDAN-Turbo, X-Teaming. Table 1's static full table only reports DeepSeek-V4-Flash; the authors state that the other two models have no-defense ASR already near the floor on these static benchmarks.
- Online memory: Each benchmark starts with empty policy memory, evolves along that benchmark's round stream, and memory is not carried across benchmarks; writes occur after the external judge scores the full trajectory. There is also a frozen-memory control that stops all writes after a fixed prefix, and a learned library on the harmful split is transferred read-only to a disjoint benign split.
- Baseline defenses: Llama Guard 3, SafeHarbor, DRIFT, GuardAgent, all run with their official artifacts and calibration procedures. On DTap, each defense additionally uses a pre-tool guard that can block before dispatch. GuardAgent uses the same base model as the agent.
- Components and adaptive budget: Table 4 on DeepSeek-V4-Flash accumulates episodic recall, policy synthesis, and hierarchical organization item by item, using a matched query budget. The adaptive attacker only modifies queries, targets the deployed defense, and has a fixed query budget per behavior; the paper does not give the specific number of this budget in the main text. The attacker in Figure 3 is DeepSeek-V4-Flash, the target is GLM-5.2; the iteration statistics in Figure 4 come from a single stream of 100 behaviors.
- Unreported items: The paper does not report judge-human agreement, number of experimental repetitions, or the specific values of Table 6 hyperparameters in the given main text. The judge and agent are called separately on the same base model in experiments; the authors state in §4.3.1 that a stronger judge may further improve the pipeline's performance, but the Limitations state that this was not tested.
Summarize the main content of the paper
SED uses an external judge to collect harmful trajectories into retrievable policies, reducing ASR on three models while maintaining most benign utility.
Self-Evolving Defense (SED) is a training-free defense for frozen-weight LLM agents: it distills harmful trajectories judged by an external judge into retrievable, hierarchical safety policies, allowing the defense to update with the attack stream rather than relying on retraining or fixed rules.
- Problem: Agents call tools, modify repositories, and retain cross-session memory, with failure surfaces including jailbreaks, prompt injection, and unsafe code. The authors argue that existing defenses either require training, remain static after attacker adaptation, or guard only one interface; memory-based guardrails also do not collect the defended agent's own harmful trajectories into policies.
- Approach: During a round, retrieve up to K=3 policies by query text, with at most c=2 per family, and include covering parent rules, injected read-only into the system prompt. After the round, a judge on the same base model reads the full trajectory; only harmful rounds enter episodic memory, then detection conditions and responses are synthesized, and an organizer uses Qwen3 Embedding to Merge, Promote, Add, or Group. At deployment, there are no future queries and no ground-truth harm labels; the optimization objective is to reduce attack success while limiting loss in utility relative to no defense.
- Static results: On DeepSeek-V4-Flash, AgentDojo targeted ASR from 49.00% to 0.42%, AgentDyn from 33.04% to 0.54%, RedCode from 95.60% to 11.30%, resolved-patch CWE-538 rate from 19.17% to 2.91%, SWE-bench resolve rate from 62.60% to 68.80% (Table 1). AgentDojo clean utility remains 89.69, attacked utility from 44.36% to 87.88%. AgentHarm benign utility from 67.30% to 63.10%, the only benign decline the authors note. On FCV, DRIFT's 1.48% is lower than SED.
- Adaptive and injection: On the same model, X-Teaming from 50.00% to 7.81%, AutoDAN-Turbo from 98.00% to 17.82% (Table 3); on GLM-5.2 and Kimi K3, SED keeps both attacks between 7.10% and 10.51%. On DTap, SED reduces both indirect and direct injection; DeepSeek-V4-Flash CRM indirect ASR from 86.67% to 21.48%, benign utility from 87.12 to 86.59 (Table 2).
- Is memory necessary: In Table 4, the three memory components successively reduce the three ASR curves. In Figure 3, freezing the library after the first 100 behaviors already reduces cumulative X-Teaming success from 23.4% to 13.4%, and continuing to evolve reaches 9.4%. Policies learned on the harmful split transfer to the benign split with at most 2.2 percentage points utility loss (Table 5).
- Authors' conclusion: These results lead the authors to believe that failure-driven policy learning is a practical path for adaptive agent defense. The authors also state that new attacks differing greatly from historical failures may be under-covered, the impact of changing the judge model has not been tested, and SED reduces but does not eliminate attack success and should not replace human supervision in high-risk scenarios.