LLM Architecture Refresh [9]: Teaching a Small Model to Call Tools
A language model can't run a calculator or open a calendar. It writes text, and a program reads it. In this post I look at what a tool call is, how a program checks one without a person, how well small Qwen2.5 models call tools before any training, and what supervised fine-tuning on ToolACE's demonstrations changes, on a base model that can't call yet and on an instruct model that can, measured against a control trained on random calls so the format can be told apart from the skill.
My highlights: key concept insight takeaway pitfall open question try this. The notes beside them are my own asides; on a phone, tap note to read one.
Before a reward, a call
In post 8, I explored how to train a language model using rewards instead of correct answers. I used Qwen2.5-0.5B-Instruct to solve two-digit multiplication problems. For each question, the model wrote eight answers, and a simple program checked whether each one was right. GRPO (Group Relative Policy Optimization) then used those scores to push the model toward the answers that beat their group’s average.
One lesson from that experiment kept coming back to me: reinforcement learning (RL) needs something to work with. If the model never writes a right answer, there’s nothing to reinforce. And if all eight answers get the same score, GRPO has no difference between them to learn from (post 8 §2, §4).
That led me to my next experiment. Can I teach a small language model to use tools, and then improve its tool calling with reinforcement learning? Before jumping into RL, though, I wanted to understand what the model could already do, and how much supervised fine-tuning (SFT), training it on example conversations that show good tool calls, could help. That was the plan at the end of post 8, and this post is that first step.
A tool is a program the model can ask to have run for it: a calculator, a contact list, a calendar, a document search. When we talk about tool calling, it can sound as though the model is running code itself. That’s not quite what happens. The tools are described in the prompt, the model writes a reply naming a tool and the values to give it, its arguments, and a separate program runs the tool. If I ask “What is 348 times 27?”, the model can write a call to a calculator tool with the expression 348 * 27. The calculator does the multiplication, not the model.
This sounds simple, but getting a tool call right involves several decisions:
- Should it call a tool at all? Sometimes the right response is to answer directly, or to decline because none of the tools offered fits.
- Which tool? When several are offered, the model has to pick the one that matches the request.
- What arguments? It has to pull the right values out of the request and write them in the form the tool expects.
I wanted to measure these separately rather than treat tool calling as a single accuracy number, and to check every call with a program rather than a person.
The first surprise came before I trained anything. The model I picked, Qwen2.5-1.5B-Instruct, already wrote well-formed calls and almost always chose the right tool. Its biggest weakness was filling in the arguments. That changed how I thought about the experiment. I wasn’t really teaching this model to call tools from scratch, since it already could. I was trying to improve a skill it had picked up in Qwen’s own training. So I added a second model: Qwen2.5-1.5B, the base model the instruct one was made from, before instruction tuning (the training that teaches a model to answer in a chat format). It never writes a call in the format the prompt asks for. That gave me two starting points, a model that already calls tools and one that doesn’t.
The short version
A tool call is text. The tool list goes into the prompt as text, the model writes a call as text, and a program parses it, runs the tool and writes the result back into the conversation, again as text (§1). Nothing in the model changes to make that happen.
A program can check a call two ways: compare it with a reference call written down in advance (exact match), or run both and compare what they return (execution match). Execution match forgives harmless differences, like 27 * 348 for 348 * 27, and it’s the check post 10 will use as its reward (§2).
Before any training, Qwen2.5-1.5B-Instruct gets 587 of our 1,000 test tasks right. On the 800 that need a call it’s right on 480, and none of its replies is a malformed call: its mistakes are wrong arguments (204), no call at all (104) and, rarely, the wrong tool (12). Where no tool fits, it declines on 107 of 200 and calls one anyway on the rest (§3).
On BFCL (the Berkeley Function Calling Leaderboard, a public benchmark) it’s right on 766 of the 900 items that need a call (the eval items: all but a slice held back for choosing the model), and on its 216 irrelevance items, where none of the offered tools fits, it declines 147 times; BFCL’s prompt here isn’t the leaderboard’s, so these aren’t leaderboard scores.
The training is supervised fine-tuning (SFT): showing the model conversations and training it to write the replies in them, here on ToolACE (Liu et al.), a public set of tool-calling conversations generated by language models (dataset on Hugging Face). Beside it I train a control: the same conversations with every call replaced by a call to a tool drawn at random from the row’s own list, with values copied from other rows. It keeps the format and breaks the link between the request and the call. Each trained model is compared with the untrained one: what SFT taught is read only from SFT against the untrained model, and the control shows what training on random calls does by itself (§4, §5). Both models train this way, the instruct model and the base model, each arm (SFT or the control) three times with different seeds (a seed sets a run’s random choices)“arm” means an experimental group or condition, a term commonly used in scientific experiments, especially randomized controlled trials, on one A100 GPU (40 GB) rented from Lambda’s cloud.
What did SFT teach the base model?
I started with Qwen2.5-1.5B, the base model, which hadn’t been instruction-tuned and never wrote a call in the format the prompt asks for. One obstacle was in its weights: the four special tokens that mark conversation turns and tool calls have nearly the same embedding, the vector the model reads for a token, so it can barely tell them apart. I trained those four embeddings along with the LoRA adapters (LoRA is low-rank adaptation: small trainable matrices added beside the model’s frozen weights, post 6) (§4).
Untrained, it never put a call between the <tool_call> tags the prompt asks for, but it sometimes wrote a call’s JSON, the plain-text form a call is written in (§1), without them. To give it credit for those, I scored the base model tag-free, without requiring the tags. Even read that way, it got only 12.3% of our tasks that need a call right. After SFT it got 86.6%, 74.3 points more, with an interval (the range the gain could plausibly move over, from resampling the tasks) of [+71.4, +77.3]. That passed the test I fixed before training, a gain whose interval excludes 0, so the base model is the clearest example of what SFT can teach (§5).
The BFCL results were encouraging, 7.1% of its call items right untrained and 32.3% after SFT, but I noticed an interesting pattern. BFCL sorts its items by how many functions it offers and how many calls it expects: simple offers one function and expects one call, parallel offers one and expects several calls in one reply, multiple offers several and expects one call, and parallel_multiple offers several and expects several (§2 has BFCL’s own definitions).
When several functions were offered, SFT improved right answers a lot: on the multiple category they rose from 22.2% to 69.3%, and on parallel_multiple from 0.0% to 65.9%.
When only one function was offered, the improvement was much smaller. Right answers barely moved on simple (6.7% to 8.0%) and parallel (0.0% to 10.2%).
This surprised me. Why would a model learn to choose among several functions but still struggle when there’s only one? The answer most likely has more to do with how I prepared the training data than with the model itself. I come back to it in §5.
There was also a downside. Before training, the base model declined on 84.0% of our tasks where no tool fits, mostly because it rarely called anything. After SFT it declines on 0.3%. SFT taught it to call, including when it shouldn’t.
What did SFT improve in the instruct model?
Next I trained Qwen2.5-1.5B-Instruct the same way. It already wrote well-formed calls and usually picked the right function, so I expected smaller gains, and that’s largely what happened (§5).
- Filling arguments improved most. On our 800 tasks that need a call, right rose from 60.0% to 90.0% on average over three training runs, and tasks with wrong arguments fell from 25.5% to 8.4%. The random-call control got worse at filling, with wrong arguments on 34.4%, so the gain came from learning which values go with which request rather than from practice writing calls.
- Calling when a call is needed. Tasks with no call fell from 13.0% to 0.6%, and the control fell just as far, to 0.5%. The model didn’t need right examples for this: training on conversations with calls of any kind was enough.
- Choosing the tool was already strong. Before SFT it picked the right tool on 98.3% of the calls it wrote (a share of its calls, not of all tasks), and SFT didn’t change that on our tasks. On BFCL, wrong function or wrong number of calls fell slightly, from 3.1% to 1.9%.
Are the models ready for reinforcement learning?
Before moving on to GRPO, I wanted to check whether the models write a mix of right and wrong calls. As I learned in post 8, GRPO needs the rewards within a group to differ: if all eight answers are right, or all are wrong, there’s no difference to learn from.
To test this, I sampled eight replies per task at temperature 1, which draws each token at random from the model’s probabilities, so the replies to one task can differ (Setup). Then I counted how often a task that needs a call got both right and wrong ones, a mixed group. The two models showed very different patterns:
- Instruct model. Before SFT, 49.3% of these tasks gave a mixed group. After SFT, that dropped to 31.5%, 31.8% and 27.0% across the three training runs, mostly because tasks became right on all eight tries.
- Base model. Before SFT, only 6.0% of tasks gave a mixed group. After SFT, that rose to 42.5%, 49.3% and 43.0%, mostly tasks it used to get wrong every time now coming out right on some tries.
The control, trained on random calls, is all wrong almost everywhere for both models.
That makes the SFT-trained base model particularly interesting for the next experiment: it has learned how to call tools, but still makes enough mistakes for reinforcement learning to potentially improve it (§6).
So why not skip SFT and apply RL directly to the instruct model? That’s a reasonable option. The untrained instruct model already writes calls in the right format, and it has as many mixed groups as any trained model here, 49.3% of the tasks that need a call (the base model’s second SFT run ties it). SFT made it better at filling arguments but left it fewer tasks to learn from, while for the base model SFT is what makes RL possible at all. The two starts ask different questions: can RL improve a model that already calls tools, and can RL build on a skill SFT has just taught? The results here don’t say which will gain more from RL, and a higher share of mixed groups doesn’t by itself mean a bigger gain. That’s something I’ll need to measure, and what’s next lays out the starting points.
What got worse?
Despite these improvements, SFT also brought problems I didn’t expect (§5).
- The model became too eager to call tools on our test set. When none of the available tools fit, the untrained instruct model still made a call 46.5% of the time. After SFT, that rose to 77.7%. In one training run, the model correctly declined on only 4 of 200 tasks. So while SFT helped the model call tools more consistently, it also made it less likely to recognize when a tool wasn’t needed.
BFCL accuracy dropped sharply. This was the most surprising result. Before training, the instruct model was right on 85.1% of BFCL’s items that need a call. After SFT, that fell to 51.3%. The main problem wasn’t choosing the wrong tool or filling in wrong arguments. Instead, the model often didn’t make a call at all: it gave no call, or an unparseable one, on 41.9% of those items after SFT, and the random-call control on 41.3%.
Looking more closely, many of these replies said a required parameter was missing and asked the user for it. Across the three SFT runs, 639 replies named the missing parameter. Of those, at least 229 asked for information the question already gives, and another 284 for a parameter that’s optional.
- Interestingly, declining improved on BFCL. On BFCL’s irrelevance items, where no call is expected (no offered tool fits, or a needed value is missing; §2), declining is the right answer. After SFT, the instruct model declined on all 216 in every training run. The control was nearly identical, declining on 215, 216 and 215 across its three runs.
What confused me was the contradiction. On my own test set, SFT made the model more likely to call tools, even when it shouldn’t. But on BFCL, it often refused to call tools, even when it should.
Why would the same training produce such different behaviors? After digging into the failed replies and the training data, I found the explanation. It came from a decision I’d made when preparing the dataset, which I explain in §5.
Setup
The code is a project of its own, tinytools. Every number this post quotes is printed by one of its commands, and each block of output, a receipt as in post 8, names the file and function it comes from. Each block in a report carries a short label so you can find where it comes from. In r5d, for example, 5 is the post section the block serves (§5) and d marks it as that section’s fourth block. The Python function that prints it usually has the same name with an underscore in front, _r5d. A command’s saved output, every block it prints, is its capture. To run it:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
git clone https://github.com/bearbearyu1223/tinytools
cd tinytools
uv sync
uv run tinytools tasks # generate our tool tasks and count them
uv run tinytools check-demo # three calls, checked two ways
uv run tinytools prompt-view # §1's prompt, part by part (no model)
uv run tinytools reply-view # §1's reply beside the reference (no model)
uv run tinytools disagree-view # §3's replies where the two checks disagree (no model)
uv run tinytools bfcl-examples # §3's BFCL right and wrong replies (no model)
uv run tinytools toolace-overlap # §4's overlap of the training rows and the test sets
uv run tinytools toolace-stats # what's in ToolACE, and how it converts
uv run tinytools toolace-convert # write the converted rows
uv run tinytools sft-data # the two training sets: real and control
scripts/lambda.sh run milestone0 # Milestone 0, on a rented GPU (below)
scripts/lambda.sh run main # score, train 3 + 3 runs, report (§1-§6)
uv run tinytools sft-followup # §5's follow-ups, from the main run's saved replies
scripts/lambda.sh run base # the same for the base model (§4)
uv run tinytools sft-report --reading tagfree # §5's tag-free reading,
uv run tinytools sft-report --profile base --reading tagfree # from the saved replies
uv run tinytools sft-check --only rows --profile base # the embedding rows alone, on the Mac
uv run tinytools sft-data --variant onetool # the real set less its one-tool rows (§5)
scripts/lambda.sh run onetool # the one-tool rerun: 3 runs, scored
uv run tinytools sft-report --profile onetool # the rerun against the main run
Model selection. For this experiment I chose Qwen2.5-1.5B-Instruct, the instruct model, which I fine-tune with LoRA at rank 16 (post 6). The two candidates were it and Qwen2.5-3B-Instruct, and I also scored Qwen2.5-0.5B-Instruct, the model from post 8, as a reference point. 0.5B wasn’t a serious candidate because the chosen model carries into posts 10 and 11, where the tasks get more complex and take several steps.
Before training anything, I ran a cheap first evaluation, which I call Milestone 0, to help choose. It used a separate development set of tasks that no number in this post uses. My goal wasn’t simply to pick the most accurate model. I wanted the smallest model that could call tools but still had room to improve through reinforcement learning, so I fixed a rule before the run: some room left to improve, a mix of right and wrong answers for GRPO to learn from in post 10, and some right calls to build on (§3 has its four conditions).
No model met the whole rule, so the choice came back to me; §3 has the rule, the verdict and what picking 1.5B gives up.
Milestone 0 ran on one rented A100 GPU (40 GB, from Lambda), as the commands in tinytools/experiments/milestone0.toml, with a hard limit of 4 hours and a $10 cap. The runner shuts the machine down through Lambda’s cloud interface when the run ends, whether it succeeds or fails.
To see what SFT can teach a model that doesn’t call yet, I also train Qwen2.5-1.5B, the base model, the same way (§4).
A quick licensing note: 0.5B and 1.5B are Apache-2.0, while 3B is under the Qwen Research licence, “FOR NON-COMMERCIAL PURPOSES ONLY”, and anything derived from it that’s shared has to come with that licence and its notice (3B licence, linked from the model card).
Decoding and evaluation. I generate replies in two ways, as in post 8 §2:
- Greedy decoding always takes the most likely next token, so a prompt always gets the same reply. Every right-or-wrong score in this post is greedy.
- Sampling at temperature \(T = 1\) draws each token at random from the model’s probabilities, so replies to the same prompt differ. I sample 8 replies per task to see how consistently the model gets it right, which is what GRPO needs: it learns only from tasks where some replies are right and some wrong. Sampling is used only for that count, in Milestone 0’s rule and in §6.
Every reply comes from one engine, tinytools’ batched generation (tinytools/src/tinytools/engine.py), on one A100 GPU in bfloat16 (a 16-bit number format), 64 sequences at a time. I used my Mac only to build the datasets and re-check saved replies, so every reply in this post was written on the A100 and no comparison mixes Mac and GPU numbers.
Table of Contents
The short version above has the findings without the derivations.
- What a tool call is
- Checking a call, and the two test sets
- How well it calls tools before training
- What SFT trains, and the control
- What SFT changed
- Is it ready for a reward?
Then what I learned, what’s next and all notation at the end.
1. What a tool call is
A tool call has three parts: a list of tools in the prompt, a call the model writes, and a program that reads the call and does what it says. Only the middle one is the model’s.
Both the list and the call are written in JSON, a plain-text format for nested data: names in double quotes paired with values, inside curly braces, like {"name": "calculator"}, with lists in square brackets. Each tool in the list is described by a schema: its name, a sentence on what it does, and its parameters, the values it takes, each with a type (a string of text, an integer, a list) and a description, plus which ones are required. The values the model fills in for a particular call are its arguments. A function is the same thing as a tool here; the papers and Qwen’s documentation use both words.
The prompt is assembled by the model’s chat template, the markers an instruct model was trained with that wrap each turn of a conversation (post 8 §1). Qwen2.5’s template has a tool-calling form: the tool list goes into the system turn, between <tools> and </tools>, and the model is asked to write each call as JSON between <tool_call> and </tool_call> (Qwen docs, function calling). Those angle-bracket pairs are XML tags, markers that open and close a stretch of text so a program can find it. Qwen’s technical report mentions “adding two new tokens for tool functionality” to the vocabulary, and the documentation says “Qwen2.5 were pre-trained with various types of templates that could support function calling” (Qwen2.5 report §2; Qwen docs). So the instruct model has seen this shape before anyone here trains it.That is why the instruct model can already do function calling.
Here’s one of our test tasks as the model reads it. It offers 3 tools: each task offers 3 to 5 of the 11 our task generator has, so the model has to choose (§2 lists them). It’s laid out part by part by cmd_prompt_view in tinytools/src/tinytools/cli.py. It’s a layout of the exact prompt, which the model reads with its turn markers in place of the labels and the tool list as one line of JSON per tool. Every byte of the real thing is in outputs/r1-prompt.txt, which _r1 writes when cmd_rescore re-checks the replies cmd_score saved for the untrained 1.5B model. In the layout each part sits under a label: [system], [user] and [assistant] stand in for the turn markers (<|im_start|> and the role, then <|im_end|>), and [tools] and [format] are the template’s text inside the system turn. Long lines are wrapped at spaces.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[system]
You are Qwen, created by Alibaba Cloud. You are a helpful assistant.
The current time is 2026-03-11 09:30, Wednesday.
[tools]
# Tools
You may call one or more functions to assist with the user query.
You are provided with function signatures within <tools></tools> XML
tags:
<tools>
line 1 of 3: the JSON of get_calendar_event
line 2 of 3: the JSON of calculator
line 3 of 3: the JSON of create_calendar_event (in full below)
</tools>
[format]
For each function call, return a json object with function name and
arguments within <tool_call></tool_call> XML tags:
<tool_call>
{"name": <function-name>, "arguments": <args-json-object>}
</tool_call>
[user]
Add "Coffee chat" to my calendar on the 4th of next month at 2:30pm
for three hours.
[assistant]
(empty: the model writes its reply from here)
cmd_prompt_view also counts the prompt’s tokens part by part, with part_tokens. Its last lines tie the counts to the score report’s “One task, whole” block, printed by _r1, which counted them first:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
part tokens
---------------------------------------------
turn markers 13
[system] 40
[tools] 421
the preamble before the list 32
the tool list itself 388
a token across the list's end 1
the blank line after the list 0
[format] 39
[user] 27
[assistant] 0
tokens across a part's edge 0
prompt tokens (indented rows aside) 540
Qwen2.5's tokenizer on the whole prompt; each token is counted in the
part it lies in. A part runs up to the next marker or part, so the
newlines the template puts between parts count with the part before
them. Turn markers: <|im_start|>, the role and its newline; <|im_end|>
and its newline. The indented rows split [tools]. The token across the
list's end is '>\n\n': the closing '>' of </tools> joined to the blank
line after it.
In r1's terms: the tool list is the 388; [tools] + [format] = 460, the
whole tools section; the token across the list's end is r1's 1
straddling token.
The prompt is 540 tokens, and 388 of them are the tool list: the JSON of three tools, between its <tools> tags. The whole tools section, [tools] and [format] together, is 460 tokens: the list plus the # Tools instructions around it. The request itself is one line near the end. The system turn also carries a frozen clock: every task pretends it’s Wednesday 2026-03-11 at 09:30, so “next month” has one right answer and a run next year scores the same.
The tool this task needs, create_calendar_event, is the third line of that list. cmd_prompt_view parses its JSON back out of the prompt and lays out its schema with param_table:
1
2
3
4
5
6
7
8
9
10
11
12
13
name create_calendar_event
description Add an event to the user's calendar.
parameter type required description
------------------------------------------------------------------------
title string yes The event's title.
date string yes The day, as YYYY-MM-DD.
start_time string yes Start time, 24-hour HH:MM.
duration_minutes integer no Length in minutes. Default 60.
attendees string array no Names of the people invited.
Parsed from the tool's JSON inside the prompt. The model reads it as one
line of JSON, exactly as in outputs/r1-prompt.txt.
Only title, date and start_time are required. Here’s the 1.5B Instruct model’s reply from the A100 run, laid out by reply-view (cmd_reply_view with replyview.py). It doesn’t load the model or generate anything new. It reads the reply the A100 run saved, the exact one that was scored, and redoes only the program’s part: parse it into a call, check it against the reference, and run the call:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
The model's reply, up to the end-of-turn token:
<tool_call>
{"name": "create_calendar_event",
"arguments": {"title": "Coffee chat", "date": "2026-04-04",
"start_time": "14:30", "duration_minutes": 180,
"attendees": []}}
</tool_call>
(one line in the reply; broken here after commas)
The call, parsed, beside the reference:
tool create_calendar_event create_calendar_event
argument model reference
title "Coffee chat" "Coffee chat"
date "2026-04-04" "2026-04-04"
start_time "14:30" "14:30"
duration_minutes 180 180
attendees [] (left out)
exact match no
execution match yes
outcome right
What the program writes back, as the next turn:
<|im_start|>user
<tool_response>
{"created": {"id": "evt-079", "date": "2026-04-04",
"start_time": "14:30", "duration_minutes": 180,
"title": "Coffee chat", "attendees": []}}
</tool_response><|im_end|>
(one line in the turn; broken here after commas)
The model wrote a well-formed call to the right tool and worked out both values the request leaves implicit: “the 4th of next month” became 2026-04-04 and “three hours” became 180 minutes, as in the reference. It also added an empty attendees list that the reference leaves out (the table’s last row), which is why one check says no and the other yes; §2 explains both. The program would have run the call just as readily with the wrong date. It parses the text, which means reading it into a structure it can use (a tool name and a set of named arguments), runs create_calendar_event with exactly those arguments, and writes the result back into the conversation as a new turn (Qwen2.5’s template puts it in a user turn), between <tool_response> tags, for the model to read next.
One call’s round trip. Every arrow between the program and the model carries text, and the model’s only part is the reply in box 2. This one is right by execution match but not by exact match, because it adds an empty attendees list the reference leaves out.
Training a model to call tools changes the reply in box 2 and nothing else, which is why the same SFT as posts 6 and 7 and the same GRPO as post 8 apply without new machinery. This post stops after one call. Feeding results back for a second step is post 11’s.This post stops at box 2 in the diagram - we use SFT to teach the model to write the call in box 2 from the user’s request and the available tool list. The untrained model already picked the right tool almost every time; what SFT changed most was filling in the arguments (§5).
2. Checking a call, and the two test sets
Post 8’s reward worked because a program could check an answer: it read a number and compared it with the right product. A tool call needs the same kind of check, and there are two natural ones. Both compare the model’s call with a reference callNeed some study to understand how to generate the reference call., the call written down in advance as right for that task. On our tasks the generator writes it from the same values it fills into the request, so “the 4th of next month” in the request is already a date in the reference; BFCL ships its own accepted answers with each item.
Exact match compares the call itself with the reference: the same tool, the same arguments. A good exact match ignores differences that can’t change anything, like the order the arguments are written in. Execution match runs both calls and compares what they return. From cmd_check_demo in tinytools/src/tinytools/cli.py, with the checks themselves in tinytools/src/tinytools/checkers.py (exact_match and execution_match):
1
2
3
4
5
6
7
exact match: one call, the reference's tool, the same arguments
after normalizing argument order, number format (90 = 90.0) and
whitespace; an expression compares as a syntax tree.
execution match: one call, the reference's tool, run on fresh data;
no error, and the same result: searches return the same set,
a created event leaves the same calendar, numbers agree within
1e-06 relative (or 1e-09 absolute).
“An expression compares as a syntax treeAbstract syntax tree is used here for exact match comparison.” needs one more term. A program that parses code doesn’t keep its characters; it builds an abstract syntax tree (AST), the code’s structure as a tree: here, a multiplication with two numbers under it. Comparing trees instead of characters means spacing and redundant brackets can’t make two expressions differ. The Berkeley Function Calling Leaderboard (BFCL), the benchmark later in this section, uses the same tool to read calls written as Python: it “extract[s] function names and parameters through Python’s ast module”, and “A function call is correct if the function name matches exactly and if all parameter values fall within their respective possible answers” (Patil et al. §4.1).
Here’s what that looks like for one calculator expression written five ways, from the same cmd_check_demo (the trees drawn by exprtree.py). The verdicts come from exact match itself:
1
2
3
4
5
6
expression its tree exact match vs 348 * 27
348 * 27 BinOp(348, Mult, 27) same
348*27 BinOp(348, Mult, 27) same: spacing is gone
(348) * 27 BinOp(348, Mult, 27) same: brackets are gone
348.0 * 27 BinOp(348, Mult, 27) same: 348.0 becomes 348
27 * 348 BinOp(27, Mult, 348) different: swapped
Swapping the operands is where the two checks part ways, again from cmd_check_demo:
1
2
3
4
5
6
7
8
9
10
11
12
13
request:
What is 348 times 27?
reference call:
{"name": "calculator", "arguments": {"expression": "348 * 27"}}
the call checked:
{"name": "calculator", "arguments": {"expression": "27 * 348"}}
exact match no
execution match yes
reference's result:
{"result": 9396}
this call's result:
{"result": 9396}
execution match compared 9396 vs 9396
27 * 348 is a different tree from 348 * 27, so exact match says no, and both return 9396, so execution match says yes.This is the limitation of exact match; but potentially we have a way to deal with this limitation (e.g., define operator where the order does not matter, like * and +) In the figure it sits between the demo’s other two calls: one that passes both checks despite a different argument order, 90.0 for 90 and a doubled space, and a search that fails both.
Execution match forgives differences that exact match punishes, like swapped operands, but a search only passes if it returns exactly the reference’s documents.
The third call is the one that matters for post 10. “sales report” does find the Q3 report, along with three others, and a lenient check would pass it. Execution match is going to be a reward, and a reward gets optimized: if a broad search scored as well as a precise one, training could learn to search broadly. So a search passes only if it returns the same set of results, and a call that changes something, like creating an event, is compared by the calendar it leaves behind, with the data reset before every call. Execution match is this post’s headline number, and exact match is printed beside it. On the untrained model’s 1,000 test replies the two disagree on only 9, all harmless: a calculation written another way, or an empty attendees list the reference leaves out (§3 lists them).
Training uses ToolACE, a public set of tool-calling conversations (§4), and testing uses two sets whose requests never appear in the training data, our own tasks and the public BFCL benchmark, both described next. Some of ToolACE’s tools do look like ours, though (§4 counts them).
Our tasks
The tools run on fixed, made-up data: contacts, calendar events and documents, all written by the task generator. From cmd_tasks in tinytools/src/tinytools/cli.py, with the generator in tinytools/src/tinytools/tasks.py:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
contacts 90
with a tricky spelling 30
calendar events 78
first and last day 2026-02-23 to 2026-04-24
documents 80
tools that run 5
calculator
search_contacts
get_calendar_event
create_calendar_event
search_documents
distractors (schema only) 6
send_email
delete_calendar_event
get_weather
set_reminder
get_stock_price
translate_text
A distractor is offered like any tool but is never the answer.
A few of those records, as the tools hold them, from cmd_tasks again, laid out by example_lines in data_examples.py:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
contacts (3 of 90: the first two, and the first with a tricky spelling)
id name team email phone tricky spelling
c-001 Maria Garcia Design maria.garcia@example.com +1-555-215-6190 no
c-002 David Chen Marketing david.chen@example.com +1-555-966-0454 no
c-061 Jon Smith Finance jon.smith@example.com +1-555-565-7004 yes
calendar events (2 of 78)
id date start minutes title attendees
evt-001 2026-02-23 10:00 60 Weekly planning (none)
evt-002 2026-02-23 13:00 60 Usability testing Hannah Weber
documents (3 of 80)
id title updated
doc-001 Q1 sales report 2026-02-04
doc-002 Q2 sales report 2025-11-05
doc-003 Q3 sales report 2025-08-02
Jon Smith has a neighbour in the list, John Smith. A request names one of them, and the model has to copy that spelling exactly, because “John Smith” finds the other person and “Smith” finds both.That is why this sample is a tricky one.
The five tools that run are what the tasks are about. The six distractors have a schema like any tool’s, a name, a description and parameters (§1), but no code behind them: get_weather, for example, takes a city and a date, and there’s no weather data to look up. They’re offered so that picking a tool is a real choice, and a request that needs one of them is a task where no tool fits. The generator writes each request by filling the blanks in a sentence pattern, and the tasks come in three kinds.
Choose+fill tasks ask the model to pick the right tool from those offered and fill its arguments from a plain request. Tricky args tasks need an argument worked out rather than copied: a relative date like “the 4th of next month”, a unit to convert, or a name spelled the way the contact list spells it. No tool fits tasks ask for something only a distractor could do, and that distractor is left out of the tools offered, so the right answer is to make no call.The task categories and the strategy of curating training dataset are critical for model training.
The generator also deals the tasks into four separate piles, each kept for one job, so no score comes from tasks that were used to make a choice:
- test (1,000 tasks): the only pile this post reports scores on, before and after training.
- dev (200 tasks): used once, by Milestone 0 in Setup, to pick which model to train, so the choice never saw the test tasks.
- train (5,000 tasks): kept for post 10, where reinforcement learning trains on them. This post’s training data is ToolACE, not these.
- train-sample (500 tasks): a random sample of train, drawn with a fixed seed, that §6 uses to check whether the models, before and after training, are ready for reinforcement learning.
Every pile has the same 60/20/20 mix of task kinds: 60% choose+fill, 20% tricky args and 20% no tool fits (600, 200 and 200 of test’s 1,000). train-sample keeps it because it’s drawn kind by kind: 300, 100 and 100 tasks picked at random from train’s tasks of each kind. The tables below have one column per pile. The next three blocks come from the same cmd_tasks:
1
2
3
4
5
6
7
8
9
kind test dev train train-sample
----------------------------------------------
choose+fill 600 120 3000 300
tricky args 200 40 1000 100
no tool fits 200 40 1000 100
total 1000 200 5000 500
seed 0; train-sample is a seeded sample of train (§6's
ready-for-RL measurement, drawn from post 10's training split), the
same 60/20/20 mix.
The same counts by the tool each task needs. For a no-tool-fits task, the tool is the one the request would need, which is never offered:
| Kind | Tool the task needs | test | dev | train | train-sample |
|---|---|---|---|---|---|
| choose+fill | calculator | 120 | 24 | 600 | 45 |
search_contacts | 120 | 24 | 600 | 72 | |
get_calendar_event | 120 | 24 | 600 | 61 | |
create_calendar_event | 120 | 24 | 600 | 59 | |
search_documents | 120 | 24 | 600 | 63 | |
| tricky args | calculator | 50 | 10 | 250 | 28 |
search_contacts | 50 | 10 | 250 | 21 | |
get_calendar_event | 50 | 10 | 250 | 23 | |
create_calendar_event | 50 | 10 | 250 | 28 | |
| no tool fits | send_email | 34 | 7 | 167 | 16 |
delete_calendar_event | 34 | 7 | 167 | 22 | |
get_weather | 33 | 7 | 167 | 23 | |
set_reminder | 33 | 7 | 167 | 10 | |
get_stock_price | 33 | 6 | 166 | 13 | |
translate_text | 33 | 6 | 166 | 16 |
The printed block is in Validation and reproducibility.
Each task offers the model 3 to 5 tools, 4 on average. If a tool fits the request, it’s always one of them; the rest are there so the model has to choose. Most tasks offer at least one distractor among the rest: 939 of the 1,000 in test.The dataset curation strategy In the table, min, max and mean count the tools offered per task, and the last column counts the tasks offered at least one distractor (cmd_tasks again):
1
2
3
4
5
6
split min max mean with a distractor
-------------------------------------------------
test 3 5 3.98 939
dev 3 5 4.01 189
train 3 5 4.00 4738
train-sample 3 5 3.97 462
BFCL
The second test set is BFCL, a public benchmark for how well language models call tools. I picked it partly because two pieces of work this post leans on report on it: ToolACE, the training data in §4, and ToolRL, a paper on training tool calls with reinforcement learning (ToolACE, Table 2; ToolRL, Table 1). The other reason is that someone else wrote it. I wrote our tasks myself, so they could quietly suit my own choices; BFCL can’t.
It has five single-turn categories (one request, one reply), defined in the paper (Patil et al., App. C.2). The middle column is my plain reading, the last is BFCL’s own words:
| category | what the model has to do | in BFCL’s words |
|---|---|---|
| simple | call the one tool offered, once | “Single available tool, single function invocation” |
| multiple | pick the right tool from several offered, and call it once | “Multiple available tools, single function invocation” |
| parallel | call the one tool offered several times, in one reply | “Single available tool, multiple function invocations in a single turn” |
| parallel_multiple | call several different tools from those offered, in one reply | “Multiple available tools, multiple distinct functions called in parallel” |
| irrelevance | make no call | “Single or multiple available tools, but no function invocation is expected.” |
Multiple and parallel are easy to mix up. Multiple is about choosing: several tools are offered and one call is right. Parallel is about how many: several calls in one reply. Parallel_multiple asks for both at once.
An example makes them easier to keep apart. Take two made-up tools, get_weather and get_forecast (they’re mine, not BFCL items). Asked for the weather in Seattle with only get_weather offered, the model calls it once: simple. Offered both tools for the same request, it has to pick get_weather: multiple. Asked for the weather in Seattle and in Boston with only get_weather offered, it calls get_weather twice in one reply: parallel. Asked for Seattle’s weather now and its forecast for tomorrow with both offered, it calls each tool in one reply: parallel_multiple.
Irrelevance is the nearest BFCL has to our no-tool-fits kind, and broader. Besides requests no offered tool fits, it includes requests with a needed value removed, where the model was “expected to either ask a follow-up question to clarify the missing information or return an error message instead of making a function call” (Patil et al., App. B).
I use bfcl-eval 2025.12.17, the version the leaderboard says it evaluates with, and all items of those five categories. A seeded slice of each category is held back for Milestone 0, and the scores in §3 use only the rest, the eval items. BFCL’s model list has no Qwen2.5 entry (its Qwen handlers are registered for Qwen3 and QwQ models and a few community fine-tunes), so the prompts use Qwen2.5’s own template and BFCL’s checker scores the calls.
Irrelevance is also scored a little differently. BFCL counts a reply as a correct decline whenever no call can be decoded from it, so a reply that tries to call and garbles it still passes. I count any <tool_call> tag as calling anyway. §3 prints both counts.
Two test sets, because BFCL alone can’t show the skill carries over
What I want to know is whether SFT teaches the model to call tools in general, or only to call tools that look like its training data. BFCL alone can’t settle that. A model that just picked up ToolACE’s habits could still do well on it: ToolACE uses BFCL’s system prompt and a similar shape of request, and some of BFCL’s tools share a name with one of ToolACE’s (§4 counts them).
Our tasks are a stronger test of whether the skill carries over, though not necessarily a harder one. Their requests come from our own generator, they run on our own made-up data, and the system turn carries a frozen clock (§1): a fixed date and time, so a relative date like “the 4th of next month” has one right answer. Five of their eleven tools, the calculator, the three calendar tools and set_reminder, never appear by name in the training data, and the other six appear in at most 10 of its 8,504 rows each.
A name the model has never seen doesn’t make a tool new to it, though. A calendar tool under an unfamiliar name might still look a lot like tools it trained on. So a gain on our tasks shows the skill transferring to new tool names, schemas, request wording and data to run on. It can’t show that SFT taught the model something it had no way to pick up from ToolACE.
The two sets answer different questions. BFCL asks how the model does on an established benchmark; our tasks ask whether what it learned transfers to tools and data it hasn’t met in that form. If SFT helps on both, that’s better evidence it taught more than ToolACE’s habits.
3. How well it calls tools before training
Before training anything, I wanted to answer three questions:
- What can the model already do? Does it know how to call tools, or will SFT have to teach it from scratch?
- Where does it fail? Does it choose the wrong tool, write the wrong arguments, or call a tool when it shouldn’t?
- Which model should I train? It has to be capable enough to learn from, with room left to improve through SFT and, in post 10, reinforcement learning.
Qwen2.5-1.5B-Instruct already calls tools reasonably well. It rarely picks the wrong function. Its main problems are filling in the right arguments and deciding when a call is appropriate.
The answers to the first two questions are for 1.5B instruct, the model I ended up choosing (below).
A call can go wrong in several ways, and they say different things about what’s missing, so every reply gets exactly one outcome. On a task that needs a call:
| Outcome | What it means |
|---|---|
| no call | the reply has no <tool_call> tag at all |
| unparseable | it has the tag, but what’s inside doesn’t parse as a call |
| wrong function | it calls a tool the reference doesn’t, or misses one the reference has |
| wrong number of calls | the right tools, but too many or too few calls |
wrong arguments (bad args in the tables) | the right calls, with arguments the check rejects |
| right | the check accepts it |
Tasks where no tool fits are scored separately, with two outcomes: declined (no tag, which is right) and called anyway.
As in post 8 §2, producing a valid-looking answer isn’t the same as producing a right one. Here I go further and separate the misses into writing a call (no call, unparseable), choosing it (wrong function, wrong number of calls) and filling it in (wrong arguments), to see what the model still needs to learn.
Our tasks: it knows the format, but misses arguments
On our 800 test tasks that need a call, the 600 choose+fill and 200 tricky-args tasks of the test split (§2), the untrained 1.5B instruct model gets 480 right (60.0%).This is our baseline for Qwen1.5B-instruct model before any SFT.
How it fails is more interesting than the accuracy. None of its replies are unparseable, so whenever it opens a <tool_call> tag, what’s inside parses as a call. That fits the pre-training on function-calling templates quoted in §1. Only 12 replies choose the wrong function. The two biggest problems are wrong arguments (204 replies) and not calling at all (104 replies). It never makes the wrong number of calls, which makes sense on tasks that each need one call.
So SFT won’t be teaching this model to call tools from scratch. It already knows the format and usually picks the right function. What’s left to improve is how it fills in arguments, and when it decides to call.
The tricky-argument tasks show the weakness most clearly. The model gets 107 of 200 of them right (53.5%), against 373 of 600 choose-and-fill tasks (62.2%), although §1’s calendar task, one of the tricky ones, came out right. (The counts are in the table below.)
The other problem is knowing when not to call. On the 200 tasks where no offered tool fits, it declines 107 times and calls a tool anyway on the other 93, almost half. Qwen’s documentation warns about a neighbouring habit: “Sometimes, it will fabricate required function arguments instead of asking the user for input” (Qwen docs).
The replies come from cmd_score in tinytools/src/tinytools/cli.py, and the counts from cmd_rescore in the same file, which re-checks those saved replies with the current checkers, using the outcome rules in tinytools/src/tinytools/classify.py. _score_body prints both blocks. The second table in each counts replies that hit the token cap: generation stops after 512 new tokens, and a reply still going at that point is cut off. On our tasks no reply reached it.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
kind n no call unparse wrong fn wrong n bad args right
------------------------------------------------------------------------
choose+fill 600 83 0 6 0 138 373
tricky args 200 21 0 6 0 66 107
total 800 104 0 12 0 204 480
wrong fn: another tool; wrong n: the right tool, more than one
call; bad args: the right tool, arguments that fail execution
match; right: execution match.
kind hit token cap counted above as
----------------------------------------------
choose+fill 0 -
tricky args 0 -
total 0 -
hit token cap: the model's reply ran to max new tokens (Setup)
and was cut off there; it is counted in the table above.
1
2
3
4
5
6
7
8
9
10
11
12
kind n declined called anyway
--------------------------------------------
no tool fits 200 107 93
declined: no <tool_call> tag (right); called anyway: any tag.
kind outcome replies of which hit token cap
--------------------------------------------------------------
no tool fits declined 107 0
no tool fits called anyway 93 0
hit token cap: the model's reply ran to max new tokens (Setup)
and was cut off there. Cut off before any <tool_call> tag, it
counts as declined.
BFCL: higher scores, the same weak spot in arguments
BFCL tells a similar story, with higher accuracy. The model gets 766 of 900 call items right (85.1%), against 60.0% on our tasks.The model will have different results for different benchmark. These aren’t leaderboard numbers, though: the prompt is Qwen2.5’s own chat template (§2), not one the leaderboard uses, so a row here can’t be set beside a leaderboard row.
Call-needing tasks only, scored by each set’s own check: execution match on ours, BFCL’s checker on BFCL. The two sets differ in tools, requests and checks, so the gap doesn’t say which set is harder.
Wrong arguments are still the most common miss, 99 replies. But BFCL also tests several calls in one reply, which none of our tasks ask for. There the model makes the wrong number of calls 15 times in parallel and 7 times in parallel_multiple (par_multi in the tables), a mistake it never makes on our one-call tasks.
On BFCL’s 216 irrelevance items, its category where no tool fits, the model declines 147 times (68.1%), against 107 of 200 (53.5%) on our no-tool-fits tasks. BFCL’s own verdict is also 147, so none of the 69 replies that called anyway failed to decode.
The same model gets quite different numbers on the two sets, a reminder that one benchmark’s score doesn’t carry over to another, and part of why §2 keeps both.This is a very honest remark re all the various benchmarks. The gap fits our tasks being less like what the model has seen before, but nothing here shows that’s the cause: the tools, the requests and the checkers all differ between the two.
BFCL’s replies get the same outcomes, on the eval items only (§2). They come from cmd_bfcl_score in tinytools/src/tinytools/cli.py, and both blocks from cmd_bfcl_rescore in the same file, which re-judges those saved replies and keeps the eval items, with the scoring in tinytools/src/tinytools/bfcl.py (score and rejudge). _bfcl_body prints the irrelevance block:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
category n no call unparse wrong fn wrong n bad args right
----------------------------------------------------------------------
simple 360 1 1 0 0 32 326
multiple 180 0 0 2 0 23 155
parallel 180 0 4 0 15 15 146
par_multi 180 0 1 4 7 29 139
total 900 1 6 6 22 99 766
wrong fn: names differ as a set; wrong n: the right names, too
many or too few calls; bad args: the right calls, arguments the
checker rejects; right: BFCL's checker accepts the reply (BFCL's
accuracy on these categories).
category hit token cap counted above as
--------------------------------------------
simple 0 -
multiple 0 -
parallel 3 unparse 3
par_multi 1 unparse 1
total 4 unparse 4
hit token cap: the model's reply ran to max new tokens (Setup)
and was cut off there; it is counted in the table above.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
category n declined called anyway bfcl right
-------------------------------------------------------
irrelevance 216 147 69 147
declined: no <tool_call> tag (right); called anyway: any tag.
bfcl right: BFCL's own verdict, which also passes a reply whose
<tool_call> fails to decode (here it called anyway).
category outcome replies of which hit token cap
-------------------------------------------------------------
irrelevance declined 147 7
irrelevance called anyway 69 0
hit token cap: the model's reply ran to max new tokens (Setup)
and was cut off there. Cut off before any <tool_call> tag, it
counts as declined.
Here’s what those outcomes look like on real items: a right and a wrong reply for each call category, from the replies that run saved, with no model run. They come from cmd_bfcl_examples (laid out by bfclexamples.py), which rechecks each one with BFCL’s checker. First, how they’re picked, so nothing is hand-chosen:
1
2
3
4
5
6
7
8
9
10
11
12
13
right: the first right reply in BFCL's file order. wrong: the first
reply, in the same order, whose outcome is the category's most common
wrong outcome (a tie goes to the outcome listed first in the capture's
table).
category wrong replies most common wrong replies
----------------------------------------------------------
simple 34 wrong arguments 32
multiple 25 wrong arguments 23
parallel 34 wrong number of calls 15
par_multi 41 wrong arguments 29
parallel: wrong arguments ties with wrong number of calls; wrong number
of calls comes first in the table.
simple, from the same cmd_bfcl_examples:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--------------------------------------------------------------------------
simple, right: simple_python_1
--------------------------------------------------------------------------
request:
Calculate the factorial of 5 using math functions.
functions offered math.factorial
the model's call:
math.factorial(number=5)
BFCL accepts, per argument:
number 5
outcome right
--------------------------------------------------------------------------
simple, wrong: simple_python_13
--------------------------------------------------------------------------
request:
Calculate the area under the curve y=x^2 from x=1 to x=3.
functions offered calculate_area_under_curve
the model's call:
calculate_area_under_curve(function="lambda x: x ** 2", interval=[1, 3])
BFCL accepts, per argument:
function "x**2" or "lambda x: x**2" or "y=x**2"
interval [1.0, 3.0]
method (may be left out) or "trapezoidal"
outcome wrong arguments
bfcl error type type_error:nested
the first argument BFCL rejects interval
BFCL's message:
Nested type checking failed for parameter 'interval'. Expected outer
type array with inner type <class 'float'>. Parameter value: [1, 3].
multiple, from cmd_bfcl_examples too:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--------------------------------------------------------------------------
multiple, right: multiple_0
--------------------------------------------------------------------------
request:
Can I find the dimensions and properties of a triangle, if I know its
three sides are 5 units, 4 units and 3 units long?
functions offered triangle_properties.get,
circle_properties.get
the model's call:
triangle_properties.get(side1=5, side2=4, side3=3, get_area=True, get_perimeter=True, get_angles=True)
BFCL accepts, per argument:
side1 5
side2 4
side3 3
get_area (may be left out) or True
get_perimeter (may be left out) or True
get_angles (may be left out) or True
outcome right
--------------------------------------------------------------------------
multiple, wrong: multiple_10
--------------------------------------------------------------------------
request:
I need to delete some columns from my employees database on
personal_data table. I want to remove their email addresses and social
security numbers to respect privacy.
functions offered database.modify_columns,
database.create_backup
the model's call:
database.modify_columns(db_name="personal_data", table="employees", operation="delete", columns=["email", "ssn"])
BFCL accepts, per argument:
db_name "employees"
table "personal_data"
operation "delete"
columns ["email", "ssn"]
or ["ssn", "email"]
or ["email", "social_security_number"]
or ["social_security_number", "email"]
or ["email", "social security number"]
or ["social security number", "email"]
outcome wrong arguments
bfcl error type value_error:string
the first argument BFCL rejects db_name
BFCL's message:
Invalid value for parameter 'db_name': 'personal_data'. Expected one
of ['employees']. Case insensitive.
parallel, again from cmd_bfcl_examples:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
--------------------------------------------------------------------------
parallel, right: parallel_0
--------------------------------------------------------------------------
request:
Play songs from the artists Taylor Swift and Maroon 5, with a play
time of 20 minutes and 15 minutes respectively, on Spotify.
functions offered spotify.play
the model's calls:
spotify.play(artist="Taylor Swift", duration=20)
spotify.play(artist="Maroon 5", duration=15)
BFCL accepts, per argument:
call 1: spotify.play
artist "Taylor Swift"
duration 20
call 2: spotify.play
artist "Maroon 5"
duration 15
outcome right
--------------------------------------------------------------------------
parallel, wrong: parallel_9
--------------------------------------------------------------------------
request:
Find two movie theatres near San Diego with availability for Tenet at
5 pm and No Time To Die at 7:30 pm.
functions offered find_movie_showing
the model's call:
find_movie_showing(location="San Diego, CA", movie=["Tenet", "No Time To Die"], time=["5:00 pm", "7:30 pm"])
BFCL accepts, per argument:
call 1: find_movie_showing
location "San Diego" or "San Diego, CA" or "CA"
movie ["Tenet"]
time ["5 pm"] or ["17:00"]
call 2: find_movie_showing
location "San Diego" or "San Diego, CA" or "CA"
movie ["No Time To Die"]
time ["7:30 pm"] or ["19:30"]
outcome wrong number of calls
bfcl error type:
parallel_function_checker_no_order:wrong_count
calls 1 given, 2 expected
BFCL's message:
Wrong number of functions.
parallel_multiple (par_multi in the tables), also from cmd_bfcl_examples:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--------------------------------------------------------------------------
par_multi, right: parallel_multiple_0
--------------------------------------------------------------------------
request:
Find the sum of all the multiples of 3 and 5 between 1 and 1000. Also
find the product of the first five prime numbers.
functions offered math_toolkit.sum_of_multiples,
math_toolkit.product_of_primes
the model's calls:
math_toolkit.sum_of_multiples(lower_limit=1, upper_limit=1000, multiples=[3, 5])
math_toolkit.product_of_primes(count=5)
BFCL accepts, per argument:
call 1: math_toolkit.sum_of_multiples
lower_limit 1
upper_limit 1000
multiples [3, 5]
call 2: math_toolkit.product_of_primes
count 5
outcome right
--------------------------------------------------------------------------
par_multi, wrong: parallel_multiple_19
--------------------------------------------------------------------------
request:
Perform Gaussian integral of the function exp(-x^2) from -2 to 2. Also
calculate the definite integral from 0 to 3.1416 of sin(x).
functions offered math.gaussian_integral,
math.definite_integral
the model's calls:
math.gaussian_integral(function="lambda x: math.exp(-x**2)", lower_limit=-2, upper_limit=2)
math.definite_integral(function="lambda x: math.sin(x)", lower_limit=0, upper_limit=3.1416)
BFCL accepts, per argument:
call 1: math.gaussian_integral
function "exp(-x**2)" or "lambda x: exp(-x**2)"
lower_limit -2.0
upper_limit 2.0
call 2: math.definite_integral
function "sin(x)" or "lambda x: sin(x)"
lower_limit 0.0
upper_limit 3.1416
outcome wrong arguments
bfcl error type:
parallel_function_checker_no_order:cannot_find_match
the first argument BFCL rejects call 1, function
BFCL's message:
Could not find a matching function among index [0, 1] of model output
for index 0 of possible answers.
Invalid value for parameter 'function': 'lambda x: math.exp(-x**2)'.
Expected one of ['exp(-x**2)', 'lambda x: exp(-x**2)']. Case
insensitive.
Two of the wrong cases say as much about BFCL’s grading as about the model. simple_python_13 fails only because the model wrote the interval as whole numbers, [1, 3], where BFCL’s type check wants floats, [1.0, 3.0]. And multiple_10’s request, “my employees database on personal_data table”, can be read either way round: the model took personal_data as the database and BFCL’s answer takes employees. So some of BFCL’s wrong arguments are strict or debatable grading rather than real mistakes.
On the call categories, 4 replies ran to the token cap, 3 of them in parallel, and count as unparseable. On irrelevance, 7 of the 147 declines are replies cut off at the cap before they wrote any <tool_call> tag. They count as declined because the reply ran out before a tag, which isn’t the same as the model choosing not to call.
Before any training, the 1.5B model’s calls almost always parse and name the right tool. Its commonest miss on both test sets is wrong arguments, and where no tool fits it declines more often than it calls one anyway: 107 to 93 on ours, 147 to 69 on BFCL.
No candidate passed, so I chose 1.5B Instruct
Before training, I ran Milestone 0 (Setup) to decide which model to use for the rest of the experiment. It ran on data no published number uses: the 200 tasks of our dev split (the development set beside the test set in §2’s task table) and the 10% slice of each BFCL category held back from the eval items.
I wanted a model that met three requirements:
- Room to improve. It shouldn’t already solve nearly every task, or SFT would have little measurable effect.
- Enough signal for RL. Sampled 8 times at temperature 1 on the same task, it should sometimes give both right and wrong answers. A task where it does that is a mixed group. GRPO learns only from mixed groups, since a group that’s all right or all wrong gets no push (post 8 §4).
- A reasonable starting point. It should already solve some tool-calling tasks. A model that never calls leaves room everywhere, but gives training nothing to build on.
I turned these into four conditions, fixed before any of the numbers existed. Room to improve became two, one per test set, (a) on our tasks and (b) on BFCL; (c) is the signal for RL and (d) the starting point:
| What’s measured, on data held back for this choice | Passes if | |
|---|---|---|
| (a) | our 200 dev tasks, one greedy reply each: the share it gets right (execution match) | at most 70%, 140 of 200 |
| (b) | BFCL’s 100 dev items that need a call, one greedy reply each: the share BFCL’s checker marks right | at most 80%, 80 of 100 |
| (c) | our 160 dev tasks that need a call, 8 answers each sampled at temperature 1: the share of tasks where some of the 8 are right and some wrong (a mixed group) | at least 10%, 16 of 160 |
| (d) | the same 160 tasks, one greedy reply each: the share it gets right | at least 20%, 32 of 160 |
The rule picks the smaller of the 1.5B and 3B instruct models that meets all four. If neither does, it falls back to the base models (introduced at the top): base 1.5B, then base 3B. If none of them qualifies, it stops and hands the choice back to me.
None of them passed. 3B instruct was already too accurate on both sets’ dev data: 161 of 200 (80.5%) on our dev tasks, and 89 of 100 on BFCL’s dev calls. The base models never wrote a valid tagged call, so they had no right calls and no mixed groups. Their 40 of 200 in (a) are the 40 no-tool-fits tasks, where writing no call counts as right: a model that never calls meets (a) without being able to do anything. 1.5B instruct met three of the four conditions and missed only (b): it got 86 of the 100 BFCL dev calls right, above the 80% limit.
0.5B instruct, the model from post 8, met all four. But I’d ruled it out before the run as too weak for post 11’s tasks of several steps, so it was only a comparison row and the rule couldn’t pick it.
So the rule returned stop, and the choice came back to me. I chose Qwen2.5-1.5B-Instruct.
The trade-off is straightforward. At 86 of 100 on BFCL’s dev calls, only 100 − 86 = 14 calls are left for SFT to fix there. On our dev tasks it’s right on 121 of 200 (60.5%), which leaves far more room, and 68 of the 160 dev tasks that need a call (42.5%) give mixed groups, so post 10’s GRPO has something to learn from.
1.5B instruct was also my preferred choice before Milestone 0. The experiment didn’t validate every part of that preference; it showed exactly which requirement I was choosing to relax.
Here is every scored model against each condition, and the verdict, from _print_rule and verdict in tinytools/src/tinytools/milestone0.py:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
(a) our dev tasks, greedy, right by execution
model role count needs met
----------------------------------------------------------------
1.5B instruct candidate 121 of 200 (60.5%) <= 70% met
3B instruct candidate 161 of 200 (80.5%) <= 70% not met
1.5B base fallback 40 of 200 (20.0%) <= 70% met
3B base fallback 40 of 200 (20.0%) <= 70% met
0.5B instruct comparison 93 of 200 (46.5%) <= 70% met
(b) BFCL dev slice, call categories, greedy right
model role count needs met
---------------------------------------------------------------
1.5B instruct candidate 86 of 100 (86.0%) <= 80% not met
3B instruct candidate 89 of 100 (89.0%) <= 80% not met
1.5B base fallback 0 of 100 (0.0%) <= 80% met
3B base fallback 0 of 100 (0.0%) <= 80% met
0.5B instruct comparison 64 of 100 (64.0%) <= 80% met
(c) call-needing dev tasks, mixed groups of 8 at T=1
model role count needs met
---------------------------------------------------------------
1.5B instruct candidate 68 of 160 (42.5%) >= 10% met
3B instruct candidate 44 of 160 (27.5%) >= 10% met
1.5B base fallback 0 of 160 (0.0%) >= 10% not met
3B base fallback 0 of 160 (0.0%) >= 10% not met
0.5B instruct comparison 87 of 160 (54.4%) >= 10% met
(d) call-needing dev tasks, greedy, right by execution
model role count needs met
----------------------------------------------------------------
1.5B instruct candidate 100 of 160 (62.5%) >= 20% met
3B instruct candidate 130 of 160 (81.3%) >= 20% met
1.5B base fallback 0 of 160 (0.0%) >= 20% not met
3B base fallback 0 of 160 (0.0%) >= 20% not met
0.5B instruct comparison 73 of 160 (45.6%) >= 20% met
model role (a) (b) (c) (d) qualifies
----------------------------------------------------------
1.5B instruct candidate met not met met no
3B instruct candidate not not met met no
1.5B base fallback met met not not no
3B base fallback met met not not no
0.5B instruct comparison met met met met yes
verdict stop
stop: no candidate or fallback qualifies; bring it to the author
The base models never wrote a valid tagged call
Why did the base models fail so completely? Neither has a single right call or mixed group on the 160 dev tasks that need a call, and the 40 of 200 each gets right in (a) are the 200 − 160 = 40 no-tool-fits tasks, where writing no call is right. 1.5B base’s replies, from _print_model (3B base’s table is the same):
1
2
3
4
5
6
7
8
1.5B base (fallback): Qwen/Qwen2.5-1.5B
--------------------------------------------------------------------------
Our dev tasks, greedy: replies by outcome
kind n no call unparse wrong fn wrong n bad args right
------------------------------------------------------------------------
choose+fill 120 120 0 0 0 0 0
tricky args 40 40 0 0 0 0 0
total 160 160 0 0 0 0 0
1.5B base’s replies run on instead, until generation stops at the 512-token cap. It hit the cap on 199 of its 200 greedy replies on our dev tasks (same model block, _print_model):
1
2
3
4
5
6
Wall clock (varies run to run)
pass items s/item new tokens/item hit token cap
------------------------------------------------------------
ours greedy 200 0.43 510 199
ours x8 200 2.90 3155 1004
bfcl greedy 124 0.64 504 121
That doesn’t necessarily mean the base models can’t write a call. In the base model, the token that ends a turn and the token that opens a call have nearly the same embedding, the vector the model reads for a token. This model also scores each possible next token with that same vector, so at any point in a reply the two tokens get almost the same score, whatever the context (§4 comes back to this). It also sometimes writes a call’s JSON with no tags around it, which the strict check counts as no call; §5 reads the base model both ways.
LoRA: less memory, and the starting model one switch away
The last decision was how to train it. A full fine-tune updates every weight in the model; LoRA freezes them and trains small low-rank adapter matrices beside them (post 6), here at rank 16 on every attention and MLP (feed-forward) projection. Milestone 0 timed a few training steps of each on one A100 GPU with 40 GB of memory, using rows from the real SFT set (§4); the full setup is under Validation and reproducibility.
On 1.5B, a LoRA step took 0.297 seconds, and the GPU memory it used peaked at 21.9 GB (the most PyTorch had allocated at any point in training), against 0.340 seconds and a 28.8 GB peak for the full fine-tune. LoRA trained 18.5M parameters instead of all 1543.7M.
The speeds are close, so the rest settles it. LoRA leaves more memory to spare while training (only its adapter’s 18.5M parameters need gradients and optimizer state; for generating replies it saves nothing, and adds almost nothing), it’s post 6’s method, and switching the adapter off gives back the starting model. That’s the frozen copy GRPO measures drift against in post 10 (post 8’s reference model, unrelated to this post’s reference calls; post 8 §5), and LoRA gives it for free. So the post’s model is Qwen2.5-1.5B-Instruct with a rank-16 LoRA adapter.
Validation and reproducibility
These are the checks behind the numbers above, and what it takes to rerun them.
Our tasks by tool. The block behind the table in §2, from cmd_tasks:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
tool needed kind test dev train train-sample
---------------------------------------------------------------------
calculator choose+fill 120 24 600 45
search_contacts choose+fill 120 24 600 72
get_calendar_event choose+fill 120 24 600 61
create_calendar_event choose+fill 120 24 600 59
search_documents choose+fill 120 24 600 63
calculator tricky args 50 10 250 28
search_contacts tricky args 50 10 250 21
get_calendar_event tricky args 50 10 250 23
create_calendar_event tricky args 50 10 250 28
send_email no tool fits 34 7 167 16
delete_calendar_event no tool fits 34 7 167 22
get_weather no tool fits 33 7 167 23
set_reminder no tool fits 33 7 167 10
get_stock_price no tool fits 33 6 166 13
translate_text no tool fits 33 6 166 16
no tool fits: the tool the request needs, which is never offered.
Two checks on the same replies. Our tasks scored by execution match (run the model’s call and the reference call, then compare what they return) and by exact match (compare the calls themselves), both defined in §2, from _score_body, which prints all three of our tasks’ blocks for cmd_rescore:
1
2
3
4
5
6
7
8
kind right by execution right by exact match
---------------------------------------------------------
choose+fill 373 of 600 (62.2%) 373 of 600 (62.2%)
tricky args 107 of 200 (53.5%) 98 of 200 (49.0%)
no tool fits 107 of 200 (53.5%) 107 of 200 (53.5%)
total 587 of 1000 (58.7%) 578 of 1000 (57.8%)
The same replies, two checks. On no-tool-fits tasks both mean
declined.
Here are the 9 greedy replies of the untrained 1.5B model where the two checks disagree. disagree-view (cmd_disagree_view with disagreeview.py) lays them out from the replies that run saved, without running the model, and shows only the arguments that differ:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
execution match yes, exact match no 9 replies (below)
exact match yes, execution match no 0 replies
Only the arguments that differ are shown; the rest are the same.
calculator: the expression differs (7)
task reference model
test-0321 2162.09 * 75 / 100 0.75 * 2162.09
gives 1621.5675 1621.5675
test-0437 3438 * 48 / 100 0.48 * 3438
gives 1650.24 1650.24
test-0479 1481 * 64 / 100 64 * 1481 / 100
gives 947.84 947.84
test-0812 4396.3 * 81 / 100 81/100*4396.3
gives 3561.0029999999997 3561.003
test-0835 2242 * 31 / 100 31/100*2242
gives 695.02 695.02
test-0951 368 * 77 / 100 77 * 368 / 100
gives 283.36 283.36
test-0964 1062 * 68 / 100 0.68 * 1062
gives 722.16 722.1600000000001
2 pairs of results differ; execution match counts results within a
relative 1e-06 of each other as the same.
create_calendar_event: an argument the reference leaves out (2)
task argument reference model
test-0013 attendees (left out) []
test-0405 attendees (left out) []
both calls leave the same calendar
Every one is the kind of difference execution match is for: the same arithmetic written another way (two differ only in floating-point rounding), or an empty attendees list that leaves the same calendar, one of them §1’s coffee chat. The reverse never happens, as it shouldn’t: a call that matches the reference exactly also runs the same way.
The harness can give full marks. The harness is the code that builds each prompt and checks the reply. It’s checked by scoring two fixed answer sheets (from _score_body too): the reference calls themselves, which should get everything right, and a model that never calls, which should get only the no-tool-fits tasks right:
1
2
3
4
reference answers right (both) 1000 of 1000 (100.0%)
never calling right 200 of 1000 (20.0%)
reference answers: the harness can give full marks. never calling:
what declining every task scores (right on no-tool-fits only).
BFCL’s harness is checked the same way, by scoring BFCL’s own answers, written as Qwen-style calls (_bfcl_body):
1
2
3
4
5
6
7
8
9
category items reference passes
--------------------------------------
simple 360 360
multiple 180 180
parallel 180 180
par_multi 180 180
irrelevance 216 216
reference passes: BFCL's own answer, written in Qwen's format and
scored by the same checker (the harness can give full marks).
Token cap and rescoring. Two lines of the capture’s Setup, with the ten between them left out: _score_setup prints the limit, and cmd_rescore adds that our tasks’ blocks were re-checked from the saved replies:
1
2
max new tokens 512
checked by rescore of the saved replies
Greedy is repeatable. Greedy decoding has no randomness: at each step it takes the single most likely next token, so the same prompt should give the same reply every time. Only “should”, because a GPU adds numbers in parallel and doesn’t promise the same order each run. Floating-point sums in a different order can differ in the last digits, and when two tokens are almost tied, that can flip which one wins. Milestone 0 checks that this doesn’t happen on the GPU. It ran 1.5B instruct’s greedy pass over the 200 dev tasks twice, and all 200 replies came back byte-identical (_print_repeat):
1
2
3
4
5
6
model Qwen/Qwen2.5-1.5B-Instruct
tasks 200 of our dev tasks, greedy
replies byte-identical 200 of 200
outcomes that changed 0
Both passes ran in one process, one after the other; a second
process (a rerun of the command) is the stronger test.
The rule, as fixed before the run (_print_rule):
1
2
3
4
5
6
7
8
9
10
(a) our dev tasks, greedy, right by execution: at most 70%
(b) BFCL dev slice, call categories, right: at most 80%
(c) dev tasks that need a call, 8 samples at T=1, mixed
groups: at least 10%
(d) dev tasks that need a call, greedy, right by execution: at
least 20%
Tasks that need a call: choose+fill and tricky arguments (not
'no tool fits', where declining is right).
Pick the smaller of 1.5B / 3B instruct meeting all four; else
base 1.5B, then base 3B; else stop and bring it to the author.
The LoRA timing. The configuration and the full table behind the LoRA choice, from _probe, which run calls:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
rows data/sft/real.jsonl (8504 rows)
used 16, the first with 1024+ tokens
batch x sequence length 4 x 1024, no padding
scored tokens in those rows 1724
Each row is cut to its last 1024 tokens (its assistant turn is
at the end); masked tokens as in training (sft.py).
steps 1 warm-up + 3 timed
A step: forward, backward, AdamW update; timed after a sync.
dtype (weights, grads, optimizer) bfloat16
LoRA rank 16, alpha 32, attention + MLP
LoRA on q, k, v, o, gate, up and down in every layer.
gradient checkpointing off
model the instruct model of each size
size method trainable s/step peak GB loss, step 1
----------------------------------------------------------
1.5B LoRA r16 18.5M 0.297 21.9 0.583
1.5B full 1543.7M 0.340 28.8 0.583
3B LoRA r16 29.9M 0.503 31.9 0.623
3B full - - - -
3B full: out of memory
loss, step 1 is the training loss on the first batch, before any update: the model’s average cross-entropy on the tokens it’s trained to write (the assistant turn). LoRA leaves each weight matrix frozen and trains two small matrices beside it, A and B; what it adds to the weight is their product BA. B starts at zero, so BA starts at zero, and at step 1 the LoRA model computes exactly what the untrained model does (post 6). Both methods therefore start from the same model and should give the same loss, and on 1.5B they do: 0.583 and 0.583. That’s a check that the two timings trained on the same rows, masked the same way.
Runs and versions. Milestone 0 was scripts/lambda.sh run milestone0, the commands in tinytools/experiments/milestone0.toml at tinytools commit a926140, on one A100 40 GB; it took 0.96 hours and cost $1.91 (the run record, tinytools/runs/ledger.csv). Every Milestone 0 block comes from cmd_milestone0 in tinytools/src/tinytools/cli.py, which runs run in tinytools/src/tinytools/milestone0.py, with the rule in the same file (verdict). The BFCL scores use bfcl-eval 2025.12.17, on every item of the five categories except the 10% slice of each held back for Milestone 0.
4. What SFT trains, and the control
SFT learns from examples, so it needs a control
The idea behind SFT is simple: show the model examples of requests and the right tool calls, and train it to write those replies. Each example here is a user’s request, the tools on offer, and the call the model should make. It’s post 8’s §1 again: raise the log-probs of the turns someone wrote as the answer, and here the answers are tool calls. Only the assistant’s turns are scored; the system turn with its tool list and the user’s request are masked, read as context but not scored, the same as the question was in post 8 §1.
That raises a question. If SFT makes the model better at calling tools, is it because the model learns which call a request needs, or only because it gets a lot of practice writing calls? Both would raise the scores.
To tell them apart, I train the same model in two arms, as in a trial. The real arm learns from ToolACE’s own calls. The control learns from random calls: the same prompts and the same format, but the call no longer follows from the request. If both arms improve about as much, much of the gain could be practice with the format. If the real arm improves more, that’s evidence the model learned to connect a request to the right call.
The data: ToolACE
ToolACE is a public set of tool-calling conversations, made by language models rather than people (Liu et al.). Its authors built “a comprehensive API pool of 26,507 diverse APIs” (an API, or application programming interface, is what this post calls a tool), then had “three agents—user, assistant, and tool—each simulated by an LLM” act out “single function calls, parallel function calls, dependent function calls, and non-tool-use dialogs” (§2.2.1). The tool agent gives “simulated results” (§2.2.1), and the calls were checked by rules, “without the need for actual execution”, and then by another model, with the results “overseen by human experts” (§2.3). What’s on Hugging Face is, in the paper’s words, “a subset of the data” (abstract).
That mix matters here. I don’t want the model to learn that every request needs a tool. Because the set includes non-tool-use dialogs, it also teaches the model to decline and to ask for a missing argument, which matters for §5.
ToolACE writes its calls as Python-like text in square brackets, [Name(arg=value)], and some tool names contain spaces or brackets, so the calls aren’t valid Python. I convert every row to Qwen’s own template, the JSON <tool_call> form from §1, so the model is trained and tested in one format.
Not every row is used: a few are in Chinese and some write their tool list in a format other than JSON. Preparing the training sets counts every cut.
Some rows go on past a call: the tool’s result comes back and the assistant answers from it. This post is about the first call, so every row is cut after its first call turn.
The control: random calls
Post 8’s control kept everything about the training loop and broke one link: rewards were shuffled within each group, so a 1 no longer said which answer was right. The control here does the same to demonstrations. Both arms get the same prompts, the same tool lists, the same call format and the same number of training steps. Only the calls differ:
- Real arm: ToolACE’s own calls.
- Control: every call is replaced, one by one, by a call to a tool drawn at random from the row’s own list, each tool equally likely and the right one included. Its arguments are copied from a real call to that tool in another row, so the values look real but don’t come from this request. When no other row calls the drawn tool, the call is built instead: its required parameters are filled one at a time, from the schema or from other rows’ arguments. No argument ever comes from the row itself.
Here’s one row in both arms, from _r4b, which cmd_sft_data calls. Each assistant turn has 4 masked tokens of its own, its <|im_start|>assistant header line and the newline after <|im_end|>, so the model is scored on the call and the <|im_end|> that ends it:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
tools offered getMedication, getDiagnosis
real arm, turn by turn:
turn tokens scored masked
-----------------------------------
system 286 0 286
user 19 0 19
assistant 27 23 4
total 332 23 309
control, turn by turn:
turn tokens scored masked
-----------------------------------
system 286 0 286
user 19 0 19
assistant 29 25 4
total 334 25 309
The system turn holds the date line and the tool list. scored:
the tokens the loss is computed on. In an assistant turn, the
'<|im_start|>assistant' header line and the newline after
<|im_end|> are masked; the rest, through <|im_end|>, is scored.
user:
I've been diagnosed with hypertension. Can you recommend some \
appropriate medication?
real call:
{"name": "getMedication", "arguments": {"condition": "hypertension"}}
control call:
{"name": "getDiagnosis", "arguments": {"patient_id": "3056"}}
control's tool getDiagnosis (replaced getMedication)
arguments another row: copied from toolace-723
SFT scores only the assistant’s call. The control keeps the prompt and the format, and replaces the call with one to a tool drawn from the row’s own list, with arguments from another row.
Both calls are well-formed, and only the first answers the request. The control still shows the model how a call is written, with real tool names and real argument structures. What it takes away is the link between the request and the call.
Each arm trains three times, from three random seeds (the number that sets a run’s random choices, here the adapters’ starting values and the order the rows are shuffled in), and each seed gets its own control set.
Preparing the training sets
Both arms train on the same ToolACE rows: the same requests, the same tool lists, the same replies that don’t call, and the same number of calls in each call turn. Only the calls differ.
Selecting the training rows. ToolACE has 11,300 rows. Four cuts, made one after another, leave the rows each arm trains on:
| Rows | Decision | Reason | Rows left |
|---|---|---|---|
| 18 in Chinese | Dropped | Keep the training rows in English | 11,282 |
| 500 whose tool list isn’t written as JSON | Dropped | The conversion to Qwen’s format reads the tool list only as JSON | 10,782 |
| 2,264 that offer one tool and call it | Left out | A random pick from one tool always lands on the right tool | 8,518 |
| 14 with a broken assistant turn | Dropped | 5 are empty and would teach the model to end its turn at once; 9 write a call inside a text turn, so it would train as plain text | 8,504 |
That leaves 8,504 rows in each arm: 6,975 with a call and 1,529 without. Every one of the 6,975 offers two or more tools. The call rows hold 13,550 calls, and 3,257 of their 6,975 call turns make several calls at once, in parallel.
The rows with no call go into both arms unchanged, because there’s no call to replace. Of these, 767 offer two or more tools, 514 offer one and 248 offer none.
The third cut has a side effect. Every training row left that offers exactly one tool teaches the model not to call it. §5 comes back to this bias on BFCL’s one-function items.
From ToolACE’s 11,300 rows to the 8,504 each arm trains on. Leaving out the one-tool rows with a call makes the random-call control meaningful, but adds a bias: all the one-tool rows left (hatched) are rows where the assistant doesn’t call.
Checking the random-call control. The control isn’t guaranteed to be wrong. If a row offers \(k\) tools, a random pick has a \(1/k\) chance of choosing the tool the real call used.
Across the 13,550 calls, the expected number of matching tools, the sum of \(1/k\) over the calls, is 3,744.4. The three seeds’ control sets draw the matching tool 3,785, 3,719 and 3,711 times (27.4% to 27.9%), close to that. Picking the right tool isn’t the same as making the right call, though. Whole calls, arguments included, match far less often: 267 to 300 of the 13,550, many of them because the drawn tool takes no arguments, so there’s only one call it can make.
So the control substantially weakens the link between a request and its call, while keeping the rest of the training setup, even if a few calls stay right by chance.
There’s a limitation. A random call can also have simpler or more complex arguments than the real one, and fit the conversation less naturally. The control is scored on 0.9553 to 0.9605 times as many tokens as the real arm, depending on the seed, but similar length doesn’t rule out those differences. So a gap between the arms is evidence that learning to map requests to calls helps, not proof that the calls’ correctness is the only cause. I looked for an earlier use of a random-call control in tool-calling SFT and found none.
The full counts and per-seed checks are in Validation and reproducibility.
Checking train–test overlap
Our test sets use requests the model shouldn’t have seen in training (§2). But an unseen request can still involve a familiar tool, so I check both: the requests, and the tools by name, against the 8,504 training rows.
Requests: no exact matches. After lowercasing and collapsing runs of whitespace, none of our 1,000 test requests and none of BFCL’s 1,116 eval items matches a request in the training rows. Our 5,000-task train split also shares no requests with our test set. This rules out exact copies under that rule, not paraphrases or requests with one word changed.
Our tools: familiar kinds, mostly unfamiliar names. Five of our 11 tools, calculator, the three calendar tools and set_reminder, never appear by name in the training rows. The other six appear in at most 10 rows each. Related tools are common, though: 340 rows offer a tool whose name contains “calculat”, and 365 one with “stock”. These keyword matches are rough, since they also catch tools of another kind that share the word, but they show why a tool name the model has never seen doesn’t make it an unfamiliar kind of tool.
BFCL’s tools: some names overlap. Of BFCL’s 1,116 eval items, 186 offer at least one function whose name, lowercased with everything but letters and digits removed, also appears in the training rows. There are 67 distinct shared names, the most common of them generic, such as convert and search. A shared name doesn’t mean the same tool, either: the two can take different arguments or do different things.
So the test requests are new by exact match, but some tool names and kinds of tool are familiar. The results measure how the model does on requests it hasn’t seen, not necessarily on tools it hasn’t seen.
The checks compare text and names and run no model. The counting is in tinytools/src/tinytools/overlap.py, and the full counts by tool and by BFCL category are in Validation and reproducibility.
Training
Both arms start from Qwen2.5-1.5B-Instruct and use the same training settings, fixed before the experiment. As decided in Milestone 0 (§3), I use LoRA at rank 16.
An epoch is one pass through the training rows. Each optimizer step processes up to 16 rows, split into smaller micro-batches to fit GPU memory. Their gradients accumulate before the model updates once. The learning rate climbs from 0 during the first 32 steps (the warmup), then falls to 0 along a cosine curve.
| Setting | Value |
|---|---|
| Training | 8,504 rows per arm, 2 epochs, 1,064 optimizer steps |
| Batch size | 16 rows per step; micro-batches capped at 8,192 token slots (rows × the longest row’s tokens) |
| Optimizer | AdamW, betas (0.9, 0.999), eps 1e-08; no weight decay or gradient clipping |
| Learning rate | 0.0002, cosine decay to 0, with 32 warmup steps |
| LoRA | rank 16, alpha 32, dropout 0; on q, k, v, o, gate, up and down in every layer |
| Trainable parameters | 18,464,768 |
| Precision | bfloat16 base weights and compute; float32 adapters, their gradients and the optimizer state |
| Sequence length | at most 3,072 tokens; longest row 2,975; no truncation |
| Loss | mean over scored tokens per optimizer step |
Paired runs. For each seed, the real and control runs share the same LoRA initialization and row-shuffle order. The real dataset stays fixed, while the control’s calls are randomized using that seed. So the two runs of a pair differ only in the calls they’re trained to write, which controls for initialization and data order when I compare the arms.
The adapters are kept in float32 (32-bit numbers), which helps preserve small updates, while the frozen model uses bfloat16, a 16-bit format that’s more memory-efficient. No row is cut to fit the length limit, so the model sees every tool list in full. Each run took about 22 minutes on the A100, loading included.
The full configuration, as the SFT report prints it, is in Validation and reproducibility.
Loss shows how well each arm fits its training rows
Each run’s loss at the first step and the last (same report, _r4d):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
arm seed steps loss, first loss, last minutes
-----------------------------------------------------------
real 1 1064 0.4691 0.0644 22.2
control 1 1064 1.2322 0.4149 22.1
real 2 1064 0.3244 0.0714 22.1
control 2 1064 1.1669 0.5154 22.1
real 3 1064 0.1649 0.0718 22.1
control 3 1064 1.0152 0.4659 22.0
real again 1 1064 0.4691 0.0644 22.1
loss: the step's mean over its scored tokens. minutes: wall clock,
loading included (varies run to run).
Training determinism: real-seed1 trained twice (two processes)
same LoRA init (A) yes
same first-step rows yes
losses identical, step by step 1064 of 1064
largest loss difference 0.000e+00
adapters bitwise identical yes
The first-step losses differ by seed because each seed’s first step draws different rows. Both arms bring their loss down, but the real arm much further. It ends at 0.0644, 0.0714 and 0.0718: ToolACE’s calls follow from their requests, so the model can learn to predict them. The control ends at 0.4149, 0.5154 and 0.4659, because its tool is drawn at random and its arguments come from another row, and nothing in the prompt can predict those. The “real again” row is seed 1 trained a second time, which matched exactly (Validation and reproducibility).
A low training loss only says the model fits the rows it trained on. It doesn’t say the model learned to call tools on requests it hasn’t seen. That’s what the held-out test sets are for, and §5 puts both arms on them.
The base model: fixing four indistinguishable tokens
So far I’ve trained Qwen2.5-1.5B-Instruct, which already calls tools before any training here (§3), so SFT improves a skill the model already has. What happens if I start from a model that can’t call tools yet?
To find out, I repeat the experiment on Qwen2.5-1.5B, the base model the instruct one was trained from, which never wrote a valid tagged call in Milestone 0 (§3). It gets the same training rows, the same seeds and the same scoring, with both the real arm and the control. I call its runs the base arm and the instruct model’s the instruct arm, so from here “arm” can also mean one model’s whole set of runs, each with its own real arm and control.
For a fair comparison, I render the base model’s prompts with the instruct model’s chat template, so every prompt and every training row is identical across the two models.
But the base model needs one more change before training.
Four special tokens that look the same to the model. Qwen’s chat and tool-call format relies on four special tokens:
| Token | id | What it marks |
|---|---|---|
<|im_start|> | 151644 | the start of a turn |
<|im_end|> | 151645 | the end of a turn |
<tool_call> | 151657 | the start of a call |
</tool_call> | 151658 | the end of a call |
Each token has its own id in the tokenizer. The model turns each id into a vector using its embedding table, a matrix with one row per token, where a token’s id is its row number.
You might expect four tokens that mean different things to have different rows. In the base model they’re nearly identical. Before training, I compared each row with <|im_start|>’s row in the same model, using cosine similarity, which is 1 when two vectors point in exactly the same direction:
| Token | Base model cosine | Instruct model cosine |
|---|---|---|
<|im_start|> | 1.0000 | 1.0000 |
<|im_end|> | 1.0000 | 0.9482 |
<tool_call> | 1.0000 | 0.9417 |
</tool_call> | 1.0000 | 0.9344 |
The four base-model rows also have the same norm (a vector’s length), 0.414, against a median of 1.032 across all 151,936 rows of the table, and no two of them differ by more than 1.5e-05 in any of their 1,536 numbers. So they aren’t equal bit for bit, but every pairwise cosine rounds to 1.0000. The instruct model has learned distinct rows for them: its pairwise cosines run from 0.9201 to 0.9482.
These four aren’t the only near-identical rows. In the base model, 2,234 rows have a cosine of at least 0.9999 with <|im_start|>: 21 of the 22 tokens Qwen added to the vocabulary, 1,942 ordinary vocabulary tokens, and 271 padding rows that no text produces (the table has 151,936 rows and the tokenizer 151,665 tokens). The full check and the token ids are in Validation and reproducibility.
Why would so many rows be nearly identical? The weights alone can’t say whether those tokens appeared in pre-training. A plausible explanation is that tokens that get little or no distinct learning signal keep nearly identical rows. Whatever the cause, what matters here is what these rows do to a tool call.
Why LoRA alone can’t fix it. Qwen2.5-1.5B ties its embeddings: one table does two jobs. At the input, it turns each token id into the vector the model reads. At the output, it scores every token as a candidate for the next one.
Here’s how the scoring works. Write \(h\) for the model’s final hidden state, the vector its last layer produces at the current position, and \(e_t\) for token \(t\)’s row of the table. Both have 1,536 numbers. The score of \(t\) is their dot product (multiply them number by number and add up):
\[s_t = h^\top e_t\]If two tokens \(a\) and \(b\) had identical rows, \(e_a = e_b\), then \(h^\top e_a = h^\top e_b\) for every \(h\), so their scores would always be equal. When the model has to choose between ending a turn and opening a call, the output layer would give <|im_end|> and <tool_call> the same score, and no context could make it prefer one. The base model’s rows are nearly identical rather than equal, so their scores can differ, but only through those differences of at most 1.5e-05 per number. At the input, too, the model reads nearly the same vector for all four tokens.
LoRA alone can’t break this tie. It adapts the attention and MLP projections (q, k, v, o, gate, up and down in every layer, as in Training), which changes the hidden state \(h\). It doesn’t touch the embedding table, and a different \(h\) still gives identical rows identical scores. To tell the tokens apart, their rows have to change.
The fix: four small trainable corrections. Rather than train the whole embedding table, I add a trainable correction, a delta, to each of the four rows. Each delta has 1,536 numbers, the model’s hidden size, so the four hold 4 × 1,536 = 6,144 parameters. Writing \(\Delta_t\) for token \(t\)’s delta, its row during training is in effect
\[e_t' = e_t + \Delta_t\]All four deltas start at zero, so the model starts exactly as it was.
Because the table is tied, the correction has to apply at both ends. At the input, each of the four tokens gets its delta added to its embedding. At the output, each gets the corrected score
\[s_t = h^\top (e_t + \Delta_t) = h^\top e_t + h^\top \Delta_t\]so the code adds \(h^\top \Delta_t\) to the four tokens’ scores. Two tokens that started with the same row can now get different scores, because their deltas can learn different values.
I train these 6,144 parameters beside LoRA’s 18,464,768, in the same optimizer with the same learning rate and schedule. The original weights stay frozen, and so does every other row of the table, including the rest of the 2,234 rows that share the four’s direction. For scoring, I merge each learned delta into its row, which gives an ordinary model with four changed rows. The instruct arm trains no rows, since its four are already distinct. The code and the base arm’s settings are in Validation and reproducibility.
How the base arm trains the four special tokens’ rows: ① the four rows start nearly identical; ② the table is tied, so the same rows score the output; ③ LoRA changes h, but nearly identical rows still score almost the same; ④ a trained delta per row, added at both ends, lets the scores differ; ⑤ training updates only LoRA and the deltas, which are then merged into E.
Did training separate the tokens? Yes. Think of each row as an arrow made of 1,536 numbers. Before training, the four arrows point the same way. Training nudges each arrow by its own delta, \(\Delta_t\), so the row becomes \(e_t + \Delta_t\). Two numbers show whether the nudges worked.
The first is how far each arrow was nudged: the length, or norm, of its delta. Writing \(\Delta_{t,i}\) for the delta’s \(i\)-th number,
\[\lvert \Delta_t \rvert = \sqrt{\Delta_{t,1}^2 + \Delta_{t,2}^2 + \cdots + \Delta_{t,1536}^2}\]For scale, each of the four rows started with a norm of 0.414, so a delta of 0.1 or more is a large nudge relative to the row.
The second is whether the arrows now point different ways: the cosine between two rows \(a\) and \(b\), their dot product divided by both lengths,
\[\cos(a, b) = \frac{a^\top b}{\lvert a \rvert \, \lvert b \rvert}\]It’s 1 when two arrows point the same way and drops below 1 as they turn apart. If the four cosines fall below 1.0000, the output layer can give the four tokens different scores. Seed 1’s real run prints both, from cmd_sft_pair (with _print_trained_rows):
1
2
3
4
5
6
7
8
9
embedding rows (delta) 6,144 parameters
token id |delta|
-------------------------------
<|im_start|> 151644 0.067
<|im_end|> 151645 0.175
<tool_call> 151657 0.165
</tool_call> 151658 0.159
pairwise cosine, before 1.0000 to 1.0000
pairwise cosine, after 0.9139 to 0.9269
<|im_start|>, which opens every turn, moved least, and the other three more than twice as far. Across all six base-arm runs they end between 0.9100 and 0.9301, close to the instruct model’s 0.9201 to 0.9482. The output layer can now give ending a turn and opening a call different scores.
How did the base model train? With the four embedding corrections training alongside LoRA, I repeat the same SFT as for the instruct model: three seeds of the real arm, three of the control, and 1,064 optimizer steps per run. I also repeat seed 1’s real run, to check it reproduces. Every run’s first- and last-step loss, both models side by side, from the instruct and base reports (_r4d; the full logs are in Validation and reproducibility):
Training loss at the first and last of 1,064 steps, every run. The base model starts far higher than the instruct model and ends almost level with it; the random-call control can’t fit its rows on either model.
The base model starts with a much higher loss than the instruct model. That fits Milestone 0, where the base model never wrote a correctly tagged call.
But after 1,064 steps the gap has nearly closed: the two models’ real arms end almost level, while the control finishes much higher on both.
What does this tell us? With LoRA and the four corrections trained together, the base model fits ToolACE’s training rows nearly as well as the instruct model. There are two limits to that.
First, I haven’t isolated what the corrections contribute. The tied-score argument explains why LoRA alone can’t separate the four tokens’ scores, but it doesn’t say how much the corrections improve training or accuracy. Measuring that would take a base-model run with LoRA alone, which I didn’t do.
Second, a low training loss says how well the model fits the rows it trained on, not whether it can call tools on requests it hasn’t seen. The base model has learned to fit the demonstrations, but has it learned to call tools? That’s the question for §5.
Validation and reproducibility
This section collects the checks behind the experiment: how I built the training data, whether the random-call control behaved as intended, which tokens the loss is computed on, how the training and test data overlap, and how to reproduce the SFT runs.
Where the blocks come from. The main entry points are cmd_toolace_stats, cmd_sft_data, cmd_toolace_overlap, cmd_sft_check and cmd_sft_report, all in tinytools/src/tinytools/cli.py. The conversion is in tinytools/src/tinytools/toolace.py (convert_row), and the training sets are built in tinytools/src/tinytools/sft.py (build_sets). Training runs in tinytools/src/tinytools/train.py (train), and the reports in tinytools/src/tinytools/sftrun.py: cmd_sft_report runs run_report, and cmd_sft_check runs run_check. Each part below names the function that prints its blocks.
1. Preparing ToolACE. Both models, base and instruct, train on exactly the same rows: the real set and the three control sets built here once. The base model’s prompts use the instruct model’s chat template, so the rendered rows are identical too. The reasons for each cut are in Preparing the training sets; these are the counts behind them.
Language and tool formats. The language rule drops a row if a CJK (Chinese, Japanese or Korean) ideograph appears in the first 200 characters of its system prompt: 18 rows. It’s a simple rule, not a language detector; 25 rows have a CJK ideograph somewhere. The 500 format variants break down by how the tool list is written; “JSON with other keys” uses tool_name, definition and arguments in place of name, description and parameters. From cmd_toolace_stats:
1
2
3
4
5
Rule: a row is Chinese if the first 200 characters of its
system prompt contain a CJK ideograph (U+4E00-U+9FFF).
Chinese rows (dropped) 18
English rows 11282
contrast: rows with any CJK 25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
reason rows
-------------------------------------------------
tool list not JSON (format-variation row) 500
The 500 rows whose tool list is not JSON, by how the list is
written (detected from its first characters):
format rows
----------------------------
YAML-like lines 151
Markdown list 76
LaTeX tabular 73
HTML table 63
JSON with other keys 62
XML-like tags 61
no tool list at all 14
other 0
JSON with other keys: "tool_name", "definition", "arguments"
in place of the name / description / parameters schema.
rows converted 10782
with an empty tool list 248
with tool results 797
with a date/time line kept 5869
The training rows. The counts behind the rows table in Preparing the training sets, from cmd_sft_data:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Rows with 2+ tools and a call, and every row with no call (any
tool list). No-call rows go into both arms unchanged; rows with
one tool and a call are left out.
row type converted dropped each arm
--------------------------------------------------------------
2+ tools, with a call 6980 5 6975
no call, 2+ tools 773 6 767
no call, 1 tool 517 3 514
no call, empty tool list 248 0 248
1 tool, with a call (left out) 2264 - 0
total 10782 14 8504
subtotal converted dropped each arm
--------------------------------------------------------------
no call (the three rows above) 1538 9 1529
all but the left-out rows 8518 14 8504
dropped: from both arms, by reason (checked after truncation):
reason rows
--------------------------------------------
an empty assistant turn 5
a bracket-syntax call in a text turn 9
total 14
an empty assistant turn:
toolace-27, toolace-30, toolace-162, toolace-163, toolace-263
a bracket-syntax call in a text turn:
toolace-1383, toolace-1929, toolace-4716, toolace-5826, toolace-6774,
toolace-7224, toolace-7605, toolace-9833, toolace-10539
An empty turn would teach the model to end its turn at once; a
[Name(...)] call written in a text turn would train as plain text.
The turns. Each row is cut right after its first call turn, so no row has a tool result; a non-call turn before it stays, and a row with no call is kept whole. That’s why 8,504 rows hold 8,571 assistant turns (6,975 call turns and 1,596 that don’t call). The real set and every control set have the same rows, turns and calls (cmd_sft_data):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
converted truncated real arm control
------------------------------------------------------------------
rows 10782 10782 8504 8504
assistant turns 13301 10854 8571 8571
call turns 9964 9244 6975 6975
parallel (2+ calls) 4127 4079 3257 3257
not-calls after user 2303 1610 1596 1596
not-calls after tool 1034 0 0 0
calls 18161 17386 13550 13550
tool results 1367 0 0 0
converted: all 10782 rows as toolace-convert wrote them;
truncated: the same rows cut; real arm: the training rows;
control: their random-call twins, the same counts for every seed
(checked). Not-calls after user: asking for an argument, saying
no function fits, chatting.
2. Checking the random-call control.
Two things need checking: that the tool really is drawn at random, and that the arguments never come from the row’s own call.
Which tool it draws. If a row offers \(k\) tools, a uniform draw has a \(1/k\) chance of picking the tool the real call used. Summed over the 13,550 calls, that gives an expected 3,744.4 matches, with a standard deviation (sd) of 49.9, which is how far chance alone would typically move the count (cmd_sft_data):
1
2
3
4
5
6
7
8
control calls (every seed) 13550
expected to draw it (sum of 1/k) 3744.4 (sd 49.9)
control set drew the replaced call's tool
--------------------------------------------
seed 1 3785 of 13550 (27.9%)
seed 2 3719 of 13550 (27.4%)
seed 3 3711 of 13550 (27.4%)
All three seeds land within one sd of 3,744.4, as a random draw should.
Where the arguments come from. The control never copies arguments from the row being replaced. It copies them from another row that calls the drawn tool. When no other row calls it, it builds the call instead, filling the tool’s required parameters one at a time from the schema or from other rows’ arguments (cmd_sft_data again):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
another row: a call to the drawn tool in another row that fits
this row's schema; other schema: the same, schema differs;
built: no other row calls the tool (even when it is the replaced
call's tool), so its required parameters are filled one by one.
No argument ever comes from the row itself.
control calls seed 1 seed 2 seed 3
----------------------------------------------------------
another row 5833 5828 5812
another row, other schema 514 505 487
built 7203 7217 7251
built, drew the replaced tool 2377 2321 2340
total 13550 13550 13550
taken from the row itself 0 0 0
equal to the real call 300 277 267
another row 180 167 149
another row, other schema 0 0 0
built 120 110 118
any source, tool takes no args 164 138 150
equal to the real call: the drawn tool is the right one and the
arguments copied from other rows happen to equal this row's
(coincidence only: another row asked the same, or a built call's
copied values match). A tool that takes no arguments has only
one possible call, so drawing it reproduces the real call.
The taken from the row itself line is 0 for every seed. Built calls are the largest group, 7,203 of 13,550 for seed 1, so in more than half the control’s calls no other row calls the drawn tool. Other schema means another row calls a tool of the same name but lists its parameters differently, and its arguments are copied anyway.
The 300, 277 and 267 calls that equal the real one are coincidences, as the footer says. What matters is that the control picks its calls without using the request’s intended answer.
3. Which tokens contribute to training.
Only the assistant’s replies count toward the loss. The prompt and each assistant turn’s <|im_start|>assistant header are masked, and the reply is scored through the <|im_end|> that ends it. The real and control sets have nearly the same number of tokens, but the replacement calls change some reply lengths (cmd_sft_data):
1
2
3
4
5
6
7
8
9
10
real arm seed 1 seed 2 seed 3
-------------------------------------------------------------
tokens 6286011 6258846 6262049 6260289
tokens scored 607322 580157 583360 581600
control / real, all 0.9957 0.9962 0.9959
control / real, scored 0.9553 0.9605 0.9576
scored: the tokens the loss is computed on: each assistant turn
from after its '<|im_start|>assistant' header through its
<|im_end|>. The header is masked. The no-call rows are the same
in both arms, so only call turns can move the ratio.
Tokenizer compatibility. I built the training sets on the Mac with Qwen2.5-0.5B-Instruct’s tokenizer and chat template, post 8’s model and sft-data’s default, before Milestone 0 picked 1.5B. To make sure that didn’t change the training inputs, the check before training renders every row again with Qwen2.5-1.5B-Instruct’s tokenizer and template and compares. All 34,016 renderings match exactly, 8,504 rows in each of the four sets (the real one and three controls), so the token counts and loss masks above hold for the 1.5B runs (the training report’s _r4c):
1
2
3
4
5
6
7
8
9
10
11
12
tokens, one epoch all scored masked computed x2
----------------------------------------------------------
real, seed 1 6286011 607322 5678689 16246768
control, seed 1 6258846 580157 5678689 16190909
scored: the loss is computed on them (assistant turns through
<|im_end|>); computed x2: token slots of both epochs with padding.
Checks (sft-check, before training):
template: rows identical 34016 of 34016 (4 files)
Qwen2.5-1.5B-Instruct vs sft-data's rendering with
Qwen2.5-0.5B-Instruct
<|im_end|> scored 8571 of 8571 assistant turns
The last line checks where each reply ends. <|im_end|>, the token that ends a turn, is scored in all 8,571 assistant turns, so the model learns where a call or reply stops as well as how it starts.
4. Train–test overlap.
These are the full counts behind Checking train–test overlap. I checked whether the evaluation requests appear in the training rows. The rule lowercases each request, collapses runs of whitespace to one space, and looks for an exact match with a user turn of a training row. It’s deliberately a text check, not a test of similar meaning. The blocks come from cmd_toolace_overlap, with the counting in tinytools/src/tinytools/overlap.py (run). It runs no model. First, the requests:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Rule: a request is found if, with runs of whitespace collapsed to
one space and lowercased, it equals a user turn of a training row.
our test requests (n=1000) 0 found
BFCL eval items, by category (found: any of its user turns):
category items found
---------------------------------
simple 360 0
multiple 180 0
parallel 180 0
parallel_multiple 180 0
irrelevance 216 0
Contrast: the same rule where repeats exist, and where our task
generator keeps them out:
ToolACE rows repeating a request 136 (first user turns; 68 texts)
test in our train (n=5000) 0 found
The contrast lines show that the rule does find repeats where they exist: 136 of ToolACE’s rows repeat another row’s first request, 68 different requests in all.
Tool names. I also checked whether the test tools share names with tools offered in training. Names are normalized by lowercasing and removing everything but letters and digits. For our 11 task and distractor tools, the block counts the rows offering a tool with exactly that name, and the rows offering any tool whose name contains a keyword from it (kind_count counts the keyword columns):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
same name: rows offering a tool with exactly this normalized name
(lowercased, all but a-z and 0-9 removed: Get Stock Price is
get_stock_price). rows: rows offering any tool whose normalized
name contains the keyword (a row counts once); names: how many
distinct such names. Out of 8504 rows.
tool role same name keyword rows names
---------------------------------------------------------------------
calculator task tool 0 calculat 340 245
search_contacts task tool 3 contact 75 33
get_calendar_event task tool 0 calendar 97 36
create_calendar_event task tool 0 calendar 97 36
search_documents task tool 1 document 126 69
send_email distractor 5 email 211 103
delete_calendar_event distractor 0 calendar 97 36
get_weather distractor 3 weather 68 69
set_reminder distractor 0 reminder 1 1
get_stock_price distractor 10 stock 365 186
translate_text distractor 2 translat 88 41
get_stock_price is the tool named in 10 rows. The keyword check is deliberately broad: it also catches tools of another kind that share the word, like Economic Events Calendar under “calendar”.
For BFCL, only the last part of a dotted function name is compared, so math.factorial becomes factorial. An eval item counts if any function it offers has a name some training row also offers (items_sharing and shared_names):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
A BFCL function's name: its last dotted part (math.factorial is
factorial), normalized as above; found if a training row offers a
tool with that normalized name.
category items sharing a name items
------------------------------------------------
simple 48 360
multiple 49 180
parallel 28 180
parallel_multiple 44 180
irrelevance 17 216
all 186 1116
distinct shared names 67
The 8 in the most BFCL items (BFCL items / ToolACE rows):
name (normalized) BFCL items ToolACE rows
------------------------------------------------
convert 18 13
calculatebmi 14 9
search 10 103
getstockprice 9 10
weatherforecast 9 5
calculatefuturevalue 7 1
sentimentanalysis 7 3
calculatedistance 6 4
The block breaks Checking train–test overlap’s 186 items down by BFCL category. search, the most generic shared name, is offered in 103 training rows. ToolACE’s paper doesn’t report checking its data against BFCL (Liu et al.), and the BFCL categories used here (BFCL calls them its AST categories, because it checks their calls by parsing them, §2) are built from functions in “popular GitHub repositories (top 100 starred)” (Patil et al., App. E.1).
5. Training configuration and determinism.
Both models train with the same LoRA configuration and procedure, and the base model adds the four embedding corrections (part 6). This is the configuration behind the Training table, as the SFT report prints it (_r4c in tinytools/src/tinytools/sftrun.py):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
model (base weights frozen) Qwen/Qwen2.5-1.5B-Instruct
rows per arm 8504
epochs 2
optimizer steps 1064
16 rows each; the last step of an epoch takes the rest.
effective batch 16 rows
micro-batches token budget 8,192
(rows x the longest row's tokens; gradients accumulated)
gradient checkpointing off
loss mean over the step's scored tokens
optimizer AdamW, betas (0.9, 0.999), eps 1e-08
weight decay 0
gradient clipping none
learning rate 0.0002, cosine to 0
warmup 3% of the steps: 32
LoRA rank 16, alpha 32, dropout 0
on q,k,v,o,gate,up,down; all layers
trainable parameters 18,464,768
dtype: base weights bfloat16
dtype: activations (compute) bfloat16
dtype: LoRA A, B float32
dtype: gradients of A, B float32
dtype: AdamW state float32
max length 3,072 tokens, no truncation
rows cut 0
longest row 2975
seed N sets LoRA A's init and the shuffle order
Real N and control N share both: the pair. The real set has no
randomness; control set N was drawn by sft-data with seed N.
Determinism. I trained seed 1’s real run a second time, in a separate process, for each model. For both, the repeat matched the original at all 1,064 optimizer steps, and the saved adapters (the base model’s with its four corrections) were bitwise identical. The instruct model’s check is at the bottom of its loss block in §4. The base model’s is below, in the full log behind the loss table in The base model, with minutes per run (_r4d):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
arm seed steps loss, first loss, last minutes
-----------------------------------------------------------
real 1 1064 1.2314 0.0723 22.4
control 1 1064 1.8764 0.4122 22.3
real 2 1064 1.0752 0.0765 22.4
control 2 1064 1.8968 0.5212 22.4
real 3 1064 1.1372 0.0783 22.4
control 3 1064 1.7750 0.4614 22.4
real again 1 1064 1.2314 0.0723 22.4
loss: the step's mean over its scored tokens. minutes: wall clock,
loading included (varies run to run).
Training determinism: real-seed1 trained twice (two processes)
same LoRA init (A) yes
same first-step rows yes
losses identical, step by step 1064 of 1064
largest loss difference 0.000e+00
adapters bitwise identical yes
This shows the runs reproduce in the environment I tested. It doesn’t establish that other hardware or software versions would give bitwise-identical results.
6. Implementing the base model’s four embedding corrections.
As The base model explains, the base model’s four chat and tool-call tokens have nearly identical embedding rows, and because Qwen ties its input embedding and output head, LoRA alone can’t separate their scores. This part shows the implementation: that the corrections apply at both the input and the output during training, that they’re merged into the table for evaluation, and that nothing else trains. Here is the real code, trimmed, from tinytools/src/tinytools/lora.py at commit 44b5cb6.
Freeze the original model. LoRA’s setup sets every original parameter’s requires_grad to False first, then wraps the chosen linear layers with trainable adapters, so nothing trains unless it’s added afterwards:
1
2
3
4
5
6
7
8
9
10
11
12
def inject_lora(model, targets, *, rank, alpha, generator=None, dtype=ADAPTER_DTYPE):
wanted = set(targets)
for p in model.parameters():
p.requires_grad_(False)
wrapped = {}
for parent_name, parent in list(model.named_modules()):
for child_name, child in list(parent.named_children()):
if child_name in wanted and isinstance(child, nn.Linear):
adapter = LoRALinear(child, rank, alpha, generator, dtype)
setattr(parent, child_name, adapter)
wrapped[f"{parent_name}.{child_name}" if parent_name else child_name] = adapter
return wrapped
Four corrections, starting at zero. RowDelta holds one new parameter, delta, one row per token. With four tokens and a hidden size of 1,536, that’s 4 × 1,536 = 6,144 parameters:
1
2
3
4
5
6
7
8
9
class RowDelta(nn.Module):
def __init__(self, ids, hidden, vocab, device, dtype=ADAPTER_DTYPE):
super().__init__()
ids_t = torch.tensor(ids, dtype=torch.int64)
self.register_buffer("ids", ids_t.to(device), persistent=False)
select = torch.zeros(len(ids), vocab, dtype=torch.float32)
select[torch.arange(len(ids)), ids_t] = 1.0 # row j: one-hot at ids[j]
self.register_buffer("select", select.to(device), persistent=False)
self.delta = nn.Parameter(torch.zeros(len(ids), hidden, dtype=dtype).to(device))
At the input. Wherever a token is one of the four, DeltaEmbedding adds its delta to its embedding:
1
2
3
4
5
6
class DeltaEmbedding(nn.Module):
def forward(self, input_ids):
out = self.base(input_ids)
dt = out.dtype
hit = (input_ids.unsqueeze(-1) == self.rows.ids).to(dt) # (..., k) one-hot
return out + hit @ self.rows.delta.to(dt)
At the output. DeltaHead adds the hidden state’s dot product with each delta to that token’s score, which is the score the table would give if that row were the row plus its delta:
1
2
3
4
5
6
class DeltaHead(nn.Module):
def forward(self, x):
out = self.base(x)
dt = x.dtype
extra = F.linear(x, self.rows.delta.to(dt)) # (..., k)
return out + extra @ self.rows.select.to(dt)
Together the two give each of the four tokens the row \(e_t + \Delta_t\) at both ends, as in The base model.
Merge for evaluation. For scoring, merge_rows writes each trained delta into its row of the table, and because the table is tied, the input and the output both get it. Training itself updates only LoRA’s matrices and these four deltas:
1
2
3
4
5
6
7
@torch.no_grad()
def merge_rows(model, ids, delta):
w = model.get_input_embeddings().weight
for j, i in enumerate(ids.tolist()):
new = w[i].float() + delta[j].to(torch.float32).to(w.device)
w[i].copy_(new.to(w.dtype))
return len(ids)
The base report’s training settings are the instruct arm’s with the rows added. The part that differs, from cmd_sft_report with --profile base (_r4c):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
LoRA rank 16, alpha 32, dropout 0
on q,k,v,o,gate,up,down; all layers
trainable parameters 18,464,768
embedding rows (delta) 4 rows, zero at the start
<|im_start|> id 151644
<|im_end|> id 151645
<tool_call> id 151657
</tool_call> id 151658
trainable parameters 6,144
In LoRA's AdamW group: its lr, schedule and betas;
weight decay 0, as LoRA's.
Embeddings are tied: the input embedding and the output head
both see E + delta.
trainable parameters, all 18,470,912
7. Verifying the original embedding problem.
Before training, I checked the four rows in both Qwen2.5-1.5B and Qwen2.5-1.5B-Instruct. This is the full check behind the cosine table in The base model, from _print_rows, which cmd_sft_check runs with --profile base on the A100 before training. Each cosine is with the same model’s <|im_start|> row, and largest |difference| is the largest gap between two of the four rows in any one of their 1,536 numbers:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
embeddings tied (input = output) yes
Each row's norm and its cosine with <|im_start|>, in the base
model (bfloat16, as loaded) and in Qwen2.5-1.5B-Instruct:
token id norm cosine Instruct norm cosine
------------------------------------------------------------
<|im_start|> 151644 0.414 1.0000 0.426 1.0000
<|im_end|> 151645 0.414 1.0000 0.422 0.9482
<tool_call> 151657 0.414 1.0000 0.431 0.9417
</tool_call> 151658 0.414 1.0000 0.429 0.9344
median row norm, base 1.032 (all 151,936 rows)
pairwise cosine, base 1.0000 to 1.0000
largest |difference|, base 1.5e-05
pairwise cosine, Instruct 0.9201 to 0.9482
identical in the base model yes
(identical: every pairwise cosine at least 0.9999)
rows sharing <|im_start|>'s embedding: 2,234
(21 added tokens + 1,942 vocabulary tokens + 271 padding rows; ids
151644-151935 and 1,942 more from 124 to 151638)
(every row of the embedding, cosine at least 0.9999; the 4 above among
them)
The count of added tokens, and the one that doesn’t share <|im_start|>’s direction, come from a re-run of the embedding check on the Mac, which prints the same numbers (with the weights in float32 there) plus two lines (_print_rows):
1
2
3
4
5
rows sharing <|im_start|>'s embedding: 2,234
(21 added tokens + 1,942 vocabulary tokens + 271 padding rows; ids
151644-151935 and 1,942 more from 124 to 151638)
added tokens: 22 (ids 151643-151664); not sharing: <|endoftext|>
(151643)
Of Qwen’s 22 added tokens, <|endoftext|> is the only one below the threshold.
5. What SFT changed
Each model trained in two arms (§4): on ToolACE’s real calls, which the tables from here call SFT, and on the control’s random calls. Each arm trains three times with different seeds, each control sharing its seed with one real run, as in post 8, and every run is scored greedily on all of our test tasks and on BFCL’s eval items, beside its untrained model.
So what did the models actually learn? The results were more complicated than I expected. On our 800 tasks that need a call, SFT made the instruct model right 30.0 points more often. On BFCL’s 900 call items, the same training took it from 85.1% right to 51.3%. Most of this section is about how both can be true.
How I measure SFT’s effect
The effects were named before the run, each as a share of tasks with one outcome:
| effect | a task counts when the reply is | on |
|---|---|---|
| calling when a tool fits | no call, or unparseable | tasks that need a call |
| filling | wrong arguments | tasks that need a call |
| declining when none fits | called anyway | no-tool-fits tasks; BFCL irrelevance |
| choosing (a harm check) | wrong function or wrong number of calls | tasks that need a call |
Lower is better for all four. Choosing is only a harm check: the untrained instruct model already picks the right tool on most calls, so the question is whether SFT breaks it, not whether it improves it. Each share is out of every task in its set, not out of the calls the model wrote. A model that rarely calls can have few wrong arguments without being good at filling them, so I also report right, and the full outcome split, beside the effects.
For each effect the report gives three paired differences, each with its interval: SFT minus untrained, control minus untrained, and SFT minus control. What SFT taught is claimed only from SFT minus untrained. The control can’t be the baseline for choosing and filling, because its training pulls it toward chance: every call it trains on names a tool drawn at random, while the untrained instruct model already picks the right tool on most of the calls it writes (§3). So SFT minus control mixes what SFT gained with what the control’s training cost it, and it’s reported as the gap between the arms, not as SFT’s effect. Control minus untrained shows what training on random calls does by itself: for calling, what training on calls buys without the right ones; for choosing and filling, how far that training drags the model toward chance.
When a difference counts. Every comparison is paired by task. For each arm, a task’s score is its correctness averaged over the arm’s three seeds; the difference between two arms is the mean over tasks of their per-task difference. To see how much that could move by chance, the program draws the test tasks again with replacement 10,000 times (a bootstrap), recomputes the difference each time, and takes the middle 95% of those values as the interval. The post says one arm beat another only when that interval excludes 0. The interval covers a different draw of test tasks for these three trained seeds; it doesn’t say how much a new set of training runs would differ. The seed-by-seed numbers are printed too, but they don’t decide.
The claims come from five comparisons, all SFT minus untrained, fixed before the run: calling, filling and declining on our tasks, right on BFCL’s 900 call items pooled, and declining on BFCL irrelevance. The report calls them the primary comparisons and numbers them 1 to 5 in that order. Every other interval in the report is descriptive.
Two readings of a reply. Every arm, base and instruct, is checked two ways. The strict reading is the one used so far: a call counts only between <tool_call> tags. The tag-free reading also counts a reply that opens with a call’s JSON, {"name": ..., "arguments": {...}}, with no tags around it, and checks it by the same execution match; a reply with a tag is read as strict. It’s a re-check of the saved replies, with the reading in tinytools/src/tinytools/tagfree.py. The base model needs it because, untrained, it sometimes writes the right call bare, and on the strict reading SFT would get credit for teaching the tags alone.
The base model’s rule. What the base arm shows was fixed before the run. Both models are shown side by side either way. If SFT minus untrained on our tasks that need a call, right, has an interval that excludes 0 on the tag-free reading, the base model becomes the post’s main example of what SFT gains, with the instruct model as the contrast; otherwise it gets a paragraph and the instruct story stands.
SFT teaches the base model to call tools
Here are both models side by side, untrained → after SFT, each SFT number the mean of three seeds. The base model is read tag-free and the instruct model strict, which for its greedy replies is the same (both readings, run by run):
SFT lifts both models to 86.6% and 90.0% right on our tasks, the base model by learning to call and the instruct model by filling arguments better. Both decline far less often on our tasks where no tool fits, while on BFCL’s irrelevance items both, after SFT, decline every one.
The biggest change was in Qwen2.5-1.5B, the base model. On the strict reading it writes no <tool_call> tag on any of our tasks or BFCL’s items, so it’s right on none of the calls and declines every no-tool-fits and irrelevance item by default. On that reading several of the five comparisons say nothing: calling when a tool fits goes from 100.0% of tasks with no call to 0.0% for SFT and the control alike. Read tag-free, 98 of its 800 replies to our tasks that need a call are right calls written without the tags, 12.3%. That’s its real starting point. The rule’s comparison, from cmd_sft_report with --profile base --reading tagfree (_base_rule):
1
2
3
4
5
6
7
base-arm rule (fixed before the run): SFT - untrained, ours, tasks that
need a call, right, tag-free: +74.3 points [+71.4, +77.3], excludes 0:
yes -> featured
(untrained 12.3%, SFT 86.6%, seed mean; bootstrap, 10,000 resamples,
seed 0, 95%, over 800 tasks.)
Strict, for contrast (not the rule's reading): +86.6 points [+84.4,
+88.7] (untrained 0.0%, SFT 86.6%).
That was a much larger gain than I expected, and with its interval excluding 0, the rule makes the base model this post’s main example of what SFT gains. The untrained model already gets credit for its bare calls, so the gain is more than the tags. The control is right on 0, 1 and 0 of the 800, on either reading: it learned to write calls, not which call a request needs.
By category (same report, _r5a):
1
2
3
4
5
6
7
8
9
10
11
12
SFT - untrained, paired by task (SFT: mean of 3 seeds):
category untrained SFT seed range gain 95% interval
-----------------------------------------------------------------------
choose+fill 12.7% 93.0% 91.7-93.7% +80.3 [+77.2, +83.3]
tricky args 11.0% 67.3% 65.0-70.0% +56.3 [+49.7, +62.8]
no tool fits 84.0% 0.3% 0.0-0.5% -83.7 [-88.7, -78.3]
simple 6.7% 8.0% 3.6-12.8% +1.3 [-2.3, +4.8]
multiple 22.22% 69.26% 67.2-70.6% +47.0 [+38.9, +55.0]
parallel 0.0% 10.2% 8.9-12.2% +10.2 [+6.7, +13.9]
par_multi 0.0% 65.9% 62.2-70.0% +65.9 [+59.4, +72.2]
irrelevance 85.2% 100.0% 100.0-100.0% +14.8 [+10.2, +19.9]
BFCL calls 7.111% 32.259% 29.7-33.6% +25.1 [+22.0, +28.3]
A few shares in this table and the ones below print with two or three decimals. The report uses as many as it takes for the printed shares to give the printed gain: at one decimal, 7.1% and 32.3% would suggest +25.2, not +25.1.
SFT takes the base model from 12.7% to 93.0% right on choose+fill and from 11.0% to 67.3% on tricky arguments. On BFCL the improvement wasn’t uniform. Where several functions are offered it gains a lot, from 22.2% to 69.3% on multiple and from 0.0% to 65.9% on parallel_multiple. Where only one function is offered, strangely, it barely moves: simple goes from 6.7% to 8.0%, with an interval that includes 0, and parallel from 0.0% to 10.2%. The instruct model loses on the same two categories, and the one-tool rows explain why.
The cost is declining (same tag-free report, _r5d):
1
2
3
4
5
6
7
8
9
declining when none fits [primary 3]
1 = called anyway
on ours, no tool fits, 200 tasks
untrained 16.0% SFT 99.7% control 100.0% (seed means)
difference points 95% interval excludes 0
---------------------------------------------------------
SFT - untrained +83.7 [+78.3, +88.7] yes
control - untrained +84.0 [+79.0, +89.0] yes
SFT - control -0.3 [-1.0, 0.0] no
Untrained, the base model declined on our no-tool-fits tasks mostly because it rarely called anything. After SFT it declines on 1, 0 and 1 of the 200, and the control on none. It has learned to call, and now calls almost every time, including when it shouldn’t. The training set leans the same way when several tools are offered: among ToolACE rows with two or more tools, 6,975 make a call and 767 don’t (§4), and every one of our tasks offers 3 to 5. Every trained base model, SFT and control, declines all 216 of BFCL’s irrelevance items, as the instruct model’s SFT runs do; the instruct model’s control declined 215, 216 and 215.
The two models end up close together on our tasks from very different starts. Both end up calling on nearly every task of ours, including where no tool fits, and both are left with many no-call replies on BFCL, which the one-tool rows trace to the training set. It was my first hint that learning to call and learning when to call are different problems.
The instruct model’s real gain is in filling arguments
The instruct model told a different story. Before any training it already wrote well-formed calls and usually chose the right tool (§3), so SFT had less to teach it. Still, on our 800 tasks that need a call, paired by task and averaged over seeds as the comparisons are, SFT is right on 90.0% against the untrained model’s 60.0%. This one is descriptive, not one of the five comparisons, from cmd_sft_followup on the main run’s saved replies:
1
2
3
4
5
6
7
8
9
10
11
12
tasks 800
arm right seeds
----------------------------------------------
untrained 480 of 800 (60.0%) -
SFT 90.0% (seed mean) 712, 717, 730
control 0.1% (seed mean) 1, 2, 0
difference points 95% interval
---------------------------------------------
SFT - untrained +30.0 [+26.8, +33.2]
control - untrained -59.9 [-63.3, -56.5]
seeds: right of 800, per seed. Intervals: paired by task,
bootstrap, 10,000 resamples, seed 0, 95% (as r5a).
That’s 30.0 points more, with an interval of [+26.8, +33.2]. But what did it learn that it didn’t already know? The control splits that in two. In the chart below each effect is the share of tasks with one failure outcome, averaged over each arm’s three seeds, and lower is better. SFT mainly improved filling in arguments, the one gain that needed the right calls. Calling when a call is needed improved too, but the control improved just as much. Choosing a tool, which was already nearly perfect, didn’t change.
Where SFT and the control land together, on calling and on BFCL’s irrelevance items, the change came from what both arms train on: calls of any kind, and the no-call rows they share (the one-tool rerun). On wrong arguments, SFT moves left and the control moves right, so real calls taught filling. On wrong function, SFT barely moves while the control gets much worse. The paired differences and their 95% intervals are in the receipts. The base model’s untrained and trained shares are in the side-by-side chart above.
Calling first, from cmd_sft_report (_r5d):
1
2
3
4
5
6
7
8
9
calling when a tool fits [primary 1]
1 = no call or unparseable
on ours, tasks that need a call, 800 tasks
untrained 13.00% SFT 0.63% control 0.46% (seed means)
difference points 95% interval excludes 0
---------------------------------------------------------
SFT - untrained -12.4 [-14.7, -10.1] yes
control - untrained -12.5 [-14.8, -10.3] yes
SFT - control +0.2 [-0.2, +0.5] no
SFT made the model far more likely to call when a call is needed: tasks with no call fell from 13.00% to 0.63%. Interestingly, the control fell just as far, to 0.46%, so the gap between the arms, +0.2 points, has an interval that includes 0. The format was already there (§3 found no unparseable reply), so seeing tool-calling examples was enough to make the model use it nearly every time, even when the examples’ calls were wrong.
Filling is where the two arms part (same report, _r5d):
1
2
3
4
5
6
7
8
9
filling [primary 2]
1 = wrong arguments
on ours, tasks that need a call, 800 tasks
untrained 25.5% SFT 8.4% control 34.4% (seed means)
difference points 95% interval excludes 0
---------------------------------------------------------
SFT - untrained -17.1 [-20.1, -14.2] yes
control - untrained +8.9 [+4.8, +13.0] yes
SFT - control -26.0 [-29.2, -22.9] yes
Wrong arguments fell from 25.5% of tasks to 8.4% under SFT, 17.1 points. The control actually got worse at filling, up 8.9 points to 34.4%, since it trained on arguments copied from other rows. So this gain came from learning which values go with which request rather than from practice with the format, and it’s the part of SFT that needed ToolACE’s right calls. Most of the 30.0-point rise in right is this: wrong arguments go from 204 tasks to 62-73 per seed (every run’s outcomes). The control is right almost nowhere: it calls the wrong tool on most tasks, and when it picks the right one, it fills it with values from another row’s call.
Choosing, the harm check (same report, _r5d):
1
2
3
4
5
6
7
8
9
choosing (harm check only)
1 = wrong function or wrong number of calls
on ours, tasks that need a call, 800 tasks
untrained 1.5% SFT 1.0% control 65.0% (seed means)
difference points 95% interval excludes 0
---------------------------------------------------------
SFT - untrained -0.5 [-1.4, +0.5] no
control - untrained +63.5 [+61.0, +66.0] yes
SFT - control -64.0 [-66.3, -61.5] yes
SFT didn’t change it: −0.5 points, with an interval that includes 0, from a start of 1.5%. On BFCL’s call items it moved slightly the other way, toward fewer wrong choices: −1.3 points [−2.5, −0.1], from 3.11% to 1.85% (same report, its BFCL choosing rows; not a primary comparison). The control is where choosing breaks, at 65.0%, which is what training on random tools should do (the control’s check).
Better at calling, worse at declining
But there was a downside. Where no tool fits, SFT made the model worse at declining (same report, _r5d):
1
2
3
4
5
6
7
8
9
declining when none fits [primary 3]
1 = called anyway
on ours, no tool fits, 200 tasks
untrained 46.5% SFT 77.7% control 83.5% (seed means)
difference points 95% interval excludes 0
---------------------------------------------------------
SFT - untrained +31.2 [+25.5, +37.0] yes
control - untrained +37.0 [+30.8, +43.2] yes
SFT - control -5.8 [-9.3, -2.3] yes
On our no-tool-fits tasks SFT called a tool anyway on 77.7% of them, against 46.5% before training, and the control did so even more often, 83.5%. In other words, SFT made the model better at calling tools and worse at knowing when not to, as it did the base model. The seeds disagree a lot here (same report, _r5c):
1
2
3
4
5
6
7
8
9
10
11
arm ours: declined BFCL irrelevance: declined
-----------------------------------------------------------------
untrained 107 of 200 (53.5%) 147 of 216 (68.1%)
SFT, seed 1 56 of 200 (28.0%) 216 of 216 (100.0%)
SFT, seed 2 74 of 200 (37.0%) 216 of 216 (100.0%)
SFT, seed 3 4 of 200 (2.0%) 216 of 216 (100.0%)
control, seed 1 15 of 200 (7.5%) 215 of 216 (99.5%)
control, seed 2 46 of 200 (23.0%) 216 of 216 (100.0%)
control, seed 3 38 of 200 (19.0%) 215 of 216 (99.5%)
declined: no <tool_call> tag (right). The effect, with intervals:
r5d, declining.
Seed 3 declined 4 times in 200 and seed 2 declined 74 times. That spread is what the interval above doesn’t cover: it resamples tasks for these three seeds, so it doesn’t say where a fourth run would land.
The literature hadn’t settled which way this would go. The authors of Hammer, a family of small on-device function-calling models, fine-tuning on the xlam-function-calling-60k dataset, report an “inverse relationship between the model’s ability to accurately execute function calls and its capacity for irrelevance detection” (Lin et al. §4.2, ICLR 2025). ToolACE trains not-calling on purpose: with its multi-type samples (“various types of tool-related data”) swapped for other kinds, their 8B model reached “only 6.99% accuracy in irrelevance detection” (Liu et al. App. E.2). ToolRL’s Table 1 has SFT on Qwen2.5 models of the same sizes as this post’s candidates, and the two sizes don’t agree: the 1.5B model’s irrelevance score fell from 82.49 to 60.14 with 400 SFT examples and to 71.34 with 4,000, while the 3B model’s fell from 56.01 to 8.11 with 400 and was 75.12 with 4,000, above where it started (Qian et al.). Their prompt isn’t ours and their SFT data includes written-out reasoning, so those numbers say only that the direction isn’t given. Here it went down, so post 10’s reward has to score declining, which execution match already does: on a no-tool-fits task, no call is the right answer.
On BFCL, SFT dropped the instruct model from 85.1% to 51.3%
The biggest surprise came when I scored the trained instruct model on BFCL’s call items (same report, _r5d):
1
2
3
4
5
6
7
8
9
right [primary 4]
1 = right
on BFCL call items, pooled, 900 tasks
untrained 85.11% SFT 51.26% control 3.48% (seed means)
difference points 95% interval excludes 0
---------------------------------------------------------
SFT - untrained -33.9 [-37.2, -30.4] yes
control - untrained -81.6 [-84.1, -79.1] yes
SFT - control +47.8 [+44.7, +50.8] yes
Before training it was right on 85.1% of them, and after SFT on just 51.3%. That’s a huge regression, especially next to how much the same model improved on our tasks. The untrained model had little room to gain here, 900 − 766 = 134 call items in §3, which is what Milestone 0’s condition (b) had flagged when 1.5B got 86 of its 100 BFCL dev calls right (§3). So I expected little change, and certainly not a loss. It’s mostly one outcome (same report, _r5b):
1
2
3
4
5
6
7
8
BFCL call items, pooled (900), greedy:
arm no call unparse wrong fn wrong n bad args right
---------------------------------------------------------------------
untrained 1 6 6 22 99 766
SFT, mean 376.3 0.7 10.3 6.3 45.0 461.3
seed 1 413 1 10 5 43 428
seed 2 356 0 8 8 48 480
seed 3 360 1 13 6 44 476
SFT answers 376.3 of the 900 call items on average with no call at all, where the untrained model did so once. The model hadn’t forgotten how to choose or fill; on many items it simply didn’t call. The control does the same, 370.0, and the difference between the arms has an interval that includes 0 (_r5d):
1
2
3
4
5
6
7
8
9
calling when a tool fits
1 = no call or unparseable
on BFCL call items, pooled, 900 tasks
untrained 0.78% SFT 41.89% control 41.33% (seed means)
difference points 95% interval excludes 0
---------------------------------------------------------
SFT - untrained +41.1 [+38.1, +44.1] yes
control - untrained +40.6 [+37.6, +43.6] yes
SFT - control +0.6 [-0.8, +1.9] no
So the problem comes from something both arms share, not from whether ToolACE’s calls are right.
What the refusals say. A missing call that both arms make equally isn’t about choosing a tool or filling one in, so I read the failed replies, and a pattern showed up. The model often refused to call, saying a required parameter was missing. Sometimes the parameter was already in the question; other times it wasn’t required at all. A typical one is BFCL’s simple_python_6, where the question gives a quadratic’s coefficients, a=2, b=5 and c=3. From the same cmd_sft_followup:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Example: simple_python_6 (SFT seed 1: in the question)
--------------------------------------------------------------------------
question:
What are the roots of the quadratic equation where a=2, b=5 and c=3 ?
solve_quadratic:
required: a, b, c
optional: none
BFCL's possible answer:
[{"solve_quadratic": {"a": [2], "b": [5], "c": [3]}}]
untrained right
SFT seed 1, no call:
The function "solve_quadratic" can find the roots of the quadratic \
equation, but it lacks the required "a" parameter. Please provide \
the coefficient of x².
asks for "a" in the question
control seed 1 wrong arguments
SFT, all seeds no call, right, right
SFT seed 1 asks for a, which the question gives, while the untrained model called solve_quadratic with exactly those values and was right. The model names the right function and then gives a reason not to call it that isn’t true. On this item only seed 1 misses; seeds 2 and 3 call it right.
To count how often this happens, the program reads which parameter each reply asks for. Most of these replies use one wording, that the function “lacks the required” parameter, so the name can be read off exactly, and each asked parameter is checked against the item’s schema and BFCL’s possible answer (same command, with the rule in parameter_kind):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Measured only on replies with the phrase lacks the required "p"
parameter (or "p" and "q" parameters), where the asked parameters
can be read off exactly. Each asked parameter, against the item's
function docs and BFCL's possible answer, first match wins:
not in the schema: no offered function has the parameter;
optional: the schema doesn't list it as required;
in the question: required, and one of BFCL's allowed values for it
appears in the question (strings: case-insensitive, as whole
words, a plural ending allowed; numbers: as a number; booleans,
lists, dicts: never);
may be omitted: required, but BFCL's answer allows leaving it out;
not found: required, and its value is not in the question.
A reply takes the first of its parameters' classes in the order
of the rows below.
Verbatim only, so "in the question" is a lower bound: a value the
question words another way (a date in another format, "two" for
2) counts as not found.
replies SFT control untrained
-------------------------------------------------
no call 1129 1110 1
with the phrase 639 599 0
in the question 229 228 0
optional 284 251 0
may be omitted 3 3 0
not found 120 116 0
not in the schema 3 1 0
On BFCL's 900 call items; SFT and control: 3 seeds pooled.
Of SFT’s 1,129 no-call replies over its three seeds, 639 use that wording. At least 229 of them ask for a value that’s in the question. It’s at least, because the check only finds a value written the way BFCL’s answer writes it, so “two” for 2, or a date in another format, counts as not found. Another 284 ask for a parameter the schema doesn’t require. The control’s counts are nearly the same, 228 and 251 of its 599. Only 120 of SFT’s ask for a required value the check can’t find in the question, and some of those values are there in other words. Every seed of both arms does it (per seed).
Both arms learned it, and besides the format the two arms share every row with no call: ToolACE’s 1,529 no-call rows go into both unchanged (§4), and many of them ask the user for a value the request didn’t give. The same command sorts those rows by the wording of their first reply, and sorts SFT’s and the control’s BFCL no-call replies the same way (opening_kind):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Each no-call row by its first assistant turn, first match wins:
1 "question lacks" opener: the turn opens "The [given]
question|query", then "lacks" or "does not provide";
2 lacks the required: it contains that phrase (the SFT replies'
wording);
3 asks outright: please / could you / can you / would you, then
provide, specify, share, tell, confirm, give or let me know;
4 no function fits: a fixed phrase list ("none of the", "no
functions", "do not support", "cannot be used", ...);
5 other. A keyword rule: classes name the wording, not the intent.
wording ToolACE SFT control untr
---------------------------------------------------------
1 "question lacks" opener 304 369 424 0
2 lacks the required 204 665 617 0
3 asks outright 289 36 25 1
4 no function fits 557 23 29 0
5 other 175 36 15 0
total 1529 1129 1110 1
ToolACE: the no-call rows (both arms train on them). SFT, control:
their no-call replies on BFCL's 900 call items, seeds pooled;
untr: the untrained model's. No call: no <tool_call> tag (strict).
rows with "lacks the required" 235 of 8504
in a no-call row's first turn 235
Any assistant turn containing the phrase, whatever its class above.
Of the 8,504 training rows, 235 contain “lacks the required”, all of them in a no-call row’s first turn. The two wordings that report a missing value, the “question lacks” opener (“The question lacks…”) and “lacks the required”, are about a third of ToolACE’s 1,529 no-call rows and nearly all of both trained models’ BFCL no-call replies, while asking outright and saying no function fits, common in ToolACE, nearly vanish (the chart below has the counts). So both trained models narrowed ToolACE’s several ways of not calling down to the two that say a value is missing. The classes are a keyword rule on the wording, not a judgement of what a reply means, but the shift is large.
Both trained models answer BFCL’s call items, when they don’t call, almost only by saying a value is missing, one of ToolACE’s five ways of declining. Classes are a keyword rule on the wording, not a judgement of meaning.
In ToolACE’s rows the value is meant to be missing. On BFCL the model says it’s missing when it’s in the question, or not required at all. So the models picked up a way of declining, saying a value is missing, without learning to check that it is. That explains how the failures read, but not why they happen on BFCL and hardly at all on our tasks, 5.0 no-call replies in 800 on average. The reason is in which tools a prompt offers (next).
The same habit shows up where it happens to be right, on BFCL’s irrelevance items (same report, _r5d):
1
2
3
4
5
6
7
8
9
declining when none fits [primary 5]
1 = called anyway
on BFCL irrelevance, 216 tasks
untrained 31.9% SFT 0.0% control 0.3% (seed means)
difference points 95% interval excludes 0
---------------------------------------------------------
SFT - untrained -31.9 [-38.0, -25.5] yes
control - untrained -31.6 [-37.7, -25.5] yes
SFT - control -0.3 [-0.9, 0.0] no
Both arms decline all or nearly all of them, and SFT minus control has an interval that includes 0. A model that asks for a missing value whenever it’s unsure declines every irrelevance item, so this is the same habit landing where it happens to be right. Our no-tool-fits tasks, where both arms got worse at declining, are the better test of whether SFT taught the model when no tool fits.
The likely cause: one-tool rows that never call
Both models’ weak spot on BFCL, and the no-call replies behind it, point to the training set. Eventually I traced them to a decision I’d made when preparing the training data. For the random-call control I had to leave out the rows that offer one tool and call it, because a random draw from a list of one would always pick the right tool. So in §4 I removed all 2,264 of them. But the rows with no call all stayed in, so that both arms learn declining from the same examples, and 514 of those offer one tool (the hatched block in the funnel there). That left a pattern I hadn’t intended: in every one-tool row either model trains on, the assistant doesn’t call. With two or more tools it’s the other way round: 6,975 rows make a call and 767 don’t. Nothing in the training set shows a model calling the only tool it’s offered.
BFCL’s simple and parallel categories offer a single function, and multiple and parallel_multiple offer several (§2). The instruct model’s right answers by category, from cmd_sft_report (_r5a):
1
2
3
4
5
6
7
8
9
10
11
12
SFT - untrained, paired by task (SFT: mean of 3 seeds):
category untrained SFT seed range gain 95% interval
----------------------------------------------------------------------
choose+fill 62.2% 95.6% 94.8-96.8% +33.4 [+29.7, +37.2]
tricky args 53.5% 73.0% 71.5-74.5% +19.5 [+13.3, +25.8]
no tool fits 53.5% 22.3% 2.0-37.0% -31.2 [-37.0, -25.5]
simple 90.6% 34.1% 28.9-38.3% -56.5 [-61.4, -51.4]
multiple 86.1% 79.6% 78.3-81.1% -6.5 [-12.4, -0.7]
parallel 81.1% 33.1% 26.1-39.4% -48.0 [-54.8, -40.9]
par_multi 77.22% 75.37% 72.2-79.4% -1.9 [-8.5, +5.0]
irrelevance 68.1% 100.0% 100.0-100.0% +31.9 [+25.5, +38.0]
BFCL calls 85.11% 51.26% 47.6-53.3% -33.9 [-37.2, -30.4]
Its losses sit on the one-function side: simple fell 56.5 points and parallel 48.0, while multiple fell 6.5 and parallel_multiple’s change, −1.9, has an interval that includes 0. The base model shows the same split from the other direction (its table above): it gained 47.0 and 65.9 points where several functions are offered, and 1.3 and 10.2 where one is. The misses are mostly no-call replies: the instruct model’s SFT gives no call on 225.3 of simple’s 360 items and 112.3 of parallel’s 180, on average over its seeds (by category). Our tasks always offer 3 to 5 tools (§2), so on them both models call, even when no tool fits.
So it looked as if SFT had learned a rule the training set taught by accident: with one tool offered, don’t call. ToolACE’s clarification wording would be how those refusals read, which is why most of them say a parameter is missing, but not their cause. Both arms share the one-tool rows, so the control would learn the rule too. A pattern across categories is still a guess, though, so I tested it.
Without those 514 rows, most of the one-function loss comes back
To test this explanation, I retrained the instruct model without those 514 rows. The one-tool rerun trains its real arm again, three runs with the same seeds and the main run’s settings, on the same set less its 514 one-tool rows with no call. From cmd_sft_data with --variant onetool:
1
2
3
4
5
training rows, the full real set 8504
left out (no call, 1 tool) 514
this variant 7990
With the one-tool rows that call already out (the control can't
randomise one tool), no training row offers a single tool.
The set is the only change. With 514 fewer rows, each run takes 1,000 optimizer steps instead of 1,064. There’s no control this time, since the question is what the real arm learned, and the untrained model isn’t scored again: its model, tasks, prompts and decoding are the main run’s, so its scores are too.
I fixed the prediction and the rule for reading it before the run. On BFCL’s one-function call items, simple and parallel together, right should rise against the main run’s real arm, and the prediction counts as confirmed if the 95% interval of that difference lies wholly above 0. I also predicted that the multi-function items and our tasks would barely move, since none of their prompts offers one tool, and made no prediction for declining. The report prints the rule beside its result, from cmd_sft_report with --profile onetool (_primary):
1
2
3
4
5
6
7
8
9
Leaving out the one-tool no-call rows raises right on BFCL's
one-function call items; confirmed if the interval excludes 0
upward. Paired by task, seed means.
primary: right on BFCL's one-function call items (simple + parallel,
540), onetool real - main real: +43.6 points [+39.8, +47.3], excludes 0
upward: yes -> confirmed
(untrained 87.41%, main real 33.77%, onetool real 77.35%; bootstrap,
10,000 resamples, seed 0, 95%, over 540 items.)
Confirmed. On those 540 items the main run’s SFT was right on 33.77%, and the rerun is right on 77.35%, +43.6 points [+39.8, +47.3], most of the way back to the untrained model’s 87.41%. The comparisons beside it (same report, _beside):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
set, share n main onetool points 95% interval
------------------------------------------------------------------------
one-function, right * 540 33.77% 77.35% +43.6 [+39.8, +47.3]
one-function, no call 540 62.5% 10.4% -52.1 [-55.7, -48.3]
multi-function, right 360 77.5% 81.5% +4.0 [+2.1, +5.9]
multi-function, no call 360 10.7% 6.0% -4.7 [-6.4, -3.1]
ours, call tasks, right 800 90.0% 89.8% -0.2 [-0.9, +0.6]
ours, no fit, declined 200 22.3% 17.0% -5.3 [-8.2, -2.5]
BFCL irrelevance, declined 216 100.0% 94.3% -5.7 [-8.8, -2.9]
* the primary comparison, above. points: onetool - main real.
Shares at more than one decimal where one would not give the points.
one-function: BFCL simple + parallel; multi-function: multiple +
parallel_multiple; ours, call tasks: the kinds that need a call;
no fit / irrelevance: declined is right. Predicted before the run:
multi-function and our tasks barely move (our tasks never offer
one tool); declining: no prediction.
The gain came from the no-call replies: on the one-function items, leaving out the 514 rows took the share with no call from 62.5% to 10.4%. The multi-function items moved a little, right up 4.0 points [+2.1, +5.9], and our call tasks didn’t move, −0.2 [−0.9, +0.6], as predicted. By category (outcome counts):
Without the one-tool rows that don’t call, SFT’s right answers on BFCL’s one-function categories come most of the way back to the untrained model’s, while the categories that offer several functions barely move.
Declining is where it cost something. On our no-tool-fits tasks the rerun declines on 17.0%, against the main run’s 22.3%, −5.3 points [−8.2, −2.5], and on BFCL’s irrelevance items on 94.3% against 100.0%, −5.7 [−8.8, −2.9]. Both intervals lie below 0, though I made no prediction for either. Our tasks never offer one tool, so the drop there isn’t the one-tool rule itself; one likely reason, which I haven’t tested, is that the 514 rows were a third of the set’s 1,529 no-call rows, so the rerun sees a third fewer examples of not calling. Earlier in this section I called BFCL’s 100% the same habit landing where it happens to be right; this measures part of it. Without the one-tool refusals in training, the model declines fewer irrelevance items, so those refusals were part of why BFCL’s irrelevance score looked perfect.
So the rerun strongly supports the explanation: the one-tool rows with no call caused much of the BFCL regression, and they were there because of a choice I made for the control. It doesn’t fully isolate the rule, though. Leaving out 514 rows also changed how many rows the model trains on, the share of them with no call, and the number of optimizer steps, so I can’t say how much of the gain is the one-tool pattern itself and how much is the changed balance of calls and refusals. The test covers the instruct model only. The base model wasn’t rerun, so for it the rule is still read from where it gained least, the same two categories (its table above).
Validation and reproducibility
The tables here back numbers quoted above, run by run. Each comes from cmd_sft_report (blocks r5a to r5d, in tinytools/src/tinytools/sftrun.py; the rerun’s in tinytools/src/tinytools/onetool.py) or from cmd_sft_followup in tinytools/src/tinytools/cli.py, which runs run in tinytools/src/tinytools/followup.py on the main run’s saved replies.
Both readings, every run. From cmd_sft_report with --profile base --reading tagfree (_readings in sftrun.py):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Right replies, count (share), on each reading. points: tag-free -
strict. changed: replies whose outcome differs between the readings
(any outcome, not only right).
ours, tasks that need a call (800), greedy:
arm strict tag-free points changed
------------------------------------------------------------
untrained 0 (0.0%) 98 (12.3%) +12.3 147
SFT, seed 1 702 (87.8%) 702 (87.8%) 0.0 0
SFT, seed 2 680 (85.0%) 680 (85.0%) 0.0 0
SFT, seed 3 696 (87.0%) 696 (87.0%) 0.0 0
control, seed 1 0 (0.0%) 0 (0.0%) 0.0 0
control, seed 2 1 (0.1%) 1 (0.1%) 0.0 0
control, seed 3 0 (0.0%) 0 (0.0%) 0.0 0
ours, no tool fits (200), greedy:
arm strict tag-free points changed
-------------------------------------------------------------
untrained 200 (100.0%) 168 (84.0%) -16.0 32
SFT, seed 1 1 (0.5%) 1 (0.5%) 0.0 0
SFT, seed 2 0 (0.0%) 0 (0.0%) 0.0 0
SFT, seed 3 1 (0.5%) 1 (0.5%) 0.0 0
control, seed 1 0 (0.0%) 0 (0.0%) 0.0 0
control, seed 2 0 (0.0%) 0 (0.0%) 0.0 0
control, seed 3 0 (0.0%) 0 (0.0%) 0.0 0
Read tag-free, 147 of the untrained model’s 800 replies to our call tasks change outcome, and 98 of them become right, 12.3%. On the no-tool-fits tasks it goes the other way, from 200 declines to 168, because 32 replies open with a call. The trained models put every call between the tags, so their two readings agree. So do the instruct model’s on every greedy reply, from the same command run on the instruct arm:
1
2
3
4
5
6
7
8
9
10
ours, tasks that need a call (800), greedy:
arm strict tag-free points changed
------------------------------------------------------------
untrained 480 (60.0%) 480 (60.0%) 0.0 0
SFT, seed 1 712 (89.0%) 712 (89.0%) 0.0 0
SFT, seed 2 717 (89.6%) 717 (89.6%) 0.0 0
SFT, seed 3 730 (91.3%) 730 (91.3%) 0.0 0
control, seed 1 1 (0.1%) 1 (0.1%) 0.0 0
control, seed 2 2 (0.3%) 2 (0.3%) 0.0 0
control, seed 3 0 (0.0%) 0 (0.0%) 0.0 0
The base model, outcome by outcome (same report, _r5b):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
ours, tasks that need a call (800), greedy:
arm no call unparse wrong fn wrong n bad args right
---------------------------------------------------------------------
untrained 653 0 26 0 23 98
SFT, mean 0.0 0.3 31.0 0.7 75.3 692.7
seed 1 0 0 17 1 80 702
seed 2 0 1 42 1 76 680
seed 3 0 0 34 0 70 696
control, mean 0.0 0.0 601.7 0.0 198.0 0.3
seed 1 0 0 654 0 146 0
seed 2 0 0 582 0 217 1
seed 3 0 0 569 0 231 0
BFCL call items, pooled (900), greedy:
arm no call unparse wrong fn wrong n bad args right
---------------------------------------------------------------------
untrained 650 0 138 33 15 64
SFT, mean 556.3 0.7 9.0 5.0 38.7 290.3
seed 1 579 0 10 4 40 267
seed 2 545 1 8 5 39 302
seed 3 545 1 9 6 37 302
control, mean 611.0 0.7 206.0 5.3 66.0 11.0
seed 1 629 1 214 2 45 9
seed 2 622 0 195 6 66 11
seed 3 582 1 209 8 87 13
Untrained, the base model’s commonest outcome on our tasks is no call, 653 of 800, and when it does write a call it’s most often right: 98, against 26 with the wrong tool and 23 with wrong arguments. After SFT no reply on our tasks lacks a call. The misses left are wrong arguments, 75.3 on average, and the wrong tool, 31.0, more often than the instruct model’s SFT picks it (8.0, below). On BFCL, SFT still writes no call on 556.3 of the 900 call items on average, more than the instruct model’s SFT (376.3, above).
Because each effect is a share of all tasks, filling looks worse after SFT on the base model: wrong arguments on 2.9% of tasks untrained and 9.4% after. A model that rarely calls rarely gets far enough to fill anything in, so right is the clearer measure here. The control picks the right tool on 24.8% of its calls, against chance at 26.4% (same report, the right-function rows). With no calling skill of its own to keep, it lands on chance, where the instruct model’s control stayed a little above it (34.8% against 26.3%, below).
The instruct model, outcome by outcome (same report, _r5b):
1
2
3
4
5
6
7
8
9
10
11
12
ours, tasks that need a call (800), greedy:
arm no call unparse wrong fn wrong n bad args right
---------------------------------------------------------------------
untrained 104 0 12 0 204 480
SFT, mean 5.0 0.0 8.0 0.3 67.0 719.7
seed 1 5 0 9 1 73 712
seed 2 10 0 7 0 66 717
seed 3 0 0 8 0 62 730
control, mean 3.7 0.0 519.3 0.7 275.3 1.0
seed 1 0 0 622 2 175 1
seed 2 10 0 463 0 325 2
seed 3 1 0 473 0 326 0
The control’s check. Its right-function rate shows the control does what it was built for (_r5b):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Right function among replies that decoded to calls, beside chance
(1/k for k tools offered): the control's diagnostic, not an effect.
ours, tasks that need a call (k = 3-5), all seeds pooled:
arm right function chance
-----------------------------------------
untrained 684 of 696 (98.3%) 26.2%
SFT 2361 of 2385 (99.0%) 26.3%
control 831 of 2389 (34.8%) 26.3%
BFCL multiple and par_multi, all seeds pooled:
arm right function chance
---------------------------------------
untrained 353 of 359 (98.3%) 39.7%
SFT 933 of 964 (96.8%) 39.2%
control 270 of 972 (27.8%) 39.3%
On our tasks the control picks the right tool on 34.8% of its calls, a little above chance at 26.3%, so it ignores the request without avoiding the right tool. On BFCL’s multiple and parallel_multiple it picks it on 27.8%, below chance at 39.3%. Before the run I’d decided that a control below chance had learned something beyond ignoring the request, and that its gap with SFT then shouldn’t be read, so on BFCL I don’t read SFT minus control for choosing.
The missing-parameter replies, per seed (same cmd_sft_followup):
1
2
3
4
5
6
7
8
9
10
arm no call phrase in question optional
---------------------------------------------------
SFT 1 413 237 89 102
SFT 2 356 208 80 86
SFT 3 360 194 60 96
control 1 376 214 85 87
control 2 427 227 93 90
control 3 307 158 50 74
phrase: with the phrase; in question, optional: two of its
classes above. Per seed, of 900 call items.
The one-tool rerun by category, with each outcome counted (same report, _bfcl_outcomes):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
category arm n right no call bad args wrong fn wrong n
------------------------------------------------------------------------
simple untrained 360 326 1 32 0 0
main real 122.7 225.3 11.0 0.0 0.3
onetool 292.0 34.3 33.0 0.0 0.0
parallel untrained 180 146 0 15 0 15
main real 59.7 112.3 3.7 0.0 4.3
onetool 125.7 22.0 18.7 0.0 13.7
multiple untrained 180 155 0 23 2 0
main real 143.3 25.0 10.3 1.0 0.3
onetool 155.3 12.3 11.0 1.3 0.0
par_multi untrained 180 139 0 29 4 7
main real 135.7 13.7 20.0 9.3 1.3
onetool 138.0 9.3 20.0 11.3 1.3
Counts, greedy; main real and onetool: the mean over their seeds.
The rest of n is unparseable replies. simple and parallel offer
one function; multiple and par_multi several.
On simple, no call falls from 225.3 replies to 34.3, and most of the calls that come back are right. Wrong arguments come back with them, to about the untrained model’s count (33.0 against 32), because a model that doesn’t call can’t fill a value wrongly. The rerun still gives no call on 34.3 simple items and 22.0 parallel ones, where the untrained model gave 1 and 0, which is most of what keeps it below 87.4%. On multiple, no call halves, from 25.0 to 12.3, which is most of the multi-function gain.
6. Is it ready for a reward?
All of this was preparation for the next experiment, which brings me back to post 8’s lesson. GRPO samples several answers to the same task, a group, and compares each answer’s reward with the group’s average. An answer that scores above the average gets pushed up, and one below it gets pushed down (post 8 §4). That only works when the rewards in a group differ.
Here’s an illustration, made up rather than measured: three tasks, eight sampled calls each, with ✓ for a call that earns reward 1 and × for one that earns 0.
| Group | The 8 answers | What GRPO can do with it |
|---|---|---|
| All wrong | × × × × × × × × | Nothing. Every answer gets 0, the same as the average, so there’s no better call to reinforce. |
| Mixed | ✓ × × ✓ × ✓ × × | Push up the three right calls and push down the five wrong ones. |
| All right | ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ | Nothing. Every answer gets 1, the same as the average, and the model already solves the task. |
The middle row is a mixed group, as defined in §3: some answers are right, and others are wrong. Only mixed groups give GRPO a learning signal, because they contain both successful and unsuccessful answers to compare. But having a learning signal doesn’t guarantee that the model will learn from it.
This brings us to the question for post 10: does SFT create more opportunities for reinforcement learning, or does it solve so many tasks that fewer opportunities remain? To find out, I use the same mixed-group measure as post 8.
What’s measured. On the 500 tasks of train-sample, drawn with a fixed seed from post 10’s training split (so post 10 trains on the same kind of task this measures), each model samples \(G = 8\) answers per task at \(T = 1\). The reward is post 10’s: 1 for an execution match, and on no-tool-fits tasks 1 for declining. The report counts the tasks that are all wrong, mixed and all right for the untrained model, each SFT seed and each control seed. Its last column is mixed groups per 1,000 answers, post 8’s unit: the mixed share times \(1000 / G\), so that group sizes can be compared at equal sampling cost. The post quotes the 400 tasks that need a call, the same kind of denominator Milestone 0’s condition (c) used (there, 160 dev tasks).
SFT moves the two models in opposite directions here: it lowers the instruct model’s share of mixed groups and raises the base model’s.
The instruct model: fewer mixed groups, mostly to all right
From cmd_sft_report (_r6a in tinytools/src/tinytools/sftrun.py):
1
2
3
4
5
6
7
8
9
10
Groups, tasks that need a call:
arm tasks all wrong mixed all right share per 1k
--------------------------------------------------------------
untrained 400 79 197 124 49.3% 61.6
SFT 1 400 17 126 257 31.5% 39.4
SFT 2 400 18 127 255 31.8% 39.7
SFT 3 400 16 108 276 27.0% 33.8
control 1 400 396 4 0 1.0% 1.3
control 2 400 396 4 0 1.0% 1.3
control 3 400 397 3 0 0.8% 0.9
SFT leaves fewer mixed groups than the untrained model’s 49.3%, and still far above the 10% that condition (c) asked for. The control has almost none, because it’s all wrong on nearly every task.
Fewer mixed groups can mean two very different things. A mixed task that becomes all right is one SFT taught, so a reward has less left to do there. A mixed task that becomes all wrong is damage. And an all-wrong task can become mixed, which is new signal. So the report follows each task from its untrained group to its group after training.
Sampling is random, though, and some tasks change group with no training at all. To measure how many, the untrained model samples the same tasks a second time with a different generation seed. Its movements are the noise floor, the report’s name for this sampling baseline: how far drawing eight answers again moves tasks on its own (_r6a):
1
2
3
4
5
6
movement, need a call share of 400 95% interval, %
-------------------------------------------------------
mixed -> all right 8.0% [5.5, 10.8]
all wrong -> mixed 3.0% [1.5, 4.8]
mixed -> all wrong 6.3% [4.0, 8.8]
all wrong -> all wrong 16.8% [13.3, 20.5]
Sampling again moves 8.0% of the tasks from mixed to all right and 6.3% from mixed to all wrong, with no training at all. A movement after training is read only beyond that floor. That’s a comparison of shares: it says how much more often a movement happens after SFT than after a redraw, not how many individual tasks SFT itself moved. The report prints the four movements I named before the run; the rest of the 400, such as tasks that stay mixed or stay all right, aren’t shown, so the rows don’t add up to 100%. SFT’s, with each one’s interval (same report, _r6a):
1
2
3
4
5
6
movement, need a call (400) SFT floor beyond 95% interval
-------------------------------------------------------------------
mixed -> all right 29.5% 8.0% +21.5 [+17.2, +25.9]
all wrong -> mixed 9.4% 3.0% +6.4 [+3.8, +9.2]
mixed -> all wrong 0.7% 6.3% -5.6 [-8.1, -3.2]
all wrong -> all wrong 3.6% 16.8% -13.2 [-16.5, -9.9]
Of the four, the largest movement beyond the floor is mixed to all right, +21.5 points: SFT taught those tasks, and a reward has less to do there. All wrong to mixed, +6.4 points, is new signal on tasks that had none. Mixed to all wrong happens less often after SFT than after the redraw. And all wrong to all wrong, the tasks that neither the untrained model nor SFT gets right in 8 tries, is 3.6% under SFT against 16.8% under the redraw. So the instruct model loses mixed groups mostly because SFT makes them right every time. Starting from SFT, post 10 would have few tasks that neither model can do, and its signal would come from the mixed groups that are left.
The control, for contrast (same report, _r6a):
1
2
3
4
5
6
movement, need a call (400) control floor beyond 95% interval
---------------------------------------------------------------------
mixed -> all right 0.0% 8.0% -8.0 [-10.8, -5.5]
all wrong -> mixed 0.0% 3.0% -3.0 [-4.8, -1.5]
mixed -> all wrong 48.8% 6.3% +42.5 [+37.6, +47.3]
all wrong -> all wrong 19.8% 16.8% +3.0 [+1.5, +4.8]
48.8% of the tasks go from mixed to all wrong, 42.5 points beyond the floor. Training on random calls removes the signal a reward needs. SFT, trained on the same rows with the right calls, loses mixed groups mostly to all right instead.
The base model: from all wrong to mixed
The base model tells almost the opposite story. It gets the same measure, read tag-free as in §5. From cmd_sft_report with --profile base --reading tagfree (_r6a):
1
2
3
4
5
6
7
8
9
10
Groups, tasks that need a call:
arm tasks all wrong mixed all right share per 1k
--------------------------------------------------------------
untrained 400 376 24 0 6.0% 7.5
SFT 1 400 19 170 211 42.5% 53.1
SFT 2 400 20 197 183 49.3% 61.6
SFT 3 400 20 172 208 43.0% 53.8
control 1 400 398 2 0 0.5% 0.6
control 2 400 400 0 0 0.0% 0.0
control 3 400 399 1 0 0.3% 0.3
Untrained, the base model is all wrong on 376 of the 400 tasks: on each of those, none of its eight answers is right. It’s mixed on 24, 6.0%. After SFT it’s mixed on more tasks than any of the instruct model’s SFT runs, about as many as the untrained instruct model. The control is all wrong nearly everywhere, as it was for the instruct model.
SFT moves the two models in opposite directions. The instruct model’s mixed groups fall from 49.3% of the tasks to 31.5%, 31.8% and 27.0% as tasks become all right; the base model’s rise from 6.0% to 42.5%, 49.3% and 43.0% as tasks leave all wrong.
Again the movements say why. Against the base model’s own noise floor (same report, _r6a):
1
2
3
4
5
6
movement, need a call (400) SFT floor beyond 95% interval
-------------------------------------------------------------------
mixed -> all right 3.8% 0.0% +3.8 [+2.1, +5.6]
all wrong -> mixed 42.8% 4.0% +38.8 [+34.0, +43.5]
mixed -> all wrong 0.2% 4.5% -4.3 [-6.5, -2.5]
all wrong -> all wrong 4.8% 90.0% -85.3 [-88.6, -81.8]
Of the four movements, the largest beyond the floor here is all wrong to mixed: 42.8% of the tasks, against 4.0% when the untrained model just samples again, +38.8 points with an interval of [+34.0, +43.5]. Those are tasks the untrained model never got right in eight tries and SFT now gets right some of the time. Few go from mixed to all right, because the untrained base model had few mixed tasks to begin with. On the strict reading, where the untrained base model has no mixed group at all, the same movement is +44.9 points [+40.5, +49.3] (the same report on the strict reading).
The four movements I named before the run leave one out, though. The report’s task-by-task table shows that the biggest single thing SFT did to the base model’s groups was to turn tasks it always got wrong into tasks it always gets right. Pooled over the three SFT runs, which counts each task once per seed, 1,128 task-runs that need a call were all wrong untrained. 557 of them became all right and 514 became mixed. From the same tag-free report (_r6a):
1
2
3
4
5
6
7
8
9
r6a: untrained -> SFT, task by task
--------------------------------------------------------------------------
Rows: the task's group untrained; columns: under SFT. Pooled:
summed over the 3 seeds (each task once per seed).
scope untrained all wrong mixed all right total
--------------------------------------------------------------------
pooled, need a call all wrong 57 514 557 1128
mixed 2 25 45 72
all right 0 0 0 0
An all-right group gives GRPO nothing to push on, just like an all-wrong one, so those 557 are tasks where SFT has already done the work and a reward has nothing left to do. Post 10’s signal from the base model is in the 514 task-runs that became mixed.
Beyond what sampling again moves, the instruct model’s mixed groups mostly become all right. On the base model, SFT sends 42.8% of the tasks from all wrong to mixed, new signal for a reward, and 557 of its 1,200 task-runs (3 seeds pooled) straight to all right. The control sends 48.8% of the instruct model’s tasks from mixed to all wrong, and leaves the base model’s all wrong on 93.8%.
That leaves post 10 three starting points with signal for a reward: the untrained instruct model and both models after SFT. The base model after SFT stands out. It now calls tools, it’s nearly as accurate on our tasks as the instruct model after SFT, and it still makes enough mistakes for a reward to work with. But it almost never declines where no tool fits (§5), and while post 10’s reward scores declining, GRPO can only push up a decline the model actually samples. Which start post 10 uses is its first question (what’s next).
What I learned
I started this experiment thinking SFT would be a straightforward preparation step before reinforcement learning. It turned out to be more interesting than I expected.
For a base model, SFT can make an enormous difference, teaching it to write the structured calls it never wrote before. For an instruction-tuned model, the gains are more incremental and mostly come from filling in arguments more accurately.
But improving one behavior doesn’t necessarily improve everything else. The model can become more willing to call tools while becoming less willing to decline. And a seemingly reasonable data-filtering decision can introduce a pattern that seriously hurts performance on a different benchmark: leaving out the one-tool rows that call, for the control’s sake, left only one-tool rows that don’t, and the model most likely learned exactly that. The problem was a pattern I’d put into the data myself.
The next question is whether reinforcement learning can take tool calling further than SFT, especially when a call is rewarded for what it does rather than for how closely it matches a reference.
What’s next
Post 10 runs post 8’s loop on tool calls: GRPO on our tasks’ training split, with execution match as the reward. Its first question is the one this post leaves open: does SFT before reinforcement learning help? Post 10 could start from the untrained instruct model, which has more mixed groups and doesn’t ask for values it’s already been given, from the instruct model after SFT, which fills arguments better and has fewer tasks left to learn, from the base model after SFT, which has the most mixed groups of the trained models but almost never declines, or from more than one, side by side. I’ll decide that when I plan post 10, from §6’s numbers.
The one-tool rerun shapes what post 10 trains on, whichever start it picks. The instruct model, trained by SFT on the full set, carries the one-tool habit, the base model’s weak simple and parallel scores suggest it does too, and the base model after SFT, the trained model with the most mixed groups, wasn’t rerun without it. So the direction for now is to add tasks that offer a single tool to post 10’s training set, made by our own task generator, and to read whether reinforcement learning removes the habit on BFCL’s simple and parallel items. BFCL never goes into training; it stays a test the model hasn’t seen.
Post 11 lets calls feed into further calls: a tool’s result comes back, and the model uses it for the next step, which needs tasks with state, like a database, and a way to keep tool results out of the loss.
Appendix: all notation
The terms this post leans on; anything not listed is defined where it first appears. Post 8’s appendix covers log-probs, sampling, pass@8 and GRPO.
| Term | Means | In this post |
|---|---|---|
| tool, function | a program the model can ask to have run | 5 that run, 6 distractors |
| tool call | text naming a tool and its arguments, in a shape a program can parse | JSON between <tool_call> tags |
| JSON | a plain-text format for nested names and values | the tool list and every call |
| schema | a tool’s name, description and typed parameters | one per tool in the prompt |
| parameter, argument | a value a tool takes; the value a call gives it | date, "2026-04-04" |
| chat template | the markers that wrap each turn of a conversation for an instruct model | Qwen2.5’s, with its tool form |
| parse | read text into a structure a program can use | a tool name and its arguments |
| AST | abstract syntax tree: code’s structure, not its characters | how expressions are compared; how BFCL reads Python-style calls |
| reference call | the call written down in advance as right | one per task |
| exact match | the same tool and arguments as the reference, after normalizing | printed beside execution match |
| execution match | running the call gives the reference’s result | the headline, and post 10’s reward |
| frozen clock | the fixed date and time every task assumes | Wednesday 2026-03-11, 09:30 |
| distractor | a tool offered but never the answer | 6 |
| no tool fits, irrelevance | a task where the right answer is no call; BFCL’s name for it | §2, §3 |
| simple, multiple, parallel, parallel_multiple | BFCL’s categories: one tool or several offered, one call or several | §2 |
| outcome | one of no call, unparseable, wrong function, wrong number of calls, wrong arguments, right; or declined, called anyway | §3 |
| base model | the same Qwen2.5 model before instruction tuning | §3, §4 |
| token cap | the most new tokens a reply may have; a reply still going is cut off there | 512 |
| SFT | supervised fine-tuning: raising the log-prob of turns someone wrote | §4 |
| masked | read as context, not scored | system and user turns |
| epoch | one pass over the training rows | 2 |
| embedding table, tied | one row per token, read at the input; tied: the same table scores tokens at the output | §4 |
| norm, cosine similarity | a vector’s length; how alike two vectors’ directions are, 1 when they point the same way | §4, the four rows |
| base arm | the same SFT on the base model, with four special-token rows trained beside LoRA | §4 |
| arm | one condition of the experiment: SFT (the real arm) or the control; the base arm and instruct arm are each model’s runs | short version, §4 |
| seed | the number that sets a run’s random choices: the adapters’ starting values and the row order | three per arm |
| real arm, control | training on ToolACE’s calls; on random calls to the row’s own tools | §4 |
| \(k\), \(1/k\) | tools offered in a row; the chance a uniform draw picks the right one | §4 |
| the four effects | calling when a tool fits, filling arguments, declining when none fits, choosing the tool (a harm check) | §5 |
| strict, tag-free reading | a call counts only between <tool_call> tags; a reply that opens with a call’s JSON counts too | §5 |
| one-tool rows | training rows that offer a single tool; only those with no call are trained on | §4, §5 |
| one-tool rerun | the instruct model’s real arm trained again without the 514 one-tool rows with no call, so no training row offers one tool | §5, 7,990 rows |
| bootstrap interval | the middle 95% of a difference recomputed over tasks drawn with replacement | §5 |
| mixed group | a task’s \(G\) samples include right and wrong answers | §3, §6, \(G = 8\) |
| noise floor | how far tasks move between groups when the untrained model is just sampled again | §6 |
| Milestone 0 | the first run, which picks the model | Setup |
References
- Liu et al., ToolACE: Winning the Points of LLM Function Calling (ICLR 2025; arXiv v2) — the training data of §4. Abstract: “a comprehensive API pool of 26,507 diverse APIs” and “Our model and a subset of the data are publicly available”; §2.2.1: “three agents—user, assistant, and tool—each simulated by an LLM” and “four types of function-calling dialogs: single function calls, parallel function calls, dependent function calls, and non-tool-use dialogs”; §2.3: rule checks “without the need for actual execution”, then a model checker; App. E.2 / Table 7, without its multi-type samples, “only 6.99% accuracy in irrelevance detection” (cited in §5). Dataset: Team-ACE/ToolACE (Apache-2.0).
- Patil et al., The Berkeley Function Calling Leaderboard (BFCL): From Tool Use to Agentic Evaluation of Large Language Models (ICML 2025, PMLR 267:48371-48392) — §4.1’s AST check, App. B’s irrelevance items and App. C.2’s category definitions, quoted in §2; App. E.1’s sources of functions, quoted in §4. The leaderboard names
bfcl-eval2025.12.17 as the version it evaluates with; code in gorilla. - Qwen Team, Qwen2.5 Technical Report (2024; arXiv v2) — §2: “adding two new tokens for tool functionality”. Cited in §1.
- Qwen, Function Calling (Qwen2.5 documentation) — the tool template of §1, and “Qwen2.5 were pre-trained with various types of templates that could support function calling”.
- Qian et al., ToolRL: Reward is All Tool Learning Needs (NeurIPS 2025) — Table 1’s irrelevance scores for raw and SFT models, cited in §5 with its caveats: its own prompt, and SFT data with written-out reasoning.
- Lin et al., Hammer: Robust Function-Calling for On-Device Language Models via Function Masking (arXiv v2; published at ICLR 2025 as Robust Function-Calling for On-Device Language Model via Function Masking) — §4.2’s “inverse relationship” between calling accuracy and irrelevance detection, cited in §5.