ToolkenGPT: Augmenting Frozen Language Models with Massive Tools via Tool Embeddings

Augmenting large language models (LLMs) with external tools has emerged as a promising approach to solving complex problems. However, traditional methods, which finetune LLMs with tool demonstration data, can be both costly and restricted to a predefined set of tools. Recent in-context learning paradigm alleviates these issues, but the limited context length only allows for a few shots of demonstrations, leading to suboptimal understandings of the tools. Moreover, when there are numerous tools to choose from, in-context learning could completely fail to work. In this paper, we propose an alternative approach, $\textbf{ToolkenGPT}$, which combines the benefits of both sides. Our approach represents each $\underline{tool}$ as a to$\underline{ken}$ ($\textit{toolken}$) and learns an embedding for it, enabling tool calls in the same way as generating a regular word token. Once a toolken is triggered, the LLM is prompted to complete arguments for the tool to execute. ToolkenGPT offers the flexibility to plug in an arbitrary number of tools by expanding the set of toolkens on the fly. In addition, it improves tool use by allowing extensive demonstration data for learning the toolken embeddings. In diverse domains, including numerical reasoning, knowledge-based question answering, and embodied plan generation, our approach effectively augments LLMs with tools and substantially outperforms various latest baselines. ToolkenGPT demonstrates the promising ability to use relevant tools from a large tool set in complex scenarios.

Paper

References (87)

Scroll for more · 38 remaining

Similar papers

Peer review

Reviewer QLCo7/10 · confidence 4/52023-06-10

Summary

The authors propose "ToolkenGPT." This method allows language models to take advantage of external tools without full model fine-tuning, and with the ability to show more tools and with greater detail than in-context learning typically allows. They show that use of "toolkens" (tool tokens) improves performance over baselines on arithmetic, knowledge-base QA, and embodied plan generation.

Strengths

In terms of originality, the paper introduces a new and innovative approach to external tool access for language models. It seems like a hybrid of fine-tuning and few-shot learning, but uses both in a novel and interesting way. Though there's not much direct comparison to prior work, it is at least acknowledged. In terms of quality, the experimental setup is sound. It seems evident that ToolkenGPT performs better than simple (but well designed) baselines. In terms of clarity, the paper is well-written and easy to follow. I haven't read the appendix in detail, but it seems to provide enough information for reproducing the experiments. In terms of significance, this work brings up new ideas that seem very useful.

Weaknesses

* The biggest weakness of this paper is in evaluation. * ToolkenGPT is not directly compared to prior work. It is only compared to things along the lines of zero-shot or few-shot baselines. At the end of the paper I'm left wondering how ToolkenGPT would stack up against e.g., a full model fine-tuning method like Toolformer. I can see that ToolkenGPT allows for demonstrating more tools with more detail than few-shot. It also seems like it's probably cheaper to use ToolkenGPT than to fine-tune. But I'm not really sure of how accuracy for the two tuning methods compare. * In evaluation there are sometimes confounding variables that render results less useful. For example, in Section 4.2 5x more data is used for training ToolkenGPT (sup) than ToolkenGPT (syn). Is the improved performance due to more training samples or higher data quality? * Evaluation sometimes lacks specificity. For example, in Section 4.2 it's unclear whether the 30 relations ICL has access to in the e.g., 234 relation case are required to include the correct relation. That seems like a very important detail. * Overall this paper covers an impressive breadth of evaluation, but I wish there was one in-depth evaluation where # of tools, model size, and number of training data points were carefully considered for strong few-shot and fine-tuning (e.g., fine-tuning on all the exact data used to train the toolkens) baselines along with ToolkenGPT while carefully controlling for other variables. * I think the comparison between fine-tuning, few-shot, and ToolkenGPT could cleaner * I'm not sure of the difference between "plug-and-play" and "frozen LM" in Table 1. I wouldn't say ToolkenGPT is "plug-and-play" given the model-specific training required for embeddings. * I'm not sure what is really meant by "massive tools." What is stopping a fine-tuning method from learning such tools?

Questions

See weaknesses

Rating

7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

3 good

Presentation

3 good

Contribution

3 good

Limitations

The authors have a nice discussion of limitations.

Reviewer 5YmU8/10 · confidence 4/52023-07-03

Summary

This paper proposes a new method to help LLM utilize tools. Essentially, the method trains an additional output embedding token (toolken) for each tool. During inference, if LLM outputs a toolken, a special routine of using the corresponding tool is triggered and the returned result of the tool is then replaced with the toolken for continual inference. As a result, the proposed method can accommodate more tools and unfamiliar tools, compared to in-context prompting approaches like ReAct. The author has shown the effectiveness and advantage of the proposed method across multiple domains including math reasoning, knowledge based QA and embodied AI.

Strengths

1. Compared to full model finetuning like Toolformer or TALM, the proposed method is much more efficient as it doesn't require gradient of LLM parameters and only tunes an additional output embedding matrix. 2. Empirical results on multiple domains verified the advantage of ToolkenGPT over ReAct, as it can better accommodate more tools. 3. ToolkenGPT is easy to implement and is able to be applied for various domains, which can potentially foster more research on the direction of enhancing LLMs with tools.

Weaknesses

1. several typos are present: a) line 2, missing period after "problems"; b) line 92, missing space "whichhelps"; c) line 204, versatile *and* adaptive; d) line 234, 503.2 --> 50*3.2 2. One limitation is ToolkenGPT requires access to model activations thus not capable of being applied on closed-sourced LLMs like ChatGPT, while pure prompting method like ReAct doesn't have such limitation. As such, it's desirable to compare with a baseline of ReAct w/ ChatGPT. However, in the experiments, the author only compare with ChatGPT with 0-shot prompting (Table 2) 3. There are two parts of the proposed methods: toolken embedding and sub-routine of tool call. It's desirable to show some ablation of the latter part. For example, show a baseline of ReAct + sub-routine of tool call with demonstrations. In this way, readers can better assess the benefit of each component of proposed method

Questions

1. The paper did not provide empirical comparison between ToolkenGPT with finetuning approach like Toolformer and TALM. Though you mentioned that ToolkenGPT requires much less GPU memory than those methods, is it possible to provide some empirical comparison to those methods?

Rating

8: Strong Accept: Technically strong paper, with novel ideas, excellent impact on at least one area, or high-to-excellent impact on multiple areas, with excellent evaluation, resources, and reproducibility, and no unaddressed ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

4 excellent

Presentation

3 good

Contribution

4 excellent

Limitations

The author has adequately discussed the limitations.

Reviewer Mpoh7/10 · confidence 4/52023-07-04

Summary

This paper presents ToolkenGPT, a novel approach to generalizing LLMs to massive external tools. The key is to represent each tool as a "token", such that when LLMs generate the tool token(toolken), the associated tool will be invoked and executed. The learning of toolken is easy and efficient since there is no need to update the whole LLMs or backward the gradients through LLMs. Toolkens are appended at the last layer of the LLMs, making the cost similar to just doing inference. The authors have conducted extensive experiments and compared to proper baselines. The results are convincing.

Strengths

The proposed method could make a good contribution to tool learning. In particular, the use of toolken is a novel yet elegant way to solve the massive tools adaption and generation problem. The proposed method is efficient, yet to learn and extend. The paper is clearly written and easy to follow. The evaluation is comprehensive and convincing.

Weaknesses

It would make the evaluation stronger if the authors can include some of the following experiments: 1. Lacking comparison with fine-tuning-based methods, e.g., toolformer. In Numerical Reasoning tasks, I believe these methods could work quite well. 2. The target is the massive tool-learning scenario, it would be great to try some tasks that involve multiple quite different tool calls at the same time, e.g., qa and calculator. Although the experiments on VirturalHome are great, these 58 tools are mostly similar. 3. Testing whether the training and inclusion of toolken will affect the language generation capacity, i.e., adding some NLU tasks to see if there is any performance drop.

Questions

NA

Rating

7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

4 excellent

Presentation

4 excellent

Contribution

3 good

Limitations

NA

Reviewer xBHJ8/10 · confidence 4/52023-07-06

Summary

The paper presents ToolkenGPT, a framework for extending LMs with tool use. For each new tool, a new token is added to the output vocabulary of the LM and the embedding for that token is trained with annotated or synthetic examples. When the LM generates that token, the model is switched to a different mode and prompted with examples for that particular tool in order to generate the necessary arguments for that tool call.

Strengths

The method seems novel and useful, pushing forward the area of research on extending LM capabilities by teaching them to call external tools.

Weaknesses

Evaluation on three different types of tasks is great. However, the choice of baselines is the main weakness of the paper. The method seems to use substantial amounts of data for fine-tuning the token embeddings, whereas all the chosen baselines are only restricted to zero-shot or few-shot prompting. Comparison with Toolformer, which fine-tunes the whole model using similar data, would be more fair. There are a number of writing errors. Please make sure to proof-read the paper.

Questions

On line 152, "and does requires the gradients of LLM parameters" should presumably be "and does not require the gradients of LLM parameters"? When generating the training data, do you do any filtering to make sure that the tool can actually correctly handle the given query? Seems like that would help. For most of the tasks it is unclear how many synthetic data examples you generate. Please clarify. With in-context learning and 234 tools to describe, are you actually able to fit all the tool examples or descriptions into the context? Or does some of this information simply get truncated? Please clarify.

Rating

8: Strong Accept: Technically strong paper, with novel ideas, excellent impact on at least one area, or high-to-excellent impact on multiple areas, with excellent evaluation, resources, and reproducibility, and no unaddressed ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

4 excellent

Presentation

3 good

Contribution

3 good

Limitations

The potential risks of letting LMs make calls to external APIs, with automatically generated arguments, should also be addressed.

Reviewer C7TV7/10 · confidence 4/52023-07-06

Summary

This study introduces an approach to teach Large Language Models (LLMs) to utilize numerous tools through learning embeddings for these tools. The embeddings are incorporated into the LLMs' output layer, invoking the use of tools at relevant steps. The inference process alternates between reasoning and tool-use modes to tackle novel tasks. Empirical results validate the efficacy of ToolkenGPT in utilizing a massive number of tools across various tasks, including numerical reasoning, knowledge-based question answering, and embodied plan generation.

Strengths

- The proposed method is innovative and scales well to a massive number of tools with limited examples. - The method is effective across a variety of tasks and demonstrates advanced multi-turn planning capability. - The paper is well-structured and clearly written.

Weaknesses

- While the authors assert the training efficiency of ToolkenGPT, empirical results reflecting computation costs and performance comparisons are missing. - Given the current feasibility of instruction tuning (e.g., Alpaca, Vicuna), it would be beneficial to compare the proposed method with the fine-tuning of the entire model using the same training data. This comparison could clarify if there's a tradeoff between performance and computation cost. - Although the authors claim a plug-and-play capability for ToolkenGPT, this feature hasn't been evaluated in the empirical studies. Additionally, if I understand correctly, we still need to train the embeddings for new tools. The authors should clarify this plug-and-play capability in more detail.

Questions

- Is it possible to perform instruction tuning using the same training data? - Can ToolkenGPT facilitate the zero-shot plug-and-play utilization of new tools?

Rating

7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

3 good

Presentation

4 excellent

Contribution

3 good

Limitations

The authors have discussed the limitations thoroughly.

Authorsrebuttal2023-08-11

Correction: Computing resource for finetuning (LoRA)

There is a typo in the RTable 1: finetuning (LoRA) indeed used 8 x A100 (80G), instead of 1 x A100. So it costs much more computing resources than ToolkenGPT.

Reviewer QLCo2023-08-15

With respect to (a) I think including this line of experiment into the paper will be important. It seems like based on RTable 1 the conclusion is that full fine-tuning reaches better accuracy, but at a high computation cost. It would be nice for the final version of the paper to emphasize the computation cost vs accuracy trade-off. Thanks for clarifying (b) and (c). I think including that information in the paper will be useful. I'm happy you're planning to revise/clarify the "plug and play" term (d). While it's perhaps a small point, I still find the term "Massive tools" a bit misleading. "Massive tools" seems to imply the tools are individually complex. But it seems like what you're trying to emphasize is that the model can handle many tools (regardless of their individual complexity). Anyways, it's a small thing but maybe worth some thought. Overall, thanks for the additional experiments. I trust the new results/clarifications will be added to the final version of the paper and I have accordingly recommended acceptance of the paper.

Reviewer 5YmU2023-08-15

Response to Author's Rebuttal

Thank you for providing the detailed responses. I have read it carefully and hope the additional experiments will go into your future version.

Reviewer C7TV2023-08-18

Thank you for providing the detailed responses. My concerns are well addressed.

Reviewer xBHJ2023-08-21

Thank you for your response. I have reviewed the reply and stick with my original score, which is already quite high. I think the inclusion of RTable 1 is useful - as this is a parameter-efficient method, it is expected that it doesn't perform quite the same as some more resource-hungry approaches. However, RTable 2 doesn't seem particularly useful. It just shows that Toolformer was trained for longer using more powerful GPUs - something that could be easily done with ToolkenGPT as well. Without knowing the performance, or at least training time, for both systems, there is no real comparison point.

Program Chairsdecision2023-09-21

Decision

Accept (oral)

© 2026 NYSGPT2525 LLC