Papers · Toolformer
AI PAPER

Toolformer: Language Models Can Teach Themselves to Use Tools

Demonstrated that language models can learn when and how to call external tools (calculators, search engines, APIs) by training on self-generated examples of tool use.

Authors
Timo Schick, Jane Dwivedi-Yu, Roberto Dessi +5
Institution
Meta AI
Published
February NaN, 2023
Citations
2,500
Category
Agents
Impact
notable
PAPER EXPLAINED

Plain-English Summary

Language models are good at language but bad at math, cannot access current information, and struggle with tasks that require precise computation. Toolformer showed that a language model can learn to call external tools — a calculator for math, a search engine for current facts, a translation API for languages — and integrate the results into its responses. Crucially, the model learns when to use tools and when to rely on its own knowledge.

The training method is clever: the model first generates candidate tool calls inserted into existing text, then keeps only those calls where the tool’s output actually helped predict the next words. This self-supervised approach means no human labeling is needed — the model teaches itself tool use by measuring whether tools improve its predictions.

Think of it as a writer who learns to fact-check themselves. Rather than guessing at statistics, they learn to look them up. Rather than doing mental math, they reach for a calculator. The key skill is knowing when to look something up versus when to rely on memory.

Key Innovation

Toolformer’s self-supervised training approach was the breakthrough. The model annotates its own training data with tool calls, uses the tools to get results, and then filters based on whether the tool’s output reduced prediction loss. This bootstrapping process produces a model that naturally interleaves tool calls into text generation without any human-labeled examples of tool use.

The approach is general — it works with any tool that can be called with a text input and returns a text output. The paper demonstrated calculators, Q&A systems, Wikipedia search, machine translation, and calendar APIs.

Impact on the Field

Toolformer established the conceptual foundation for tool-using AI agents. ChatGPT Plugins, GPT-4 function calling, Claude tool use, and Gemini’s extensions all implement the idea of language models that decide when and how to call external tools. This capability is what transforms chatbots into practical agents that can take actions in the real world.

The paper also highlighted a key limitation of pure language models: some tasks are fundamentally better solved by specialized tools. Rather than trying to make the language model do everything, the optimal approach lets it orchestrate specialized systems.

Models That Built on This

ChatGPT Plugins launched months after Toolformer, implementing the same concept commercially. GPT-4’s function calling feature formalizes tool use with structured schemas. Claude’s tool use capability enables integration with arbitrary APIs. Gemini’s function calling follows similar patterns. The broader “AI agents” movement — models that plan and execute multi-step tasks using tools — builds directly on Toolformer’s foundation.