Repository navigation
Add the BFCL chat regimes: native function calling and prompting - #429
Conversation
Only vllm_server reads LMRequest.tools; vllm, litellm, huggingface and olmo_core ignore the field. Nothing populates it yet, but the BFCL tool calling regimes will, and a run against one of those providers would show the model a question with no functions attached, which it answers in prose. The task would report an accuracy near zero, reading like a weak model rather than a misconfigured run. Providers declare whether they carry tool schemas, alongside supports_images, and the harness stops a request before sending one that would be dropped. vllm_server also refuses when it started its own server without --enable-auto-tool-choice, since the server then answers in plain text and parses no tool calls; an external server is given the benefit of the doubt, its flags not being knowable from here. Mock accepts tools so a tool calling task stays previewable. The check runs from _apply_config rather than from the harness methods that carry the image check, because the async runner reaches the provider through a scaffold or directly and those methods are not on its path. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
BFCL addresses an instruction-tuned model, through a tool calling API or a chat template. Only the completion reformulation was registered; this adds the two regimes the benchmark defines, which differ from it and from each other only in how the functions reach the model and how its calls are read back. Native function calling sends the function documents as tool schemas and reads the calls back from tool_calls. It is what BFCL means by its headline numbers, so it takes the bare task name, and the completion regime moves to :base. A spec that named the completion regime before now names this one rather than failing, so results recorded under a bare spec are not comparable across this change. The prompting regime writes the functions into a system prompt and reads [func(arg=value)] text back, which needs no server-side tool parsing and so runs against any chat endpoint. Tool names reach the endpoint sanitized, since many BFCL function names do not match what a tool name may be, and the instance carries the map that restores the dataset's spelling before the checker sees a call. fewshot_source now names the exemplar set only for the regimes that can show exemplars. Naming it for native function calling, which cannot, would make every such task's hash follow exemplars it never prompts with. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
gregorybchris
left a comment
There was a problem hiding this comment.
This review was generated by an agent following
REVIEW_GUIDE.md. It is not from a human reviewer. Reply in the PR thread and a maintainer will follow up.
Looks good overall! The parity table against the original BFCL run is good evidence, and the hash bookkeeping is careful. A few things we should address before merging.
I found two blocking issues. Both are in the new tool-support guard. The first breaks existing agentic harnesses on API models. The second means the most likely misconfiguration still scores zero silently, which is the outcome the guard exists to prevent. The non-blocking items are about variant composition, the extraction interface, and process.
I ran lint, format, ty, and the unit suite locally on the PR head. All pass (2883 passed). CI is green.
Blocking
-
src/olmo_eval/harness/harness.py:373
The check fires for harness-level tools as well as request-level ones, so every tool-carrying harness preset now fails on a litellm provider. Harness presets yield their provider kind to the model preset (merge_model_provider), so-m gpt-4o --harness web_search_agentresolves toLiteLLMProvider. Before this PR that ran: theopenai_agentsandopenhandsscaffolds send the tools throughprovider.get_openai_client(), andopenhandshas an explicitLiteLLMProviderbranch. Nothing was being dropped on that path. I reproduced it by building each preset withhas_tools(codex_agent,codex_completion,dr_tulu,dr_tulu_crawl4ai,paper_search_agent,web_search_agent,web_search_agent_crawl4ai) with aLiteLLMProviderinstance and calling_apply_config. All seven raiseValueError: LiteLLMProvider does not support tool requests. In the async runner,_apply_configis called outside thetryatsrc/olmo_eval/runners/asynq/processing.py:109, so this takes down the worker.
Please scope the guard to the path that actually drops tools: request-level tools sent through the provider's owngenerate/agenerate, with no scaffold. Please also add a test that a tool-carrying harness with a scaffold and a provider that hassupports_tools = Falsestill gets through_apply_config.tools = self.config.tool_schemas if self.config.has_tools else request.tools if request.tools and not self.config.scaffold: self._check_tools_supported()
-
src/olmo_eval/inference/providers/vllm_server.py:913
With a managed server and noenable_auto_tool_choiceoverride, every instance scores 0.0 and nothing is recorded as failed. That is the misconfiguration the README and PR description say "fails loudly". TheValueErrorraised in_generate_chatdoes not reach the runner:dispatch_concurrentcatches it per request and returnsNone.agenerateturnsNoneinto[](vllm_server.py:1052).request_error([])returnsNonebecause the output list is empty (src/olmo_eval/inference/errors.py:49).process_batchputs aResultItemwithoutputs=[]anderror=None.is_hard_failureis False, so the instance is scored.AccuracyMetric.computereads a missing score as 0.0 (src/olmo_eval/common/metrics/base.py:133).
I reproduced the provider half by calling
agenerateon aVLLMServerProviderwith_tool_calls_parsed = False. It logs the warning and returns[[], []], andrequest_erroron that isNone. The new test attests/harness/test_tool_support.pycalls_generate_chatdirectly, which is why it does not catch this.
Part of this is a deficiency in the framework. A provider exception becomes an empty output list with no error attached, and an empty output list scores as zero. That deserves its own fix and an issue. For this PR, could we fail before dispatch? Two options:- (a) Expose the parsed-tool-calls state as a public property and check it in the harness guard, next to
supports_tools. The guard then raises before any request goes out. - (b, preferred) Remove the need for the flag.
src/olmo_eval/runners/asynq/workers.py:91already setsenable_auto_tool_choiceautomatically when the harness has tools. Extending that to tasks whose formatter emits tools makes-t bfclwork with no override. It also drops the--harness default -o provider.kwargs.enable_auto_tool_choice=truestep from the README and docstring.
Either way, please add a regression test that goes through
agenerate(orprocess_batch) and asserts that the run fails or the instance is recorded as a hard failure. It should not come back as an empty output.
Non-blocking
-
src/olmo_eval/evals/tasks/bfcl/__init__.py:1138
The:Nshotvariants are still registered on the bare (native function calling) task, where they change the hash and nothing else.bfcl_simple:2shothashes to51f77712…, whilebfcl_simplehashes toc93287ca…. Withfewshot_source=None,get_fewshot()falls back to the main data source and returns 2 instances, whichBFCLToolFormatter.formatignores. So two different hashes produce identical requests. ShouldBFCLToolFormatterrejectnum_fewshot > 0, or should the shot variants only compose with:promptand:base? -
src/olmo_eval/evals/tasks/bfcl/__init__.py:1134
Variant order silently changes the shot count.bfcl_simple:2shot:baseresolves to 5 shots and has the same hash asbfcl_simple:base(9f481407…), because:basesetsnum_fewshot=5after:2shothas applied. The README documentsbfcl_simple:base:2shot, but the reversed spelling is an easy mistake and gives no error. Could:baseleavenum_fewshotalone when an earlier variant set it, or could registration reject the reversed order? -
src/olmo_eval/evals/tasks/bfcl/__init__.py:310and:1025
Extraction readscall_sourceandlenientofftype(formatter)withgetattrdefaults. That couples the task to formatter class attributes that no interface declares. A new formatter that forgets them silently gets strict text decoding. Could the three formatters share a smallBFCLFormatterbase that declaresdecode(output, language, name_map), with each regime implementing it?CallSourcewould then go away. If it stays, it should be aStrEnumorLiteral. -
src/olmo_eval/evals/tasks/bfcl/__init__.py:1040
Against an externalbase_urlserver that does not parse tool calls, the guard gives the benefit of the doubt. Every AST instance then scores 0 and every irrelevance instance scores 1.0, and the only trace isbfcl_no_tool_calls_with_texton each prediction. Could we log one warning per task when most outputs carry that flag, so the run log shows it without opening predictions? -
Breaking change to the bare spec. I confirmed the description's claim:
bfcl_simple:base,bfcl_java:base,bfcl_live:baseandbfcl_simple:base:2shothash identically to the old bare specs. That means rows stored since 2026-09-18 under the namebfcl_simpleshare a hash with the newbfcl_simple:base, while the namebfcl_simplenow means native function calling. Anything that groups by task name will mix the two regimes. Do we know whether such rows exist in the shared store? If they do, could we note in the PR how to tell them apart (by hash)? -
Process. The nested-suite flattening in
_compute_child_averagemakes thebfclsuite report 0.6865 where the correct figure is 0.6962. That is a persisted-result error in a suite this PR now registers three times. I could not find an open issue for it. Could you file one and link it here? Also, #340 and #341 add BFCL v4 as external evaluations. Is there a plan for how those relate to these native-FC tasks, so we do not end up with two BFCL implementations that score differently?
Nits
- Nit:
src/olmo_eval/evals/tasks/bfcl/__init__.py:1123—:promptkeepsfewshot_sourcewithnum_fewshot=0. Its hash therefore follows an exemplar set it does not show, which is the situation the description gives as the reason for dropping it from the bare regime. This is fine if it is deliberate so that:prompt:Nshotworks. A one-line comment would help. - Nit:
src/olmo_eval/evals/tasks/bfcl/__init__.py:233— BFCL's_cast_to_openai_typeraisesKeyErroron an unknown item type; this version maps it to"string". That is harmless on the v3 data, but it is an unnamed divergence. Please add a comment or match upstream. - Nit:
src/olmo_eval/harness/harness.py:105— the docstring's reasoning about the async runner path would be stale once item 1 changes where the check runs. Please keep it general.
Before merge
Please fix blocking items 1 and 2, each with the regression test described. Please also file the suite-flattening issue from non-blocking item 6. After that, you may merge once CI is green. The other non-blocking items can be follow-ups if you prefer. If you defer them, please file issues for items 1 and 3.
The chat regimes asked for a flat 1024 tokens at temperature 0. BFCL asks for up to 4096, shrunk to the room the prompt leaves in the context window, and samples at 0.001. The fixed budget cost accuracy on replies that reason before calling, and a prompt that left less than 1024 tokens made the server reject the whole request rather than answer in the space available. Providers that cannot establish the window or the prompt length generate as they did before. The completion regime has no counterpart upstream and keeps its own budget. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
The guard refused any request whose harness carried tools, including the agentic presets, whose scaffolds send their tools over their own client. On an API model each of those presets raised from the worker. The guard now checks only requests that carry tools and go to the provider without a scaffold. A vLLM server started without tool-call parsing refused tool requests one at a time. Dispatch caught each refusal and handed back an empty output with no error, so every instance scored zero and none failed. The refusal now covers the whole batch before dispatch, which the runner records as a failure of each instance. The runner now also starts the server with tool-call parsing whenever a task sends tool schemas, as the worker already does for a harness with its own tools, so native function calling needs no provider override. An explicit setting and an external server are left as given. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
|
Thanks for the review. Both blocking items are fixed in ae42382, and CI is green on it. Blocking 1: the guard refused scaffolded harnesses. The check in if request.tools and not self.config.scaffold:
self._check_tools_supported()
Blocking 2: a server that doesn't parse tool calls scored zero silently. I went with option (b), plus a fix for the path that's still left:
You're right that the underlying cause is a framework one: a provider exception swallowed by dispatch turns into an empty output with no error attached, and that scores zero. This PR doesn't change that general path. Non-blocking 6. The suite flattening is filed as #448. It includes a reproduction on Non-blocking items 1–5, the question about BFCL v4 (#340, #341), and the two remaining nits ( |
TaskConfig.to_dict serialized every SamplingParams field, so adding fit_max_tokens_to_context changed the task hash of every registered task, not only the BFCL chat regimes that set it. The field is now emitted only when set, as the config already does for its own newer fields, and every task that doesn't use it hashes as it did on main. A test fails if a SamplingParams field is added without the same treatment. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
Follow-up to #387, which registered the BFCL v3 single-turn categories as a completion
task. This adds the two regimes BFCL actually defines, for instruction-tuned models.
Three regimes
They differ only in how the functions reach the model and how its calls are read back.
Everything downstream — the checker, the scorer, the suites — is shared.
bfcl_simpletool_callsbackbfcl_simple:prompt[func(arg=value)]text backbfcl_simple:baseSuites exist per regime:
bfcl,bfcl:prompt,bfcl:base, and the same for thenon_livefamily.Native function calling is what BFCL means by its headline numbers, so it takes the
bare name and the completion regime moves to
:base:bfcl_simple→ completionbfcl_simple:base→ completionbfcl_simple→ native function calling-t bfcl_simplewill not fail, it will run a different regime. Results recordedagainst a bare spec since #387 merged (2026-09-18) are not comparable with results
recorded after this lands. Task hashes for bare specs change too, from the regime, the
fewshot_sourcechange and the sampling change below.:basespecs are unaffected inmeaning; their hashes are unchanged.
Server flags for native function calling
None are needed:
vLLM only emits
tool_callswhen started with--enable-auto-tool-choice. The workeralready passed that flag when the harness carried tools. The runner now also passes
it when any task request carries tool schemas, which is how BFCL sends its
functions. An explicit
provider.kwargs.enable_auto_tool_choiceis left as given, andan external
base_urlserver is not reconfigured.Misconfiguration fails the run instead of scoring zero:
supports_toolsalongside the existing
supports_images. The harness refuses a request thatcarries tools and goes to a provider without that support with no scaffold in
between;
vllm(in-process) andlitellmboth ignoreLMRequest.tools.Scaffolded harnesses are exempt, because the scaffold sends its tools over its own
client. The agentic presets on an API model depend on that.
explicit
enable_auto_tool_choice=false.vllm_serverrefuses the whole batchbefore dispatch, so each instance is recorded as a hard failure. An external
base_urlis given the benefit of the doubt, since its flags can't be checked.Exemplar identity
fewshot_sourceis now set only on the regimes that can show exemplars. Nativefunction calling cannot, so naming a set there would make every such task's hash follow
exemplars it never prompts with.
Sampling
The chat regimes sample the way the leaderboard does: up to 4096 tokens at temperature
0.001.
max_tokensis cut back to whatever room the prompt leaves in the contextwindow, using the same arithmetic as BFCL's
base_oss_handler:min(4096, context − prompt − 2).The cut-back is a new
SamplingParams.fit_max_tokens_to_contextflag. When it is set,vllm_servercounts the prompt with the server's/tokenizeendpoint, using the realmessages, tools and
chat_template_kwargs. If the context window or the prompt lengthcan't be established,
max_tokensis sent unchanged, so other providers behave as theydid. Without the cut-back, a prompt that leaves less room than
max_tokensmakes vLLMreject the whole request. The completion regime has no upstream counterpart, so it keeps
its own budget, and
:basetask hashes don't change.Results
allenai/Olmo-3-7B-Instruct, native function callingFull suite, 3641 instances, stock vLLM
olmo3parser (nopatch_olmo3_tool_parser).None of the replies hit the token cap; the median reply is 31 tokens.
simplemultipleparallelparallel_multiplejavajavascriptirrelevancelive(pooled)Two observations from the predictions. Both are about the model and the stock parser,
not this code:
parallel_multipleat 0.375 is mostly a call-count problem. 116 of the 125failures had the wrong number of calls, and 95 of them returned exactly one call where
several were needed. Those replies are 10–112 tokens (median 23) with no leftover text,
so the model emitted one call; the parser wasn't dropping any.
javascriptat 0.48: 12 of the 26 failures produced no call. Some of those aregenuine prose refusals, but one emitted
<function_calls>…</function_calls>as textthat the stock
olmo3parser didn't extract.patch_olmo3_tool_parser=truetargetsexactly this.
The same model's base-regime numbers, and the two base models, are in #387.
Qwen/Qwen3-8B, native function callingQwen3 enables thinking by default, so the suite was run both ways. Thinking is turned
off with
-o 'provider.kwargs.chat_template_kwargs={"enable_thinking":false}'.simplemultipleparallelparallel_multiplejavajavascriptirrelevancelive(pooled)With thinking on, the median reply is 303 tokens and 43 of 3641 replies hit the 4096
cap. With thinking off, the median is 42 tokens and 2 replies hit the cap. A truncated
reply never reaches a call, so it scores 0 on the AST categories. On
irrelevanceitscores 1, because calling nothing is the right answer there. At 43 replies the effect
is small. With the earlier fixed 1024-token budget, 285 replies were truncated, and that
made thinking look worse than it is.
Overall, the two settings are within half a point of each other, but they don't trade
evenly across categories. Thinking helps on
live(0.7934 against 0.7712) and costs alittle on non-live, mostly
java,parallel_multipleandirrelevance.Agreement with the original BFCL implementation
The thinking-off run uses the same model and settings as a reference run of
Qwen/Qwen3-8B-FCwithUSE_THINKING: 0, produced by the original BFCL implementationin ai2/general-tool-use:
simplejavajavascriptmultipleparallelparallel_multipleirrelevancelive(pooled)liveagrees to 0.2 points over 2251 instances, and non-live to 1 point. The aggregationused here also reproduces that run's published
Non_Live Overall Accof 87.32% exactlyfrom its per-category numbers, which is what makes the two columns comparable. The two
implementations send the functions differently. For local models, BFCL's
-FChandlerrenders the tools through the model's chat template and extracts
<tool_call>tags fromthe reply text. This PR sends
tools=and lets vLLM'shermesparser extract the calls.The scores agree all the same.
Known issues, not introduced here
_compute_child_averageuses
child.expand(), so a suite nested two deep collapses to a flat leaf mean. Thenon-live figures above are the corrected average-of-averages; the
bfclsuite reports0.6870 instead of 0.6977. Unchanged by Add an instance-weighted (micro) suite aggregation strategy #385.
WEIGHTED_AVERAGEfrom Add an instance-weighted (micro) suite aggregation strategy #385 would now letbfcl_liveandbfcl_live_astbesuites rather than tasks that pool instances to get the same weighting. Worth doing,
but it is a base-eval change and would rename tasks again, so not here.
Not implemented
Multi-turn (needs BFCL's stateful API backend) and the executable/REST categories (they
grade by running predicted calls against live third-party APIs).
🤖 Generated with Claude Code
https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu