Supervised fine-tuning
Tool-calling agents
How do I fine-tune a model to call my tools reliably?
Train on traces of successful tool sequences from your own system. The failure mode worth fixing is not choosing the wrong tool — it is malformed arguments and calls made in the wrong order, and both are highly learnable.
| Objective | Supervised fine-tuning |
|---|---|
| Dataset shape | User goal, tool definitions, and the full sequence of calls and results that achieved it. |
| Metric that decides it | Task completion rate end to end, plus argument validity per call. |
| Cheapest starting point | LFM2 1.2B on RTX 3080$0.09 per GPU-hour |
Agent reliability collapses multiplicatively. A model that gets each individual call right ninety-five per cent of the time completes a five-step task about seventy-seven per cent of the time, and that is the number your users experience.
Fine-tuning on successful traces addresses this directly, because argument formatting and call ordering are exactly the kind of structure that transfers into weights well. It also shortens prompts substantially: tool definitions repeated on every request are a large recurring token cost.
The LFM2 models are built for this workload specifically, which makes them a better starting point at small sizes than a general model of the same parameter count.
The mistake to avoid
Training only on successful traces without any recovery examples. The agent has never seen a tool return an error and will not know that retrying with corrected arguments is an option.
Models to start from
In order. Start at the top and move down the list only if the evaluation gate says you have to — the smallest model that clears your bar is the one you pay for on every request forever.
Before you deploy it
Whatever the metric above says in isolation, the deployment decision is comparative: is this better than what is running today? Gate the candidate against the incumbent, blinded, on held-out cases from your own traffic. A fail is a cheap answer to an expensive question.
Frequently asked questions
Do I still send tool definitions at inference?
Send a shortened form. The fine-tune learns the shapes, so names and one-line descriptions are usually enough where the full schema was needed before.
What happens when I add a tool?
Adding one to a model tuned on a similar set usually works without retraining. Changing an existing tool’s arguments does not — retrain.
Start with LFM2 1.2B
Upload your dataset, read the validation report, and forecast the run before anything is leased.