Agent Safety From Within: Detecting Harmful Trajectories from LLM Internal States
Abstract
Language model agents can now perform sophisticated sequences of actions via tools and harnesses, which has increased the scope of the damage they can cause. Guard models, however, are mainly built for content moderation and thus are not well-suited to detecting this agentic risk. To address this, we proceed by first conducting a representational analysis, then use the resulting insights to build a solution. In our analysis, we focus on two types of trajectory-level agentic harms: harmful content, which is expressed directly, and unsafe tool use, which depends on whether an action is consistent with the interaction that produced it. We investigate how open-source guard models represent these two types of harm and find that they are linearly readable inside the model, even though guard models predict no better than chance on pairs that differ only in the called tool's schema. The two harm types also follow nearly orthogonal internal directions, and neither reliably serves as a proxy for the other. These results motivate reading trajectory safety directly from internal states. We introduce TACIT, a readout of a frozen backbone's internal states that decodes no tokens. Trained on six trajectory-safety benchmarks, a linear probe raises mean macro-F1 from 62.3 for the strongest open guard to 80.7, and refined readouts reach 86.2. With each benchmark held out of training entirely, the refined readouts still lead the strongest guard (65.7 vs. 61.1). With the same backbone, training data and test split, the frozen readout is on par with full safety fine-tuning, and it improves the fine-tuned model further when applied on top. The probe trains about one millionth as many parameters as full fine-tuning in about a sixth of the time, and TACIT has the lowest latency of the guards we evaluate.
Create a lesson
Metadata
- Comments
- 24 pages, 11 figures, 9 tables
Related papers
Agent Recovery Gone Wrong: Measuring Harm Beyond Duplicate Calls
Shared title terminologycs.AIArtem Trofimov, Boris Novikov
Transport-Safe Evaluation of LLM Agents: Trajectory-Dependent Judge Error and Anytime-Valid Auditing
Shared title terminologycs.AIYulliwas Ameur, Samia Bouzefrane, Soumya Banerjee
Learning What to Change: State-Verified Reinforcement Learning for Educational Agents
Shared title terminologycs.AIShengyao Wang, Siyuan Su, Siyu Song et al.
Context-Grounded Skill Internalization for Vision-Language Agents
Shared title terminologycs.AIJinlin Liu, Yumeng He, Qihan Huang et al.
SWAM: State-aware World Action Model for Multi-Agent 3D Environments
Shared title terminologycs.AIJenna Kang, Bingxuan Li, Colin Groth et al.
Before Acting, Change the State: Prospective State Intervention for Web Agents under Deceptive Interfaces
Shared title terminologycs.AIRuozhao Yang, Mingfei Cheng, Xiaofei Xie