Recomposed Distributed Risk (ReDiR): trajectory-conditioned action generation for multi-turn agent safetyReassembling Distributed Risk: Trajectory-Conditioned Action Generation for Multi-Turn Agent Safety
The authors propose the generation-time defense ReDiR, which on MT-AgentRisk reduces the ASR of three models to 0.0%–7.9% and can transfer to eight unseen tool domains.
The attacker is a malicious or compromised requester who controls the sequence of user inputs in a multi-turn interaction, with the goal of spreading a harmful goal across multiple turns to induce the agent to perform operations that violate the deployment policy; the attacker knows the available tools and can observe normal interactions, but cannot modify the model, runtime, tool implementations, credentials, or defense mechanisms. The defender is the deployer, who has white-box access to the base model and can see the trajectory prefix before action generation.
- Multi-turn decomposition attacks spread a harmful goal across multiple plausible requests and tool calls, and the risk can only be identified from the complete trajectory. The authors argue that existing defenses separate trajectory reasoning from action generation and rely on runtime-specific action representations or additional online checks.
- Before each action generation, ReDiR compresses the current trajectory into K latent safety representations and injects them into the frozen base model. The safety encoder shares its backbone with the base model and is trained with LoRA; supervision comes from safe termination goals generated and audited by the same model under a collapsed view in which the task goal is explicit, together with selective correction and benign behavior preservation.
- On MT-AgentRisk, ReDiR reduces the overall ASR of Qwen3.5-9B, Ministral-3-8B, and Gemma-4-E4B to 5.5%, 0.0%, and 7.9%, respectively; supervision from the Filesystem domain alone transfers to eight unseen tool domains, with a benign-task FPR of 0.0%. On AgentDojo, ASR is higher than MAGE, but benign utility is higher.
- In the ethical statement, the authors state that ReDiR is an empirical defense that may miss unseen attacks, interrupt benign tasks, or encourage adaptive bypass. The experiments used only 55 Filesystem tasks for supervision, and the final safety training set was 36 samples; the adaptive attack evaluation covered only one benign history dilution attack and 30 harmful tasks.
- Evaluated models
- Qwen3.5-9BMinistral-3-8B-InstructGemma-4-E4B
- Benchmarks
- MT-AgentRiskAgentDojo
- Metrics
- ASRSSRFPRBenign utilityMean Action latencyMean E2E latencyGPU memoryGPU-hours
The researchers propose a generation-stage defense method, ReDiR, which reduces the attack success rate on tool-using large language model agents to below 8% on two agent safety benchmarks. Multi-turn decomposition attacks spread a harmful goal across multiple individually plausible requests and tool calls, and the intent is visible only from the cumulative trajectory; existing defenses either rely on additional online reasoning to recover long-range safety evidence or evaluate actions after generation, incurring extra inference cost or depending on runtime-specific action representations. Before each action generation, ReDiR compresses the current trajectory into a compact latent safety representation and injects it into a frozen base model; through same-model cross-view supervision training, it supervises the model to recover distributed safety evidence from the raw multi-turn trajectory under an explicit task view, without a separate action-level safety module. The method covers three model families and eight held-out tool domains, transfers to unseen tool domains, and has low computational overhead while maintaining benign task fidelity.
Paper analysis
What problem does this paper attempt to solve?
Defending against multi-turn decomposition attacks: injecting trajectory-level safety evidence directly into a frozen base model before action generation.
Core problem: under multi-turn decomposition attacks, a harmful goal is spread across multiple individually plausible requests and tool calls and can only be identified from the accumulated trajectory—how to stop it before the next action is generated.
- Problem setting and importance: Tool-using LLM agents turn model outputs into actions that modify the state of external systems, and once an action is dispatched it may be difficult to reverse. The authors point out that a safe text reply does not guarantee safe execution: a model may output a refusal message while still issuing a policy-violating tool call.
- Shortcomings of existing methods (as stated in the paper): Runtime guardrails check after action generation, must parse runtime-specific action representations that vary with tools and frameworks, and require targeted adaptation when transferred; the generate-then-check paradigm also adds an online safety step after action generation. Trajectory-aware methods such as MAGE and TRACE separate trajectory reasoning from action generation, relying on external memory managers, online review, or producing only auxiliary risk judgments.
- Core observation: The authors cite prior work as showing that even when model behavior is unsafe, harmful semantics can still be detected in its hidden states; internal representations can encode behavior-related concepts and be used to guide subsequent generation. This motivates the authors to compress the risk evidence distributed across a multi-turn trajectory into a compact latent representation and inject it before the next action generation.
- Method proposed in the paper: ReDiR (Reassembling Distributed Risk), a generation-time defense: before each action, the current trajectory prefix is compressed into a latent safety representation and injected into the frozen base model; the representation is learned through same-model, cross-view supervision—using the base model's own safe behavior under a collapsed view in which the task goal is explicit as supervision, to train a safety encoder to recover the safety signal from the original multi-turn trajectory.
- Threat model (§3.1):
- Attacker goal: Induce the agent to perform operations that violate the deployment policy or exceed the requester's authorization, where the harmful goal can be spread across multiple turns and each individual request appears benign.
- Attacker knowledge and capabilities: A malicious or compromised requester who controls the sequence of user inputs in a multi-turn interaction; knows the available tools and can observe normal interactions; cannot modify the underlying model, agent runtime, tool implementations, credentials, or defense mechanisms.
- Victim system: Mainstream LLM agent implementations, with the agent as the primary interface between the user and underlying systems (file systems, databases, network services).
- Defender capabilities: The deployer controls the base model and safety mechanisms and has white-box access to the base model; the trajectory prefix is visible before action generation, but future observations are not.
What related research exists?
Related work falls into four categories: tool-use safety, runtime guardrails, multi-turn trajectory defense, and representation-level control.
Tool-use agent safety
- AgentDojo [9], ASB [52], etc.: The works cited by the authors point out that malicious instructions can come from users or retrieved content and affect subsequent tool use, potentially leading to unauthorized operations or information leakage.
- Cartagena and Teixeira [5]: The authors cite their finding that a safe text reply does not guarantee safe execution; a model may refuse in text yet still issue a policy-violating tool call.
- Training-time and system-level methods: AgentAlign [53] and SafeAgent [58] adapt models through safety fine-tuning; system-level mechanisms such as IsolateGPT [45] and Progent [32] enforce isolation, information-flow constraints, or explicit execution policies. The paper notes that these two classes respectively rely on modifying the target policy or maintaining additional architecture and policy mechanisms.
Runtime guardrails (generate-then-check)
- ToolSafe [25]: Evaluates generated tool calls and blocks unsafe calls before dispatch.
- ShieldAgent [6], AGrail [23], GuardAgent [46]: Perform safety checks after action generation. The paper notes that such defenses work after action generation, must parse runtime-specific action representations, and introduce additional online safety decisions; agent-based, verifier-based, or re-execution approaches bring additional inference or execution overhead.
Multi-turn agent safety and trajectory-aware defenses
- Crescendo [30], STAC [17], MT-AgentRisk [19]: Progressive jailbreaks demonstrate cross-turn risk accumulation in dialogue; research on tool-using agents points out that safety failures can arise from action sequences rather than a single step.
- MAGE [42]: Maintains a safety-oriented shadow memory to evaluate pending actions. The paper notes that it relies on an external memory manager and online review during execution.
- TRACE [12]: Compresses long trajectories into latent representations to reduce the cost of autoregressive trajectory summarization. The paper notes that it produces auxiliary risk judgments rather than directly controlling the agent's next action.
Representation-level safety control
- JBShield [54]: Identifies and manipulates representations associated with harmful concepts to defend against jailbreaks.
- Representation engineering [60], gist tokens [26], MemGen [51], etc.: The authors cite these works as showing that internal representations can encode behavior-related concepts and compact contextual information and can be used to guide generation.
Baselines and benchmarks: The baselines compared in the experiments are the unmodified agent (Base), ToolShield [19], and MAGE [42]; the evaluation benchmarks are MT-AgentRisk [19] and AgentDojo [9].
The authors position this paper as: connecting trajectory-level safety evidence directly to action generation through the base model's own representation space, relying neither on runtime-specific post-generation guardrails nor on additional online review components; Table 1 compares the above representative defenses on four requirements: Effectiveness, Transferability, Fidelity, and Efficiency.
How does the paper address this problem?
ReDiR's three stages: offline construction of same-model cross-view safety supervision, training of a trajectory-conditioned safety encoder, and injection of latent representations at deployment to guide actions.
Overall approach: ReDiR compresses the safety evidence in a multi-turn trajectory into a fixed-size latent representation, which is injected into a frozen base model before each action generation, so that the accumulated evidence directly shapes the next action. The method has three stages, corresponding to what the authors call three gaps: safe action supervision, trajectory-conditioned learning, and action-level control (Figure 2).
Offline action supervision construction (§4.1)
- Trajectory prefix collection: Starting from the canonical adversarial tasks in MT-AgentRisk, the harmful goal is decomposed into multiple turns of seemingly benign requests, and the base agent executes them to obtain complete trajectories; the prefix ending with the specified final-turn user input, before the model has generated a reply, is taken. Prefixes in which an earlier action has already achieved the harmful outcome are discarded.
- Same-model cross-view goal generation: For each task, a collapsed view vi = Collapse(di; Ii, Ti) is constructed, i.e., the canonical task description is concatenated with the system instructions and tool specifications so that the underlying goal is explicit; under this view, M candidate action goals are sampled from the base model. The authors state that using the base model itself to generate candidates is intended to align the supervision with its native generation behavior.
- Goal auditing and supervision routing: Candidates that are safe, executable, and end the harmful goal with a protocol-legal termination action are retained; a safe refusal must be expressed as a protocol-legal termination action rather than an abstract label. The base model is then used to generate the student-view output on the original prefix, and routing is by difference: if already safe, no correction (NONE); if the safety decision is correct but the termination action is illegal, only the termination part is supervised (TERMINATE); otherwise the full goal is supervised (FULL).
Trajectory-conditioned safety training (§4.2)
- Encoder structure: The safety encoder shares its backbone with the base model and is adapted with LoRA (rank 16, α = 32, only the last four attention blocks); K = 8 learnable latent queries are introduced, initialized with the mean of the word embeddings of a small set of safety-related seed words. The encoder jointly processes the trajectory prefix and the latent queries, and the final hidden state at the latent query positions is taken as the trajectory-level representation.
- Latent representation normalization and injection: Each latent state is scaled to the typical magnitude of the base model's word embeddings (the median of the vocabulary embedding magnitudes) and then appended after the trajectory prefix embeddings to condition base model generation.
- Action-grounded safety objective: Lsafe is optimized only at the token positions selected by routing, i.e., a weighted token-level cross-entropy; the first E = 16 tokens of the target reasoning are weighted wE = 4, and the tokens that determine the executable action (the native refusal action and the FINISH action name) are weighted wD = 4.
- Benign behavior preservation: A benign set is introduced, and the output distribution of the latent-conditioned model is KL-regularized toward the original base model distribution, with the total objective minϕ Lsafe + λB Lret, λB = 3; during training only the LoRA parameters and latent queries are updated, and the base model is frozen.
Latent-representation-guided action generation (§4.3)
- Online procedure: At deployment, for each action step the safety LoRA adapter encodes the current trajectory prefix once to obtain the latent representation; the adapter is then disabled and the same frozen backbone is reused to generate the action; only one copy of the base model is kept in memory. Each action adds one safety encoder forward pass.
- Continuous updating: The observation after action execution and subsequent user inputs are merged into the trajectory, and re-encoding occurs before the next action, so that the safety representation tracks the accumulated evidence. The latent representation is not output as visible tokens and is not written into the interaction history.
Training data construction (Appendix A)
- Scale: 55 Filesystem source tasks (15 held out); 78 final-turn states (43 tasks) were collected, leaving 76 after prefix auditing; 8 candidates were sampled per task for 440 in total, and after deterministic structural filtering and semantic auditing, 52 audited goals (28 tasks) were obtained.
- Auditing method: Structural filtering retains only candidates that contain a legal FINISH action and no other actions; semantic auditing has GPT-4.1-mini label candidates against a rubric at temperature 0, accepting only candidates with VALID - REFUSAL and confidence of at least 0.8, keeping at most 3 per task.
- Final optimization set: After state–goal pairing and routing, one correction goal is kept per state according to the base model's log probability at the decision position, yielding 36 safety samples (34 FULL, 2 TERMINATE), plus 20 benign-preservation samples, for 56 optimization samples in total.
What experiments did the paper conduct?
Two benchmarks, three model families: on MT-AgentRisk, ASR drops to 0.0%–7.9%, transfers to eight unseen tool domains, and benign FPR is 0.0%.
Experimental setup
- Models tested: Qwen3.5-9B, Ministral-3-8B-Instruct and Gemma-4-E4B, all deployed as tool-using agents; by default the policy model and the safety encoder share the same backbone.
- Benchmarks: MT-AgentRisk (365 harmful tasks, two transformation formats Addition/Decomposition × two risk carriers Data Files/Environment States, eight subclasses in total; 55 Filesystem tasks used for supervision, 15 held out for in-domain evaluation, and 295 tasks in the remaining eight domains used for cross-tool transfer); AgentDojo (indirect prompt injection, as an out-of-distribution evaluation).
- Agent frameworks: MT-AgentRisk uses OpenHands, with the FINISH action as safe termination; AgentDojo uses its native agent pipeline.
- Baselines: unmodified agent (Base), ToolShield, MAGE (auxiliary policy model instantiated with Qwen3.5-4B); adaptation of all defenses is restricted to the same set of 55 Filesystem tasks.
- Metrics: ASR (the proportion of harmful goals ultimately completed through multi-turn interaction; subsequent refusals after the goal is achieved do not change the judgment), SSR (the proportion of cases where a legitimate safe termination action is taken before the harmful goal is achieved; the authors note that ASR and SSR are mutually exclusive but not exhaustive, and SSR is not equal to 1 − ASR), benign FPR (the proportion of tasks in which a benign trajectory contains at least one unnecessary refusal); AgentDojo reports its official ASR and benign utility.
- Sample sizes: benign FPR is measured on 50 benign tasks (four domains, N = 20/10/10/10, Table 4); design ablations and hyperparameter analysis use 10 benign + 10 harmful tasks per domain (Filesystem, Terminal, PostgreSQL); the paper does not report the number of repetitions.
Main results
According to Table 2 (MT-AgentRisk: Strict ASR ↓ / SSR ↑, %; AgentDojo: ASR ↓ / benign utility ↑, %):
Swipe horizontally to read the table
Model Setting Base MAGE ToolShield ReDiR Qwen3.5-9B MT-AgentRisk all 62.2 / 35.9 29.4 / 68.1 54.7 / 43.7 5.5 / 90.7 Ministral-3-8B MT-AgentRisk all 48.2 / 34.0 20.3 / 71.5 31.5 / 53.4 0.0 / 98.6 Gemma-4-E4B MT-AgentRisk all 65.8 / 28.8 34.2 / 62.5 50.7 / 46.6 7.9 / 82.7 Qwen3.5-9B AgentDojo 20.7 / 83.5 1.2 / 69.1 15.5 / 80.4 13.1 / 88.7 Ministral-3-8B AgentDojo 17.1 / 56.7 1.1 / 48.5 13.7 / 41.2 11.8 / 54.5 Gemma-4-E4B AgentDojo 4.1 / 27.8 0.5 / 20.6 4.7 / 29.9 3.5 / 26.7 - The authors state that ReDiR achieves the lowest ASR on all combinations of the two transformation formats and the two risk carriers, and that the effect is not tied to a particular model family.
- Exception (AgentDojo): MAGE has lower ASR than ReDiR on all three models, but benign utility drops more; ReDiR has what the authors call the second-lowest ASR while better preserving benign utility.
RQ2: Cross-tool transfer (Table 3)
- What was measured: All defenses are adapted using only 55 Filesystem tasks and evaluated directly on eight held-out domains (Notion, Terminal, Postgres, GitLab, OwnCloud, Reddit, Shopping, Shopping Admin) without target-domain adaptation.
- Results: Across the eight held-out domains combined (295 tasks), overall ASR is 41.0%–63.4% for Base, 15.9%–33.6% for MAGE, and 0.0%–6.8% for ReDiR (SSR 85.8%–98.3%); Ministral-3-8B has ASR of 0.0% on all eight domains.
- Authors' interpretation: The authors state that safety behavior learned from a single source domain transfers to unseen tool domains without target-domain adaptation; the largest difference between overall ASR on held-out domains and performance on the Filesystem source domain is 6.1 percentage points.
RQ3: Benign behavior preservation (Table 4)
- What was measured: task-level FPR on 50 benign tasks across four tool domains.
- Results: ReDiR has FPR of 0.0% on all four domains, the same as Base and ToolShield; MAGE has FPR of 30.0% on PostgreSQL (n=10) and 20.0% on Terminal (n=10).
- Authors' interpretation: The authors state that ReDiR's safety gains do not come from making the agent uniformly more conservative, and that trajectory-level safety signals do not introduce unnecessary refusals when transferred across domains.
RQ4: Online efficiency (Tables 5–7)
- GPU memory: ReDiR requires 1.328–3.250 MiB of extra GPU memory (three models); MAGE requires 8,417.280 MiB because it uses a separate Qwen3.5-4B (Table 5).
- Latency: Taking Qwen3.5-9B as an example, mean per-action latency is 10.21 s for Base and 12.71 s for ReDiR; mean end-to-end latency on harmful tasks is 50.6 s for ReDiR, lower than 99.8 s for Base, 83.7 s for MAGE and 82.5 s for ToolShield (Table 6). The authors state that ReDiR reduces end-to-end latency on harmful tasks by an average of 53.3% across the three models, because once sufficient evidence has accumulated it guides the model to terminate safely early; on Gemma-4-E4B, ReDiR (170.7 s) is still lower than Base (217.4 s) but higher than MAGE (137.0 s) and ToolShield (162.2 s).
- Offline cost: ReDiR 38.14 GPU hours, MAGE 60.55, ToolShield 1.88 (Table 7, Qwen3.5-9B setting); the authors note that ToolShield's experience generation must be repeated when new tools are introduced.
Design ablations (§6.5, Qwen3.5-9B, 10 benign + 10 harmful per domain)
- Encoder backbone (Table 8): A backbone-matched 9B encoder (K = 8) achieves ASR and FPR of 0.0% on all three domains; substituting Qwen3.5-4B with the same K gives overall ASR of 16.7% and FPR of 5.0%; the 4B encoder at K = 32 gives overall ASR of 3.3% and FPR of 5.0%, and at K = 16 FPR reaches 45.0%. The authors state that backbone matching makes compact latent representations more effective, and that increasing K only partially compensates for backbone mismatch.
- Target-generation teacher (Table 9): Same-model teacher gives overall ASR of 0.0%, Qwen3.5-27B 3.3%, DeepSeek-V4-Flash 13.3%, and Kimi-K2.5 36.7%; FPR is 0.0% in all settings. The authors argue that compatibility between the targets and the base model matters more than simply increasing teacher capability.
- Teacher SSR for learning and generation (Table 10): In free-generation evaluation, overall SSR is 94.64% for the same-model teacher, 81.55% for Qwen3.5-27B, 75.00% for DeepSeek-V4-Flash, and 60.71% for Kimi-K2.5.
Other ablations and analyses
- Number of latent queries K (Table 11): Overall ASR is 20.0% at K = 1 and 2, 3.3% at K = 4, and 0.0% at K = 8 and 16; FPR is 0.0% in all cases; the default is K = 8.
- Entry token weighting (Table 12): Overall ASR is 43.3% at 8 × 4, 33.3% at 16 × 1, 0.0% at 16 × 4, and 3.3% at 32 × 4; the default is 16 × 4.
- Decision token weighting (Table 13): Overall ASR is 20.0% at ×1, 6.7% at ×2 (FPR 5.0%), 0.0% at ×4, and rises back to 10.0% at ×8; the default is ×4.
- Adaptive attack (§7, Table 14): The benign history dilution attack inserts N ∈ {0,1,2,4,8} read-only benign requests before the harmful request in the final turn, with 30 harmful tasks and Qwen3.5-9B; overall ASR is between 6.7% and 10.0%, SSR is 86.7%–90.0%, and it does not systematically rise as N increases. The authors state that the additional benign context does not persistently dilute the safety evidence captured by ReDiR.
What are some points that can be further explored?
In the ethics statement, the authors acknowledge the residual risk of empirical defenses; the experiments cover three models, two benchmarks, and one adaptive attack.
Limitations and future directions noted by the authors
- Residual risk of an empirical defense (Ethical Considerations): The authors state that ReDiR remains an empirical defense that may miss unseen attacks, interrupt benign tasks, or encourage adaptive bypass, and should be used together with least privilege, sandboxing and execution monitoring.
- Dual-use risk and release controls (Ethical Considerations): The authors state that their attack transformations and defense-aware evaluation could be used for dual purposes, so unnecessary operational details are omitted, released artifacts undergo security review, and evaluation metadata is separated from directly executable harmful templates.
- Future research involving users or production logs (Ethical Considerations): The authors state that future research involving users or production logs should undergo appropriate institutional and privacy review.
- The paper has no separate Limitations section; the above are the shortcomings and future directions the authors explicitly state.
Experimental coverage
- Models tested: Qwen3.5-9B, Ministral-3-8B-Instruct and Gemma-4-E4B, three in total; MAGE's auxiliary policy model is instantiated with Qwen3.5-4B (§5).
- Benchmarks and supervision sources: MT-AgentRisk (365 harmful tasks) and AgentDojo; adaptation of all defenses uses only 55 Filesystem tasks, and ReDiR's final safety training set is 36 samples plus 20 benign-preservation samples (Appendix A).
- Benign evaluation scale: benign FPR is measured on 50 tasks across four domains, with three domains at n=10 each (Table 4); design ablations and hyperparameter analysis use 10 benign + 10 harmful tasks per domain (§6.5).
- Adaptive attack evaluation: covers only one adaptive attack, benign history dilution, with N ∈ {0,1,2,4,8}, 30 harmful tasks, and only Qwen3.5-9B (§7).
- Information not reported: the paper does not report the number of experimental repetitions or statistical significance tests; the AgentDojo evaluation does not state the number of tasks used.
Summarize the main content of the paper
ReDiR compresses trajectory-level safety evidence into a latent representation injected into a frozen model, intercepting multi-turn decomposition attacks before action generation.
A paper on multi-turn agent safety defense, targeting multi-turn decomposition attacks in which a harmful goal is spread across multiple seemingly benign requests and tool calls and can only be identified from the full trajectory.
- Problem addressed: The authors argue that existing defenses separate trajectory reasoning from action generation—runtime guardrails check after action generation and rely on runtime-specific action representations, while trajectory-aware methods rely on external memory or online review—so trajectory-level safety evidence needs to be fed directly into action generation.
- Method highlights: Before each action, ReDiR uses a LoRA safety encoder sharing a backbone with the base model to compress the trajectory prefix into K = 8 latent safety representations, which are normalized and injected into the frozen base model; supervision comes from safe termination goals generated by the same model under a folded view with explicit task goals, filtered structurally and semantically audited by GPT-4.1-mini, with selective correction routed as NONE/TERMINATE/FULL and KL regularization to preserve benign behavior.
- Main results:
- Under all attacks on MT-AgentRisk, ReDiR's ASR on Qwen3.5-9B, Ministral-3-8B and Gemma-4-E4B is 5.5%, 0.0% and 7.9% respectively, versus 48.2%–65.8% for the Base baseline and 20.3%–34.2% for MAGE (Table 2).
- With supervision from only 55 Filesystem tasks, overall ASR when transferred to eight unseen tool domains is 0.0%–6.8% (Table 3).
- FPR on 50 benign tasks is 0.0% (Table 4); extra GPU memory is 1.328–3.250 MiB, and the authors report an average 53.3% reduction in end-to-end latency on harmful tasks.
- On AgentDojo, ReDiR's ASR (3.5%–13.1%) is higher than MAGE's (0.5%–1.2%), but it retains more benign utility (Table 2).
- Under the benign history dilution adaptive attack, overall ASR remains at 6.7%–10.0% (Table 14).
- Authors' conclusions and implications: The authors state that dispersed safety evidence can be integrated directly into action generation, offering an alternative to defenses that rely on post-generation action checks; they also acknowledge that ReDiR is an empirical defense that may miss unseen attacks or encourage adaptive bypass, and should be used together with least privilege, sandboxing and execution monitoring.