主页

索引

模块索引

搜索页面

Toolformer: Language Models Can Teach Themselves to Use Tools

  • https://arxiv.org/abs/2302.04761

  • 组织:Meta AI Research, †Universitat Pompeu Fabra

  • 语言模型 (LM) 表现出卓越的能力,只需几个示例或文本指令即可解决新任务,尤其是在大规模的情况下。矛盾的是,他们还在基本功能上苦苦挣扎,例如算术或事实查找,而在这些功能中,更简单和更小的模型表现出色。在本文中,我们展示了 LM 可以通过简单的 API 自学使用外部工具,并实现两全其美。我们引入了 Toolformer,这是一个经过训练的模型,用于决定调用哪些 API、何时调用它们、传递哪些参数以及如何最好地将结果整合到未来的token prediction中。这是以自我监督的方式完成的,只需要对每个 API 进行少量演示。我们整合了一系列工具,包括计算器、问答系统、两种不同的搜索引擎、翻译系统和日历。Toolformer 在不牺牲其核心语言建模能力的情况下,在各种下游任务中实现了大幅提高的零样本性能,通常与更大的模型竞争。

  • Language models (LMs) exhibit remarkable abilities to solve new tasks from just a few examples or textual instructions, especially at scale. They also, paradoxically, struggle with basic functionality, such as arithmetic or factual lookup, where much simpler and smaller models excel. In this paper, we show that LMs can teach themselves to use external tools via simple APIs and achieve the best of both worlds. We introduce Toolformer, a model trained to decide which APIs to call, when to call them, what arguments to pass, and how to best incorporate the results into future token prediction. This is done in a self-supervised way, requiring nothing more than a handful of demonstrations for each API. We incorporate a range of tools, including a calculator, a Q&A system, two different search engines, a translation system, and a calendar. Toolformer achieves substantially improved zero-shot performance across a variety of downstream tasks, often competitive with much larger models, without sacrificing its core language modeling abilities.

备注

Toolformer fine-tune LLMs to use external tool APIs. 本质是训练一个大模型,使其具有LLM的基本能力外,还有使用工具的能力。

https://img.zhaoweiguo.com/uPic/2024/08/Se9T17.png

关键步骤:

  • LLM在各种自然语言处理任务上取得了令人印象深刻的零样本和少样本结果并显示出几种紧急能力。然而,所有这些模型都有几个固有的局限性,这些局限性充其量只能通过进一步扩展来部分解决。这些限制包括``无法获得有关最近事件的最新信息``以及``相关的幻觉事实倾向``、难以理解低资源语言缺乏执行精确计算的数学技能``以及``对时间进程的不了解

  • 克服当今语言模型的这些限制的一个简单方法是让它们能够使用外部工具,如搜索引擎、计算器或日历。然而,现有方法要么``依赖于大量的人工注释``或``将工具的使用限制为仅任务特定设置``,阻碍了 LM 中更广泛地采用工具的使用。因此,我们提出了 Toolformer,这是一种学习以新颖方式使用工具的模型

  • 满足以下要求:
    • 工具的使用应该以自我监督的方式学习,而不需要大量的人工注释。这很重要不仅是因为与此类注释相关的成本,还因为人类认为有用的东西可能与模型认为有用的东西不同。

    • LM不应失去其任何通用性,并且应该能够自行决定何时以及如何使用哪种工具。

主页

索引

模块索引

搜索页面