CaSKG:面向可扩展智能体技能检索的反事实-因果技能图
CaSKG: Counterfactual-Causal Skill Graphs for Scalable Agent Skill Retrieval
August 26, 2026
作者: Zhiyuan Li, Linyuan Gao, Xuechun Ding, Hongwei Chen, Yuan Wu, Yi Chang
cs.AI
摘要
可复用技能库使大语言模型(LLM)智能体能够在不同任务间复用程序性知识,但也将记忆访问转变为具有挑战性的检索问题。全库提示在保持覆盖度的同时带来高昂的上下文成本;向量检索虽能返回紧凑的邻域,却将技能视为相互独立的文本;基于图的检索仅在携带相关性的边可靠时才能恢复工作流上下文。我们提出CaSKG,一种反事实-因果技能图框架,在检索之前对程序性关系进行校准。CaSKG首先从语义、词汇、输入/输出及结构证据构建高召回有向候选图,并通过修复证据和可选的LLM评判器进一步细化候选得分。然后,它应用方向条件的文本反事实探针,对技能对进行删除、替换和重排操作,结合贝叶斯平滑聚合证据,并发布状态过滤加权图以支持任务条件扩展。该图离线构建,使用过程中无需改变下游智能体策略或任务接口。在ALFWorld ID-140和ScienceWorld U211上的六个LLM骨干模型中,CaSKG在所有十二种模型与基准的组合中均取得最高任务得分。与Graph-of-Skills(GoS)相比,它将六个模型的ScienceWorld宏平均得分从72.62提升至80.50,ALFWorld成功率从80.01\%提升至86.79\%,同时降低了两个基准上的平均环境步数。定性与消融分析进一步表明,校准后的边有助于检索保留前置条件、状态改变动作、验证流程及最终完成步骤。这些结果证明,边置信度校准是实现大规模紧凑且可执行技能检索的有效途径。代码可于https://github.com/ZhiyuanLi218/Caskg获取。
English
Reusable skill libraries allow large language model (LLM) agents to reuse procedural knowledge across tasks, but they also turn memory access into a challenging retrieval problem. Full-library prompting preserves coverage at high context cost, vector retrieval returns compact neighborhoods but treats skills as independent text, and graph-based retrieval can recover workflow context only when the edges that carry relevance are reliable. We propose CaSKG, a counterfactual-causal skill graph framework that calibrates procedural relations before retrieval. CaSKG first builds a high-recall directed candidate graph from semantic, lexical, input/output, and structural evidence, with repair evidence and an optional LLM judge further refining candidate scores. It then applies direction-conditioned textual counterfactual probes that remove, substitute, and reorder skill pairs, aggregates the evidence with Bayesian smoothing, and publishes a state-filtered weighted graph for task-conditioned expansion. The graph is constructed offline and used without changing the downstream agent policy or task interface. Across six LLM backbones on ALFWorld ID-140 and ScienceWorld U211, CaSKG achieves the highest task score in all twelve combinations of model and benchmark. Relative to Graph-of-Skills (GoS), it improves the six-model macro-average ScienceWorld score from 72.62 to 80.50 and ALFWorld success from 80.01\% to 86.79\%, while reducing mean environment steps on both benchmarks. Qualitative and ablation analyses further show that calibrated edges help retrieval preserve prerequisites, state-changing actions, verification routines, and final completion steps. These results position edge-confidence calibration as an effective route to compact and executable skill retrieval at scaleCode is available at: https://github.com/ZhiyuanLi218/Caskg .