TL;DR
LLM agents don’t always do something catastrophic in a single, obvious step—often, they string together seemingly innocent actions that quietly build toward a harmful outcome. WURI (Watching Unfolding Risk in Agent Interactions) is a lightweight, external safety monitor that catches these unfolding schemes early by mapping text logs into a specialized geometric space. It detects risky trajectories within the first few steps without needing access to the agent's internal weights, running over 100x faster than standard LLM-based guardrails.
What Problem Does This Paper Address?
When an LLM evolves from a chatbot into an autonomous agent that can execute code, call APIs, and read files, safety becomes a temporal puzzle. Imagine an agent reading a contact list, drafting an email, and hitting send. None of those actions look malicious in isolation, yet together they might constitute sensitive data exfiltration.
Today’s defenses face a painful trade-off between speed, context, and cost:
- Step-wise classifiers check one action at a time. They are fast, but like a security guard with amnesia, they miss danger distributed across multiple steps.
- Retrospective judges read the whole transcript at the end—meaning they yell "Stop!" after the
rm -rfcommand has executed or the email has left the server. - Continuous LLM-as-judge setups re-read the entire growing history ("prefix") after every single turn. They catch context, but the latency and compute costs are brutal.
The authors ask: can we monitor only the observable text of a growing interaction (making it compatible with closed-source agents) and catch harmful trajectories before they finish, at a fraction of the compute cost?
Methods
Instead of training a massive neural classifier or prompting a generative judge, WURI treats safety monitoring as a geometry problem.
- Standard Foundation: Each new text step (a user prompt, plan, or tool call) is passed through a standard, frozen text encoder (
bge-base-en-v1.5) to get a basic semantic embedding. - Novel "Atom" Adaptation: Raw text embeddings aren't naturally organized around multi-step safety risks. WURI introduces a trainable atom bank—1,024 latent basis vectors ("atoms") representing risk-relevant features. Using a lightweight query projection, each step activates its top-128 matching atoms to form a sparse, risk-adapted vector. During training, metric learning (triplet loss) pulls benign trajectories together and pushes harmful ones apart, while anchoring them near the original text meanings.
- Prototype Scoring & Max-Prefix Memory: Once trained, the authors average all harmful training trajectories into a single "harmful prototype" point, and all benign ones into a "benign prototype." At inference, WURI needs no classifiers or gradient updates. It simply measures whether the current step's vector points closer to the harmful prototype or the benign one. Crucially, it uses a max-prefix readout: the trajectory's current risk score is the highest step-margin seen so far.
Datasets
No new benchmarks are introduced; instead, the authors repurpose existing agent-safety datasets into serialized step-by-step prefixes (up to 20 steps):
- Training: Built from ATBench and SafeDialBench-EN (1,981 trajectories total).
- Evaluation: Tested across five settings probing different generalization shifts: In-Domain, SDB-EN (benchmark shift), SDB-ZH (Chinese language shift), LOHO (Leave-One-Hazard-Out, withholding privilege escalation and resource abuse from training), and AgentHarm (severe domain shift).
- Because several test sets only contain harmful examples, they are paired with a shared benign reference set from ToolBench-Benign (585 trajectories) to measure separability.
Key Insights and Ideas
- Don't let polite filler erase a red flag: Why take the maximum risk score across a prefix rather than the average? If an attacker slips a malicious command into step 2 and pads steps 3 through 10 with polite, routine chatter, averaging dilutes the alarm. Taking the max acts as a ratchet—once a step leans toward the harmful trajectory geometry, the warning stays active.
- Cross-lingual transfer for free(ish): Even though WURI uses an English-centric frozen encoder and English training data, its adapted geometry still separates Chinese harmful trajectories (SDB-ZH) remarkably well—even after controlling for translation and formatting artifacts.
- Non-generative geometry beats generative reasoning on speed: By reducing runtime inference to a frozen embedding pass, a small matrix multiply, and two cosine similarities, WURI sidesteps autoregressive token generation entirely.
Key Results
The authors measure AUDC (Area Under the Detection Curve, averaging ranking quality across all prefix lengths $k=1\dots20$) and [email protected] (the earliest step where True Positive Rate $\ge 0.8$ while False Positive Rate $\le 0.1$).
- Overall Ranking: WURI achieves the highest average AUDC across all five settings at 0.8773, beating the strongest LLM guardrail baseline, TS-Guard (0.6876), by nearly 0.19 points. It ranks first on In-Domain (0.9989), SDB-EN (0.9739), and SDB-ZH (0.9443).
- Early Warning: WURI hits the strict [email protected] detection target at step 1 (In-Domain), step 2 (SDB-EN), and step 4 (SDB-ZH).
- Massive Speedup: Evaluating all benchmarks took WURI 2.45 minutes wall-clock time. Guardrail baselines took between 320.7 minutes (LlamaGuard3, 131x slower) and 1,013.7 minutes (TS-Guard, 414x slower).
Limitations and Future Work
- Purely Compositional Blind Spots: Because WURI scores individual steps against trajectory prototypes and takes the max, it struggles with purely compositional attacks—cases where every single step is 100% benign-leaning in the learned space, and harm only exists in their sequential combination.
- Severe Out-of-Distribution (OOD) Shifts: On unseen hazards (LOHO) and different agent domains (AgentHarm), WURI drops to second place or middle-of-the-pack (0.7237 and 0.7457 AUDC) and fails to reach the strict low-false-positive [email protected] threshold. Specialized reasoning (TS-Guard) or raw embeddings (BGE-Raw) perform better there.
- Shared Benign Reference: Relying on ToolBench-Benign for datasets lacking native benign splits can introduce structural shortcuts, though extensive matching diagnostics show the signal remains genuine.
Future Directions: Building sequence-level models that explicitly compose benign steps over time, creating native multilingual benign agent benchmarks, and wiring WURI’s fast alarms into active agent interventions like safe re-planning or human verification.
Summary updated