TrajAD: Trajectory Anomaly Detection for Trustworthy LLM Agents
Yibing Liu, Chong Zhang, Zhongyi Han, Hansong Liu, Yong Wang, Yang Yu, Xiaoyan Wang, Yilong Yin
TL;DR
This paper defines Trajectory Anomaly Detection as a runtime auditing task for LLM agents, arguing that reliability requires monitoring intermediate execution rather than only final outputs. It introduces TrajBench, a large, balanced dataset created via a perturb-and-complete strategy to yield both normal and anomalous trajectories with precise error localization, enabling supervised learning for anomaly verdicts and error steps. The authors propose TrajAD, a specialized generative verifier trained on TrajBench with a decoder-only Transformer and LoRA, capable of determining if a trajectory is normal and localizing the first error step, thereby enabling rollback-and-retry during execution. Empirical results show that general-purpose LLMs struggle with anomaly detection and localization, while TrajAD significantly improves both metrics, with strong cross-domain transfer and favorable data-efficiency; larger models or data alone do not fully close the localization gap, underscoring the value of dedicated supervision for process-level safety. Overall, the work shifts agent evaluation toward runtime process auditing, offering a practical path to trustworthy autonomous LLM agents in diverse domains, including embodied AI.
Abstract
We address the problem of runtime trajectory anomaly detection, a critical capability for enabling trustworthy LLM agents. Current safety measures predominantly focus on static input/output filtering. However, we argue that ensuring LLM agents reliability requires auditing the intermediate execution process. In this work, we formulate the task of Trajectory Anomaly Detection. The goal is not merely detection, but precise error localization. This capability is essential for enabling efficient rollback-and-retry. To achieve this, we construct TrajBench, a dataset synthesized via a perturb-and-complete strategy to cover diverse procedural anomalies. Using this benchmark, we investigate the capability of models in process supervision. We observe that general-purpose LLMs, even with zero-shot prompting, struggle to identify and localize these anomalies. This reveals that generalized capabilities do not automatically translate to process reliability. To address this, we propose TrajAD, a specialized verifier trained with fine-grained process supervision. Our approach outperforms baselines, demonstrating that specialized supervision is essential for building trustworthy agents.
