Skip to main content
QUICK REVIEW

[Paper Review] ToolWeaver: Weaving Collaborative Semantics for Scalable Tool Use in Large Language Models

Bowen Fang, Wen Ye|arXiv (Cornell University)|Jan 29, 2026
Machine Learning in Materials ScienceMaterials Science0 citations
TL;DR

ToolWeaver introduces hierarchical compositional tool codes learned via collaborative-aware tokenization, enabling scalable, generalizable tool use in LLMs and outperforming state-of-the-art on ToolBench.

ABSTRACT

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.

Motivation & Objective

  • Motivate scalable tool use in LLMs amid exploding tool catalogs.
  • Propose a compositional, hierarchical tool representation to replace one-token-per-tool schemes.
  • Learn tool semantics and collaborative relationships through a structured tokenization process.
  • Integrate structured tool codes into LLMs via multi-stage generative alignment.
  • Demonstrate superior retrieval and end-to-end performance on a large tool benchmark while preserving language capabilities.

Proposed method

  • Represent each tool as a sequence of L codes from L codebooks, enabling logarithmic vocabulary growth (K^L tools with L*K new tokens).
  • Use collaborative-aware residual quantization (RQ-VAE) to map semantic tool descriptions into hierarchical codes guided by a tool-tool similarity matrix.
  • Incorporate a graph Laplacian regularization to encourage similar tools to have nearby codes based on co-occurrence.
  • Apply a uniform mapping constraint at the final codebook level to avoid collisions via an optimal transport formulation solved with Sinkhorn-Knopp.
  • Fine-tune the LLM in two stages: retrieval alignment (predict tool code sequence from a query) and trajectory alignment (learn tool calls, parameters, and answers).
  • Use constrained beam search with a prefix trie of valid code sequences during inference to ensure valid tool identifiers.

Experimental results

Research questions

  • RQ1How can tool representations be scaled beyond one-token-per-tool without exploding vocabulary?
  • RQ2Can collaborative usage patterns among tools be integrated into tool representations to improve generalization and reasoning?
  • RQ3Does a structured, hierarchical code representation improve end-to-end task performance and tool orchestration compared to prior methods?
  • RQ4What is the impact of collaborative regularization on model performance and language capabilities?

Key findings

  • ToolWeaver achieves higher retrieval NDCG@k across simple and complex scenarios, with NDCG@1 reaching 88.00 in the hardest I3 setting.
  • In end-to-end evaluation, ToolWeaver attains the highest SoPR/SoWR across multiple setups, including unseen tools and categories.
  • Ablation shows semantic initialization is the most critical step, with collaborative guidance providing additional gains especially for complex tasks.
  • Collaborative regularization weight optimality around λ=1; too large λ harms intrinsic tool semantics.
  • ToolWeaver preserves general language capabilities much better than ToolGen, with lower perplexity and stable summarization quality.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.