AI engineering paper · 2023
Toolformer
How a small language model taught itself to call a calculator, a search box and other tools, and which parts of that recipe later systems kept.
You’ll learn to
- Explain how Toolformer builds its training text by trying tool calls and keeping only the ones that help.
- Work out from the paper’s numbers whether a tool call passes the keep test.
- Say what tools did for a 6.7-billion-parameter model on facts, sums and dates, and where they did not help.
- Name what later systems kept (tools described to the model, structured calls, the Model Context Protocol, or MCP) and what they replaced (the self-made training data).
The idea in short
Language models are poor at exact sums, cannot see events after their training text ends, and sometimes invent facts. Tools fix this: a calculator for sums, a search box for facts, a calendar for the date. Teaching a model when to use each tool normally needs people to write many examples, or a prompt built for one task.
Toolformer, a 2023 research model, taught itself. It tried tool calls inside ordinary text, ran them, and kept only the calls whose answers made the next words easier to predict. It then trained on that text. A model with 6.7 billion weights, the numbers a model learns, beat a model about 26 times larger on several tests. Later systems kept the idea of a model asking for tools, but teach it with examples written by people or by a stronger model instead.
The problem
This guide covers “Toolformer: Language Models Can Teach Themselves to Use Tools” (Schick and seven co-authors, 2023), a research paper from Meta AI. By 2023, large wrote fluent text, but they had gaps that more size did not close. The authors list five. A model cannot see events after its training text ended. It sometimes invents facts. It is weak with languages that have little text online. It does arithmetic badly, even though a pocket calculator does it perfectly. And it has no sense of what today’s date is.
The obvious fix is a tool: a program the model can ask for help, such as a calculator, a search engine, a translator or a calendar. The model writes a request in text, ordinary code runs it, and the answer comes back as text for the model to use. The hard part is teaching the model when to ask, what to ask and what to do with the answer. The paper sorts earlier work into two kinds. Some relied on large amounts of human labelling: people marked up places where a tool should be used. Others used a prompt built for one task, so the model was told in advance which tool to use and how. The first is expensive. The second only works where the designer already knew what the task needs.
The authors set four aims for their method. Tool use should be , meaning the model learns from signals in the text itself, with no people labelling examples. The model should lose none of its general language skill. It should decide for itself when and how to use each tool. And the tools should not be tied to one task.
The model they built is called Toolformer. It starts from GPT-J, an open language model with 6.7 billion (the learned numbers inside it, also called weights). So the question is: can a model of that size teach itself to use tools, starting from only a few hand-written examples of each tool?