Paper Breakdowns  /  Toolformer
Paper 30~8 min readMeta · 2023
Paper Breakdown

Toolformer,
explained.

A language model can write a sonnet about arithmetic and then get 17 × 24 wrong. It's fluent, but it has no calculator, no clock, no search bar — it only predicts words. Toolformer's idea was to hand it those things and, remarkably, to let it figure out on its own when to reach for them. No human labeling when to call a tool — the model learned that by asking a simple question: does calling this actually help me predict what comes next?

Video breakdown
The animated walkthrough is in production.
Read the full breakdown below in the meantime ↓
01

What language models can't do alone

An LLM is a next-word predictor trained on frozen text. That makes it brilliant at language and unreliable at anything text-prediction doesn't guarantee: exact arithmetic (it approximates rather than computes), current facts (its knowledge stops at training time), precise lookups, and faithful translation. It will confidently produce a plausible-but-wrong number or an out-of-date fact.

Humans solve this by using tools — we reach for a calculator, a search engine, a reference. The obvious fix is to let the model do the same: call an external system that's actually correct at the thing the model is bad at. The hard part isn't the tools; it's teaching the model when to call them and what to ask, without hand-annotating thousands of examples.

02

The idea: put the call in the text

Toolformer's trick is beautifully simple: represent a tool call as just more text. Interrupt the generation with a special API-call notation, run the tool, splice its result back into the sequence, and carry on. To the model, a calculator call is a token pattern like any other — something it can learn to produce in the right spot.

A tool call, inline in the text
The population grew from 200 to [Calculator(200 × 1.5) → 300] people by 1990.

Because the call and its result live inline, the model reads the tool's answer as ordinary context and predicts the following words with it in hand. This framing means no new architecture is needed — teaching tool use becomes teaching the model to generate the right call text at the right moment, which is exactly what fine-tuning on the right examples can do.

03

The self-supervised filter

Where do the training examples come from if humans don't label them? This is the paper's real contribution. Toolformer generates its own data and keeps only what helps, judged by a single, elegant criterion: does the tool's result make the next words easier to predict?

Concretely, at many positions in ordinary text the model proposes candidate API calls. Each candidate is actually executed to get a real result. Then it checks: with the call's result inserted, is the model's loss on the subsequent tokens lower than it was without the call (or with a call whose result was withheld)? If the result genuinely helps prediction, the call is useful and is kept; if not, it's discarded. No human ever says "call the calculator here" — reduced prediction loss is the automatic label.

The key insight

"Was this tool call worth it?" gets an objective answer: keep the call only if seeing its result lets the model predict what follows more accurately. Usefulness becomes measurable, so tool-use training data can be generated without any human annotation.

04

The three-step recipe

Put together, the method is a self-improving loop that starts from just a few hand-written example calls per tool:

1
Sample. Using a few examples, prompt the model to insert candidate API calls at many places in a large text corpus.
2
Execute & filter. Run each candidate call, and keep only those whose result lowers the loss on the following tokens.
3
Fine-tune. Fine-tune the model on this filtered dataset of useful calls, so it learns to call tools on its own.

The result is a model that, at inference, spontaneously emits an API call when it would help, pauses to let the tool run, reads the result, and continues — all learned, all self-supervised, from a tiny seed of examples.

05

The tools it learned

The paper equipped the model with five external systems, each an antidote to a known LLM weakness:

ToolFixes
Calculatorexact arithmetic
Search / Wikipedia + QAfacts & up-to-date knowledge
Machine translationother languages
Calendardate-aware queries ("today")

Each is something the model is unreliable at but a purpose-built system nails. And nothing about the method is specific to these five — any capability you can wrap in a simple API could, in principle, be learned the same way.

06

The results

Toolformer substantially improved zero-shot performance on tasks that lean on its tools — math word problems, factual question answering, and multilingual queries — often letting a modest-sized model beat much larger models that had no tools. Critically, learning to use tools didn't degrade its core language ability; it stayed a fluent language model that had simply gained new reach.

The demonstration mattered more than any single benchmark: it proved an LLM can be taught, without human supervision, to recognize its own limits and reach outside itself for help. That's a qualitatively different kind of capability from "predict the next word better."

07

The limits

Toolformer's tool calls are essentially one-shot and independent — it doesn't learn to chain tools, use one tool's output as another's input, or run an interactive multi-step loop. That sequential, compositional tool use is exactly what later agent frameworks (like ReAct) tackled. Each tool also needs a handful of seed examples and its own integration, so adding tools isn't free.

And the self-supervised filter, while clever, is a heuristic: "lowers next-token loss" is a proxy for "is genuinely useful," and the two can diverge. The method works cleanly for tools with crisp inputs and outputs, and gets murkier for tools whose value is diffuse or hard to score against text prediction.

08

Why it still matters

Toolformer is a foundational step toward the AI agents that now define the frontier. It established the core idea underneath function calling and tool-using assistants: a language model can autonomously decide when to invoke external software and what to ask it. Every agent that searches the web, runs code, queries a database, or calls an API is exercising the capability Toolformer showed could be learned.

Its self-supervised angle is the lasting lesson — you don't have to hand-label tool use; let the model generate candidate calls and keep the ones that measurably help. Combined with reasoning (chain-of-thought) and interactive loops (ReAct), tool use turned the LLM from a closed oracle into an open system that can act on the world. Toolformer is where "the model can reach outside itself" began.

Read next

Pair with ReAct (interleaving reasoning and actions into multi-step agents) and the AI agent system design to see where tool use leads.

Frequently asked

Quick answers

What is Toolformer?

A 2023 Meta model that learns, self-supervised, to call external tools — calculator, search, QA, translation, calendar — by inserting API calls into text and deciding for itself when and how to call them.

How does it learn without labels?

It proposes candidate API calls in text, executes them, and keeps only the calls whose results lower the model's loss on the following words. Reduced prediction loss is the automatic label.

Why do LLMs need tools?

They're weak at exact arithmetic, current facts, precise lookups, and translation — things a calculator or search engine does reliably. Tools offload those so the model stays fluent and correct.

What tools did it use?

A calculator, a search/Wikipedia + QA system, a machine-translation system, and a calendar — each fixing a known LLM weakness.

How does it relate to agents?

It's a direct ancestor of tool-using agents and function calling: it proved an LLM can autonomously decide when to reach outside itself for help.

Toolformer: Language Models Can Teach Themselves to Use Tools · Schick, Dwivedi-Yu, Dessì, et al. · Meta AI 2023 · read the original paper on arXiv → · Vibe Engines · 2026
Finished this one? 0 / 30 Paper Breakdowns done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Paper Breakdowns