Up nextNext guide
Client Confidentiality When Lawyers Use AI Tools
Society
Technical GUIDE
Toolformer is a 2023 Meta AI method that lets a language model teach itself when and how to call external tools like calculators, search engines, and translators.
Listen to this guideAI-narrated · ~2 min
Instead of humans labeling tool calls, the model generates and filters its own training examples, then fine-tunes on the ones that actually help.
Toolformer, from Schick et al. at Meta AI, tackles a paradox: large models are great at language but bad at arithmetic, fresh facts, and precise lookups. The training loop is self-supervised. The model is given a handful of human-written examples showing API-call syntax, then prompted to insert candidate calls (wrapped in special tokens) at many positions across a large text corpus. Each candidate call is actually executed, and the result is spliced in. The key filtering step keeps a tool call only if having the API result lowers the model's perplexity on the upcoming real text more than not calling, or calling differently. The model is then fine-tuned on this filtered, self-generated dataset, learning to invoke five tools: a calculator, a QA system, a search engine, a translator, and a calendar.
Calling a calculator API mid-sentence to get exact arithmetic instead of guessing a numeric answer.
Querying a search or QA system to fetch up-to-date or rarely-seen factual information.
Invoking a machine-translation tool to render a phrase in another language within generated text.
Using a calendar/date tool to resolve relative references like 'next Friday' to a concrete date.
Toolformer seeded today's tool-using and function-calling agents. The frontier is moving from a fixed handful of tools to dozens or hundreds discovered at runtime, with models reasoning about which tool to call, chaining calls, and handling failures. Expect tighter integration with reinforcement learning and agent loops, plus on-the-fly learning of new APIs, so that self-taught tool use becomes a standard capability rather than a specialized fine-tune.
Free newsletter
Three verified AI stories every weekday morning, written in plain English. Free forever, no ads.
One email each weekday. Unsubscribe in one click. We never sell or share your address.
Test yourself
Instant feedback on every answer, and a shareable certificate with a verifiable ID once you pass a course.
Support free AI education. AI Understanding is a 501(c)(3) nonprofit — no ads, no paywall, ever. Make a donation
Toolformer is a 2023 Meta AI method that lets a language model teach itself when and how to call external tools like calculators, search engines, and translators. Instead of humans labeling tool calls, the model generates and filters its own training examples, then fine-tunes on the ones that actually help.
Toolformer is self-supervised: the model proposes candidate API calls, executes them, and keeps only the helpful ones, without human annotation of correct usage.
A call is retained only if inserting its result lowers the model's perplexity/loss on the upcoming real text beyond a threshold, indicating it was genuinely useful.
Toolformer was trained to invoke five APIs: a calculator, a question-answering system, a search engine, a machine translator, and a calendar.
Candidate calls and their returned results are inserted inline into the text using special tokens, so the model learns placement and arguments together.
Despite strong language skills, LLMs struggle with exact arithmetic, up-to-date facts, and precise information retrieval, which external tools can supply.
Keep learning
More guides picked for this topic
Up nextNext guide
Client Confidentiality When Lawyers Use AI Tools
Society