arXiv cs.AI· Zekun Wu, Ze Wang, Seonglae Cho, Yufei Yang, Adriano Koshiyama, Sahan Bulathwela, Maria Perez-Ortiz·· 3 天前AI 评分48
研究:LLM 的工具调用在线性层面可读取与操控
Tool Calling is Linearly Readable and Steerable in Language Models
AI 导读
一项 arXiv 研究提出,通过对少量示例的隐藏状态取平均得到「工具向量」,可在模型生成调用前预测并操控其工具选择。在 4B 至 27B 参数的 8 个指令微调模型上,无重训练的操控在 56-78% 的留出工具对中改变生成的调用;在 BFCL 上用向量距离检测错误调用的 AUROC 达 0.74-0.79。
正文 · 原文
Abstract:Language-model agents can take real actions by calling tools, so choosing the wrong tool can cause errors that are difficult to undo. Most evaluations only observe the tool choice after the model generates a call. We read this choice from the model before generation, and we steer it. For each tool, we average the model's hidden states from a few example requests to obtain a tool vector. Comparing a new request with these tool vectors predicts which tool it needs. The difference between two tool vectors gives a steering direction that can move the model toward a chosen tool without retraining. Across eight instruction-tuned models from 4B to 27B parameters, steering changes the generated call to a chosen target tool in 56-78% of held-out tool pairs, depending on the model. We also observe steering on real APIs from $\tau$-bench and ToolBench, though less reliably. At the final layer, steering could work simply by raising the score of the target tool name. To test this, we compare the steering direction with a direction that only raises that score, layer by layer. In the middle layers, on the three models we examine in depth, the steering direction switches more calls than the score-raising direction. So the tool vectors capture part of the tool choice before the final layer. The same tool vectors also help identify likely tool-selection errors before generation. Calls are more likely to be wrong when a request is similarly close to two tool vectors. Across three models on BFCL, this signal achieves an AUROC of 0.74-0.79. Together, these results suggest that the model's hidden state provides a way to read, steer, and check tool choice before a call is made.
| Comments: | 49 pages. v4: revised experiments and updated BFCL error-detection results |
| Subjects: | Computation and Language (cs.CL); Artificial Intelligence (cs.AI); Machine Learning (cs.LG); Software Engineering (cs.SE) |
| Cite as: | arXiv:2605.07990 [cs.CL] |
| (or arXiv:2605.07990v4 [cs.CL] for this version) | |
| https://doi.org/10.48550/arXiv.2605.07990 arXiv-issued DOI via DataCite |
Submission history
From: Zekun Wu [view email]
[v1]
Fri, 8 May 2026 16:47:08 UTC (7,160 KB)
[v2]
Mon, 25 May 2026 19:38:06 UTC (557 KB)
[v3]
Sat, 26 Sep 2026 20:25:03 UTC (729 KB)
[v4]
Wed, 2 Dec 2026 15:46:20 UTC (656 KB)
来源:arXiv cs.AI · arxiv.org