Prevalent retrieval-based tool-use pipelines struggle with a dual semantic challenge: their retrievers often employ encoders that fail to capture complex semantics, while the Large Language Model (LLM) itself lacks intrinsic tool knowledge from its natural language pretraining. Generative methods offer a powerful alternative by unifying selection and execution, tasking the LLM to directly learn and generate tool identifiers. However, the common practice of mapping each tool to a unique new token introduces substantial limitations: it creates a scalability and generalization crisis, as the vocabulary size explodes and each tool is assigned a semantically isolated token. This approach also creates a semantic bottleneck that hinders the learning of collaborative tool relationships, as the model must infer them from sparse co-occurrences of monolithic tool IDs within a vast library. To address these limitations, we propose ToolWeaver, a novel generative tool learning framework that encodes tools into hierarchical sequences. This approach makes vocabulary expansion logarithmic to the number of tools. Crucially, it enables the model to learn collaborative patterns from the dense co-occurrence of shared codes, rather than the sparse co-occurrence of monolithic tool IDs. We generate these structured codes through a novel tokenization process designed to weave together a tool's intrinsic semantics with its extrinsic co-usage patterns. These structured codes are then integrated into the LLM through a generative alignment stage, where the model is fine-tuned to produce the hierarchical code sequences. Evaluation results with nearly 47,000 tools show that ToolWeaver significantly outperforms state-of-the-art methods, establishing a more scalable, generalizable, and semantically-aware foundation for advanced tool-augmented agents.


翻译:主流的基于检索的工具使用流程面临双重语义挑战:其检索器通常采用的编码器难以捕捉复杂语义,而大型语言模型(LLM)本身也缺乏从其自然语言预训练中获得的内在工具知识。生成式方法提供了一种强大的替代方案,它通过统一选择与执行过程,让LLM直接学习并生成工具标识符。然而,当前将每个工具映射到一个唯一新标记的常见做法存在显著局限:这导致了可扩展性与泛化性危机,因为词汇表规模急剧膨胀,且每个工具被分配了一个语义上孤立的标记。该方法还造成了语义瓶颈,阻碍了模型学习工具间的协作关系,因为模型必须从庞大工具库中孤立工具ID的稀疏共现中推断这些关系。为应对这些局限,我们提出了ToolWeaver——一种新颖的生成式工具学习框架,它将工具编码为分层序列。这种方法使词汇表扩展与工具数量呈对数关系。关键在于,它使模型能够从共享代码的密集共现中学习协作模式,而非从孤立工具ID的稀疏共现中学习。我们通过一种新颖的标记化过程生成这些结构化代码,该过程旨在将工具的内在语义与其外在的协同使用模式交织在一起。这些结构化代码随后通过生成式对齐阶段整合到LLM中,在此阶段对模型进行微调以生成分层代码序列。在近47,000个工具上的评估结果表明,ToolWeaver显著优于现有最先进方法,为先进的工具增强智能体奠定了更可扩展、更易泛化且更具语义感知能力的基础。

0
下载
关闭预览

相关内容

【ETZH博士论文】语言模型编程
专知会员服务
25+阅读 · 2025年6月14日
定制化大型语言模型的图检索增强生成综述
专知会员服务
37+阅读 · 2025年1月28日
大型概念模型:在句子表示空间中的语言建模
专知会员服务
18+阅读 · 2024年12月14日
NLG ≠ 机器写作 | 专家专栏
量子位
13+阅读 · 2018年9月10日
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
42+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
Arxiv
0+阅读 · 2月7日
Arxiv
0+阅读 · 2月5日
Arxiv
0+阅读 · 1月29日
VIP会员
相关基金
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
42+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员