Skip to content

Add BFCL v3 single-turn categories as a completion task - #387

Merged
pdasigi merged 4 commits into
mainfrom
pd_bfcl_base
Sep 18, 2026
Merged

pdasigi merged 4 commits into
mainfrom
pd_bfcl_base

Conversation

@pdasigi

@pdasigi pdasigi commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Registers the BFCL v3 single-turn categories, reformulated as a completion so a
pretrained model with no chat template can be measured on them. The chat regimes
BFCL was built for (native function calling, and BFCL's own prompting mode) follow
in a separate PR.

What this adds

  • common/scorers/bfcl/ — the vendored AST checker, decoder, Java/JavaScript
    parsers and value converters, and one scorer that dispatches on category.
  • evals/tasks/bfcl/ — 15 tasks (13 categories plus two pooled live tasks), the
    completion formatter, hand-written exemplars per language, and the benchmark's
    own README; the top-level README keeps a pointer rather than the detail.
  • evals/suites/bfcl.py — five suites reproducing BFCL's own summaries.
  • 50 tests, offline (no dataset download).

The exemplars are written in the task module rather than drawn from a dataset, so
fewshot_source names the set that produced a run's prompts — the way
minerva_math names its fixed set — with a digest of the exemplar text, so that
revising an exemplar cannot reuse an earlier run's task hash.

uv run olmo-eval run -m my-base-model -t bfcl
uv run olmo-eval run -m my-base-model -t bfcl_simple:2shot   # :0shot .. :5shot, default 5

Why vendored

bfcl-eval on PyPI pins numpy==1.26.4 and pulls faiss, sentence-transformers,
anthropic and cohere. That does not coexist with the vLLM environment here, so the
checker is vendored instead. Java and JavaScript need tree-sitter grammars, declared
as task-specific dependencies so no other category installs them.

Fidelity

Replaying BFCL's own possible answers back through the checker reproduces
999/1000 non-live Python, 1344/1351 live, 92/100 Java, 49/50
JavaScript. Every remaining case is a dataset quirk the reference checker fails
identically — e.g. simple_363, whose possible answer names find_closest while its
function document names restaurant_search.find_closest.

Two deliberate departures, both commented in the source:

  1. An arithmetic argument is folded rather than passed to eval, which would run
    whatever the model wrote.
  2. The v3 prompt is reproduced verbatim, including its wording slips and its
    rendering of function documents as a Python repr under a sentence calling it
    JSON — changing either moves the scores.

Results

Full suite, 3641 instances per run, a100. Default is 5 exemplars.

5-shot

Category n Olmo-3-1025-7B Qwen3.5-4B-Base
simple 400 0.925 0.885
multiple 200 0.885 0.895
parallel 200 0.780 0.800
parallel_multiple 200 0.775 0.840
java 100 0.630 0.670
javascript 50 0.840 0.860
irrelevance 240 0.758 0.892
live (pooled) 2251 0.592 0.757
non-live 0.799 0.846
overall 0.696 0.802

0-shot

Category Olmo-3-1025-7B Qwen3.5-4B-Base
simple 0.848 0.720
multiple 0.745 0.670
parallel 0.635 0.605
parallel_multiple 0.380 0.495
java 0.560 0.440
javascript 0.700 0.680
irrelevance 0.525 0.921
live 0.421 0.565
overall 0.509 0.613

Reading these

  • Exemplar dependence is near-identical across models (−0.187 vs −0.189
    overall from 5-shot to 0-shot), so the exemplars are not advantaging either one.
  • The exemplars carry the behaviours they demonstrate. The two largest 0-shot
    drops for Olmo are parallel_multiple (−0.395) and irrelevance (−0.233) — the
    multi-call and declining exemplars. Live decode failures go from 1.1% to 38.6%
    without them; the model narrates instead of calling.
  • simple is close to a formatting check. It stays at 0.848 for Olmo at 0-shot,
    because the instruction block spells the [func(arg=value)] format out in words.
    Complying needs instruction-following, not tool-calling priors. The categories that
    do probe tool calling are live, irrelevance and parallel_multiple.
  • Not leniency. Re-scoring every correct instance under strict exact match —
    no case/punctuation folding, no int→float widening, no variable-name handling —
    leaves 96.2% of correct simple and 96.8% of correct live intact. Dropping every
    tolerance would move simple from 0.925 to 0.890.

Known issue, not introduced here

The bfcl suite's headline number is mis-weighted by a pre-existing framework bug:
_compute_child_average flattens a nested suite with child.expand() and averages
the leaves equally, ignoring that suite's own aggregation strategy. So bfcl reports
a flat mean of 7 leaves for its non-live term (Olmo 0.657, Qwen 0.835) instead of
BFCL's average-of-averages (0.677, 0.846). The tables above use the corrected values.

bfcl:non_live and bfcl:non_live_ast are correct when run directly — the
flattening only bites at three levels of nesting. The same bug affects
olmobase:easy:qa:rc, science:biology, science:nojudge and science:all, so
fixing it changes numbers for suites outside this PR and is left for its own change.

Not implemented

  • Multi-turn — scoring needs BFCL's stateful API backend.
  • Executable and REST — these grade by running predicted calls against live
    third-party APIs.

Because the executable categories are missing, bfcl:non_live is BFCL's non-live
overall with those terms left out and will not match a published non-live number.
bfcl:non_live_ast and the live summaries are directly comparable.

🤖 Generated with Claude Code

https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu

The Berkeley Function Calling Leaderboard grades a reply by comparing the
calls it made against a list of accepted values per parameter, so an answer is
right when it names the right function and supplies values the benchmark
accepts. Its checker is vendored under common/scorers/bfcl rather than
depended on: the bfcl-eval package pins numpy==1.26.4 and pulls faiss,
sentence-transformers, anthropic and cohere, which does not coexist with the
vLLM environment here.

BFCL addresses an instruction-tuned model, through a chat template or a tool
calling API. This registers its single-turn categories as a plain completion
instead, so a pretrained model with no chat template can be measured on the
same instances: the instruction, the function documents and the question form
one block of text that the model continues with its calls.

The exemplars carrying the answer format are hand-written rather than sampled,
so none is drawn from the evaluated set, and they cover the shapes a category
can take. One of them declines to call anything, without which a base model
calls something on nearly every instance and the irrelevance categories
measure nothing. Decoding also accepts the JSON tool-call formats models pick
up during pretraining, so a reply is judged on the function it chose rather
than the surface form it reached for.

BFCL weights its live summaries by how many instances each category holds,
which a suite average cannot express, so those summaries are tasks that pool
their categories' instances.

Two deliberate departures from the reference, both commented where they
happen: an arithmetic argument is folded rather than passed to eval, which
would run whatever a model wrote; and the v3 prompt is reproduced verbatim,
including its wording slips and its rendering of function documents as a
Python repr under a sentence calling it JSON, because changing either moves
the scores.

Replaying BFCL's own possible answers back through the checker reproduces
999/1000 non-live Python, 1344/1351 live, 92/100 Java and 49/50 JavaScript.
Every remaining case is a dataset quirk the reference checker fails
identically, such as simple_363, whose possible answer names find_closest
while its function document names restaurant_search.find_closest.

The chat regimes BFCL was built for follow separately. Multi-turn is left out
because scoring it needs BFCL's stateful API backend, and the executable and
REST categories because they grade by running the predicted calls against live
third-party APIs.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
Comment thread README.md Resolved
pdasigi and others added 3 commits September 18, 2026 15:56
The task's section had grown to the longest in the top-level README while
covering one benchmark, so it moves to a README beside the code, matching how
olmo_eval/analysis and olmo_eval/cli/results document themselves. The task
module becomes a package so it has a directory to hold it.

The top-level README keeps a short pointer, so the benchmark is still findable
from the feature list without carrying its category tables, exemplar settings
and checker notes.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
The exemplars are written in the task module rather than drawn from a dataset,
so nothing about them reached TaskConfig: fewshot_source was None, and the task
hash moved only with num_fewshot. Replacing an exemplar outright left the hash
byte-identical, so two runs prompted differently shared an identity, and the
three languages' sets were indistinguishable in a stored configuration.

fewshot_source now names the set, as minerva_math names its fixed one. The name
carries a digest of the exemplar text as well, because these exemplars are
expected to be revised and a name alone would still let an edit reuse an
earlier run's hash; a task that shows none of them takes a new hash too, which
errs towards a fresh identity over a silently shared one.

The field is only recorded, not resolved: the exemplars are built directly, so
nothing looks the name up as a data source.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
@pdasigi
pdasigi enabled auto-merge (squash) September 18, 2026 23:26
@pdasigi
pdasigi merged commit f65ab67 into main Sep 18, 2026
10 checks passed
@pdasigi
pdasigi deleted the pd_bfcl_base branch September 18, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants