从噪声轨迹到根本原因:面向智能体优化的结构轨迹分析与因果提取
From Noisy Traces to Root Causes: Structural Trajectory Analysis and Causal Extraction for Agent Optimization
July 8, 2026
作者: Ying Chang, Jiahang Xu, Xuan Feng, Chenyuan Yang, Peng Cheng, Yuqing Yang
cs.AI
摘要
面向长周期智能体的优化日益依赖于基于反思的机制,其中大型语言模型(LLM)作为优化器来诊断智能体失败并改进智能体策略。然而,真实的执行轨迹难以直接用于优化:大规模轨迹集合往往冗余且异质,导致优化效率低下且容易过拟合于低价值失败案例;同时,每条单独的轨迹也包含大量无关步骤,而诸如截断或滑动窗口等朴素上下文约简方法可能丢弃因果关键证据,产生具有误导性的优化信号。为解决这一困境,我们提出STRACE(结构化轨迹分析与因果提取)框架,该框架构建高信噪比的优化上下文,以实现更精确有效的优化。在批次层面,STRACE挖掘失败模式以过滤冗余轨迹,保留具有代表性的失败案例;在每条选定轨迹内,它通过文本依赖图进行因果定位,剔除非因果步骤,并识别真正的根因模块以进行优化。实验结果表明,STRACE显著优于标准上下文过滤基线方法。值得注意的是,在一项具有挑战性的形式化验证任务(VeruSAGE-Bench)中,它成功优化了人类专家设计的智能体,将成功率提升了1.4倍(从42.5%提升至58.5%)。代码已开源在 https://github.com/moomight/STRACE 。
English
The optimization of long-horizon agents increasingly relies on reflection-based mechanisms, where a large language model (LLM) acts as an optimizer to diagnose agent failures and improve agent policies. However, real execution traces are difficult to use directly for optimization: large trace collections are often redundant and heterogeneous, making optimization inefficient and prone to overfitting to low-value failures; meanwhile, each individual trajectory also contains many irrelevant steps, while naive context reduction methods such as truncation or sliding windows can discard causally important evidence and produce misleading optimization signals. To resolve this dilemma, we introduce STRACE (Structural TRajectory Analysis and Causal Extraction), a framework that constructs high signal-noise optimization contexts for more precise and effective optimization. At the batch level, STRACE mines failure patterns to filter redundant traces and retain representative failures; within each selected trace, it performs causal localization over a textual dependency graph to remove non-causal steps and identify the true root-cause module for optimization. Empirical results demonstrate that STRACE significantly outperforms standard context-filtering baselines. Notably, on a challenging formal verification task (VeruSAGE-Bench), it successfully optimizes human-expert designed agents, delivering 1.4times success-rate improvement (42.5% to 58.5%). The code is available at https://github.com/moomight/STRACE .