When a tool-calling agent picks the wrong tool, the failure is invisible until execution: the email gets sent, the meeting gets missed. As agents take on consequential actions, one bad tool call can do real damage. We currently have no way to look inside the model and catch the mistake before it happens; this paper shows that we can. Inside the model, the choice of tool is carried by a single direction in activation space, one direction per pair of tools. Adding that direction during generation switches which tool the model picks. Across 12 instruction-tuned and 6 base models spanning Gemma 3, Qwen 3, Qwen 2.5, and Llama 3.1 (270M to 27B), this works at 83-100% accuracy on 4B+ instruction-tuned models on a 15-tool synthetic benchmark and at 77-94% on the real-API benchmark $τ$-bench airline. The JSON arguments that follow automatically adapt to the new tool's schema, so flipping the name is enough. The same per-tool directions also flag likely errors before they happen: queries where the model is unsure between two tools fail 21x more often than queries where it is not (Gemma 3 27B). This is not just topic injection: random vectors at the same magnitude give a 0% switch rate, and a probe within a single domain (14 airline tools that share one topic) still reads which tool the model will call at top-1 61-89% across five 4B-14B models. Even base models already carry the right tool internally before they can emit it: reading the chosen tool off the model's internal state (cosine readout) recovers 61-82% accuracy on BFCL while base generation lands at 2-10%, suggesting pretraining forms the representation and instruction tuning later wires it to the output. Our results cover single-turn, fixed-menu settings; on multi-turn agent loops the same intervention is less stable (matched-baseline gain or loss of up to 30 percentage points with no consistent direction).


翻译:当工具调用代理选择错误工具时,故障在执行前不可见:邮件已发送,会议已错过。随着代理承担关键操作,一次错误工具调用可能造成实际损害。我们目前无法在错误发生前检查模型内部状态;本文证明这一目标可达成。在模型内部,工具选择由激活空间中的单一方向承载——每对工具对应一个方向。在生成过程中添加该方向可切换模型所选工具。在涵盖 Gemma 3、Qwen 3、Qwen 2.5 和 Llama 3.1(参数规模 270M 至 27B)的 12 个指令微调模型和 6 个基础模型上,该技术在 4B+ 参数指令微调模型上对 15 工具合成基准测试的准确率达 83-100%,对真实 API 基准测试 τ-bench 航空模块的准确率达 77-94%。后续自动生成的 JSON 参数会自适应新工具的模式,因此仅切换工具名称即可生效。相同的逐工具方向还能标记潜在错误:模型在两工具间犹豫的查询失败率是确定情况的 21 倍(Gemma 3 27B)。该现象并非主题注入:相同幅值的随机向量产生 0% 切换率,且针对单一领域(共享同一主题的 14 个航空工具)的探针仍能读取模型将要调用的工具(5 个 4B-14B 模型的 top-1 准确率为 61-89%)。甚至基础模型在生成输出前内部已编码正确工具:通过余弦读取法从模型内部状态读取所选工具,在 BFCL 上恢复 61-82% 准确率(基础模型生成仅达 2-10%),表明预训练形成表示,指令微调随后将其接至输出。本结果覆盖单轮固定选项设置;在多轮代理循环中,相同干预的稳定性较低(匹配基线增益或损失达 30 个百分点,且无一致方向)。

0
下载
关闭预览

相关内容

大语言模型表示工程的分类、机会与挑战
专知会员服务
22+阅读 · 2025年2月28日
大语言模型在规划与调度问题上的应用
专知会员服务
53+阅读 · 2025年1月12日
【MIT博士论文】机器学习模型调试的有效工具,149页pdf
专知会员服务
48+阅读 · 2023年3月29日
一个牛逼的 Python 调试工具
机器学习算法与Python学习
15+阅读 · 2019年4月30日
如何理解模型的过拟合与欠拟合,以及如何解决?
七月在线实验室
12+阅读 · 2019年4月23日
【学界】机器学习模型的“可解释性”到底有多重要?
GAN生成式对抗网络
12+阅读 · 2018年3月3日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
最新内容
无人机自主控制与人工智能:系统性综述
专知会员服务
5+阅读 · 今天7:25
巡飞弹与反无人机系统——现代战场的两大支柱
专知会员服务
2+阅读 · 今天6:54
《打造“黄金舰队”》57页报告
专知会员服务
1+阅读 · 今天6:52
《北约数字教官网络发展路径》128页报告
专知会员服务
1+阅读 · 今天6:33
ECCV 2026 | MIMFlow:MIM与归一化流统一图像生成
专知会员服务
6+阅读 · 6月25日
网状网络及其在军事领域的运用
专知会员服务
7+阅读 · 6月25日
无美国参与的欧洲战争方式(万字长文)
专知会员服务
8+阅读 · 6月25日
《国防领域敏感性分析白皮书》
专知会员服务
9+阅读 · 6月25日
综述 | 从问答到任务完成:Agent系统与Harness设计
专知会员服务
10+阅读 · 6月24日
Agentic RL:框架、实践与长程智能体训练
专知会员服务
10+阅读 · 6月24日
相关基金
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员