Skip to content

Add the BFCL v3 multi-turn categories - #449

Merged
pdasigi merged 15 commits into
mainfrom
pd_bfcl_multiturn
Oct 8, 2026
Merged

pdasigi merged 15 commits into
mainfrom
pd_bfcl_multiturn

Conversation

@pdasigi

@pdasigi pdasigi commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Follows #429, which is merged; this PR is rebased onto main.

Adds the BFCL v3 multi-turn categories. Each entry is a conversation against stateful APIs, and it is graded on what the model's calls did, not on what it said.

What is measured

A multi-turn entry gives the model a sequence of user turns and a set of API classes: a file system, trading, travel booking, messaging, vehicle control, ticketing and maths. Within a turn the model calls functions, the calls run against live in-memory instances, the results come back as the next message, and the turn ends when the model stops calling, with a limit of 20 steps. After each turn the model's instances must hold the same state as instances driven by the ground-truth calls. Everything the ground-truth calls returned must also have come back from the model's calls, compared unordered and cumulatively.

Task What it perturbs
bfcl_multi_turn_base Nothing; decompose a request and carry it out
bfcl_multi_turn_miss_func A needed function is withheld, then offered partway through
bfcl_multi_turn_miss_param A request omits a parameter, so the model should ask rather than guess
bfcl_multi_turn_long_context The same tasks with the state inflated by filler

bfcl:multi_turn averages the four as equals, as the leaderboard does. Each task also exists as :prompt, using BFCL's prompting mode. There is no :base regime: a pretrained model isn't asked to drive a 20-step rollout that executes tools.

multi_turn_composite isn't registered. Its ground truth calls an older signature (add_to_watchlist(stocks=[...])) than the classes the other categories need, and some of its calls aren't valid Python. No single version of the reference implementation's classes can execute it. It's also absent from the v3 multi-turn summary.

uv run olmo-eval run -m my-model --harness bfcl_multi_turn -t bfcl:multi_turn
uv run olmo-eval run -m my-model --harness bfcl_multi_turn -t bfcl:multi_turn:prompt

No server flags are needed: after #429, the runner turns on tool-call parsing whenever a task sends tool schemas.

How it's built

  • API classes (common/scorers/bfcl/multi_turn/api/) are vendored from gorilla commit ac59a475d3. That's the version the v3 ground truth was written against; later versions changed signatures it calls. All nine files match that commit exactly apart from their import lines. Keeping them identical matters because an instance's attributes are what gets graded. They're excluded from ruff and ty in pyproject.toml. They simulate everything in memory, with no file, network or process access.
  • Execution (execution.py) dispatches each call by name onto the involved instances. Upstream runs eval() on a generated string instead. Positional arguments are kept, since some ground-truth calls use them. A call that fails to parse or raises becomes that call's result, and the calls after it still run.
  • Grading (checker.py) ports upstream's multi-turn checker: a state comparison over public attributes and the unordered, cumulative response check.
    • A turn whose ground truth makes no call isn't graded, though its calls still shape the state the next turn is compared on. Upstream defines an irrelevance check for those turns but never calls it, at the pinned commit, at the October 2025 version or on today's main.
    • A rollout with fewer turns than the ground truth scores 0 as force_terminated, as upstream does.
  • Rollout (harness/scaffolds/bfcl_multi_turn.py) drives one entry per instance through the bfcl_multi_turn preset.
    • A turn stops once more than 20 steps have run, so it can run 21, counted as upstream counts them. max_steps in the harness's scaffold_kwargs changes the limit.
    • For miss_func it offers the withheld functions at their turn, as tool schemas when calling natively or written out in the prompt's own format when prompted.
    • Execution results go back as tool messages. A prompted model gets one per call, named after the call (cd(folder='temp')), as upstream's handler for local models sends them.
    • A tool call whose arguments aren't a JSON object is kept in the history as text, so vLLM doesn't reject the next request.
  • Task (evals/tasks/bfcl/multi_turn.py) assembles each entry's function documents from the dataset's per-class files and splits off the withheld ones before the model sees either half.
  • Diagnostics: each prediction's scorer_results.bfcl_multi_turn records whether the entry passed, its error_type and error if it didn't, and whether a turn ran out of steps. Failures can be counted from the predictions file.

Fidelity check: replaying the dataset's own ground-truth paths through execution and grading runs 4,700 of 4,700 calls without error and grades all 800 of 800 rollouts correct.

Sampling and context overflow

The rollout samples the way the single-turn regimes do after #429: up to 4096 tokens at temperature 0.001, cut back to whatever room the conversation leaves in the context window.

A conversation can still outgrow the window partway through, mostly in long_context on models with smaller windows. Upstream catches the error, records it as the model's answer and grades the entry wrong. This PR does the same:

  • vllm_server returns a context-overflow rejection as a marked reply (CONTEXT_OVERFLOW_KEY in inference/errors.py) instead of raising. Dispatch used to retry such a request, which can never succeed.
  • The scaffold ends the rollout on that reply and logs the entry.
  • The scorer gives it 0 with error_type: multi_turn:context_overflow.

Every other failed request still fails its instance. The runner already records a marked reply as a failed instance. Callers that read replies directly, SciCode and the LLM judge, now go through first_output, which raises on a marked reply, so an overflow there doesn't read as an empty answer.

Shared code touched

  • LMRequest.metadata (new, optional) carries the per-instance rollout payload to the scaffold. It isn't sent to the model, and the harness passes it through _apply_config.
  • inference/errors.py:
    • CONTEXT_OVERFLOW_KEY, is_context_overflow and is_context_overflow_output.
    • first_output.
    • One exception-chain walk, now shared with classify_terminal_provider_error.
  • inference/base.py: require_tool_support, used by both the harness guard from Add the BFCL chat regimes: native function calling and prompting #429 and this scaffold. The guard trusts scaffolds, and this one sends its schemas through the provider, so it checks for itself.
  • vllm_server: the overflow marking above.
  • scicode/eval.py and common/scorers/llm_judge.py: replies read through first_output. The judge still returns "" when nothing came back at all, as it did before.
  • common/scorers/bfcl/decoding.py: call_name, shared by single-turn decoding and the parsing of ground-truth calls.

Results

On commit 925827e1. Every instance was saved, and none failed. The thinking-on run used --no-preemptible; the others ran as preemptible jobs.

Model Mode base miss_func miss_param long_context avg
Olmo-3-7B-Instruct native FC 0.135 0.040 0.045 0.035 0.064
Olmo-3-7B-Instruct prompting 0.065 0.050 0.025 0.035 0.044
Qwen3-8B native FC, thinking off 0.205 0.030 0.125 0.130 0.123
Qwen3-8B native FC, thinking on 0.350 0.325 0.270 0.240 0.296

Failures counted from scorer_results:

Run Context overflow Forced stop Turn hit the step limit
Olmo-3-7B-Instruct, native FC 0 1 (miss_func) 1
Olmo-3-7B-Instruct, prompting 5 (long_context) 0 0
Qwen3-8B, thinking off 22 (long_context) 1 (miss_func) 1
Qwen3-8B, thinking on 26 (long_context) 13 (across all four) 19

Against the original BFCL implementation

base miss_func miss_param long_context avg
Qwen3-8B, thinking off, this PR 0.205 0.030 0.125 0.130 0.123
Qwen3-8B-FC, USE_THINKING: 0, original 0.215 0.155 0.135 0.145 0.163
Olmo-3-7B-Instruct, prompting, this PR 0.065 0.050 0.025 0.035 0.044
Olmo 3 7B Instruct, prompting, original 0.130 0.090 0.040 0.055 0.079

Both references ran a modified BFCL build (shashankg/bfcl-latest), not upstream, at temperature 0 rather than upstream's default of 0.001.

  • Qwen reference: every modification flag was off, so it's the closer comparison.
  • Olmo reference: used a custom model handler (allenai/general-tool-use-dev) with USE_ENVIRONMENT_ROLE=1 and USE_OPENAI_FUNCTION_DEFINITION_FIXES=1. It also ran a checkpoint named grpo_all_mix_p64_4_8k_olmo3-instruct-dpo-lbc-v2__1__1763365141_checkpoints_step450, which has been described as the same model as allenai/Olmo-3-7B-Instruct. Olmo 3's chat template renders a tool message exactly as an environment one, so the result format here matches that run.

Effect of the review fixes

From the previous runs of this PR. Before the reruns, I regraded those runs' saved rollouts without the irrelevance check, and the reruns came out close to that prediction.

before regrade prediction rerun
Qwen thinking off, miss_param 0.040 0.115 0.125
Qwen thinking off, miss_func 0.005 0.020 0.030
Olmo prompting, base 0.075 0.075 0.065

Open discrepancy

These still disagree with the original implementation:

  • Qwen3-8B with thinking off, miss_func: 0.030 against 0.155. The irrelevance check accounted for the miss_param gap, which is now 0.125 against 0.135, but not this one. Most failures (107 of 194) are the model making no call at all on the turn where the withheld function is offered. I checked that the offered schema arrives intact and isn't visible before its turn. I haven't found the cause.
  • Olmo-3-7B-Instruct, prompting: below the reference in every category, including base (0.065 against 0.130). Changing the result format to match upstream didn't close the gap. The reference's modified handler and its function-definition fixes are differences this PR doesn't reproduce.
  • long_context fell in both FC runs: Olmo from 0.055 to 0.035, with no overflows, forced stops or step-limit hits, and Qwen with thinking on from 0.290 to 0.240, with 26 overflows against 23 before. Run-to-run variation at temperature 0.001 could account for some of it. So could the fix that keeps malformed tool calls in the history as text, which changes what later steps see. I haven't separated the two.

The Qwen miss_func and Olmo numbers should be read as provisional until these are explained.

Not included

  • multi_turn_composite (see above).
  • A :base regime.
  • The general framework gap raised in Add the BFCL chat regimes: native function calling and prompting #429's review, where dispatch turns a provider exception into an empty output with no error, is unchanged here. This PR routes context overflow around it and makes SciCode and the judge raise on a marked reply, but an unmarked failure still reaches a direct caller as an empty list.

🤖 Generated with Claude Code

https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu

@pdasigi

pdasigi commented Oct 4, 2026

Copy link
Copy Markdown
Member Author

Written by the Claude Code session h038-tool-mix-mac (running these evals for H038 at the owner's request). One finding while running bfcl:multi_turn against vLLM 0.19.1 with the qwen3_xml tool parser on an Olmo 3.5 SFT checkpoint: when the model emits a tool call whose arguments are not a JSON object, _decode correctly reads the step as no calls, but _record_assistant still puts the malformed tool_calls into the history; vLLM re-renders the history through the chat template and answers 400 on the next request (Expecting ',' delimiter), the step gets no reply, and the entry is dropped from the run (expected = total - failed). On a control model with no tool training that was 5 of the first 18 entries, so it biases a comparison toward the arm that emits malformed calls. Branch pd_bfcl_multiturn-h038 (9538453, one commit on top of this PR) records such a reply as text, as a prompted rollout would see it, so the step is graded wrong and the rollout continues; test added. Take it or handle it differently as you prefer; H038's multi-turn runs use that branch.

@gregorybchris gregorybchris left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Nice work overall! The ground-truth replay check (4,700 calls, 800 of 800 graded correct) is exactly the right fidelity evidence. Dispatching calls by method lookup instead of eval is also a clear improvement on upstream. A few things should be addressed before merging.

I found three blocking issues. Two are parity divergences in the checker that I reproduced against upstream at the pinned commit (ac59a475). The first one probably explains the open miss_func/miss_param discrepancy. The third is a failure-visibility regression that the shared vllm_server change causes outside BFCL. After those come prompt fidelity, persisted diagnostics, and several duplication and reuse items.

Verification: On the PR head (0b277c08), ruff check, ruff format and ty all pass. ty prints one pre-existing warning in harness/sandbox/executor.py, which this PR doesn't touch. Unit tests: 3051 passed, 35 skipped.

Blocking

  1. src/olmo_eval/common/scorers/bfcl/multi_turn/checker.py:161
    The PR runs irrelevance_checker as part of grading. Upstream at the pinned commit has the call commented out in eval_runner.multi_turn_runner (lines 129–134). The function exists in multi_turn_checker.py, but nothing calls it. multi_turn_checker itself just continues on an empty-truth turn, and the comment there says the calls are still executed "so that the state check at the next turn is accurate". I reproduced the difference with MathAPI: truth path [[], ["add(a=1, b=2)"]], and the model calls add on both turns. This PR returns multi_turn:irrelevance_error:decoder_success. Upstream grades the entry correct. Only miss_func and miss_param have empty-truth turns, and those are exactly the two categories where Qwen3-8B (thinking off) is far below the reference (0.005 vs 0.155, 0.040 vs 0.135). base and long_context are close. I expect this is the open discrepancy. Please drop the irrelevance check from the scored path so it matches the reference. If we want the stricter grading, it can land later as a versioned :v2 variant. Since extracted_answer (the per-turn calls) is saved in the predictions, could you rescore the existing Qwen and Olmo runs without the check and post the new miss_* numbers next to the reference? Please also add a regression test with an empty-truth turn where the model calls something and the entry is still valid.

  2. src/olmo_eval/evals/tasks/bfcl/multi_turn.py:168 (scorer) and src/olmo_eval/harness/scaffolds/bfcl_multi_turn.py:175
    When the step budget runs out on a turn before the last one, the scaffold stops early, so the rollout has fewer turns than the ground truth. Upstream fails such an entry outright as multi_turn:force_terminated (eval_runner.py:76–94). Here the missing turns are padded as empty. If every remaining turn has an empty ground truth, the entry is graded correct. Reproduced: truth [["add(a=1, b=2)"], []], with a rollout of 20 add steps on turn 0 and nothing after. This PR returns {'valid': True}. Upstream returns force_terminated. Please have the scorer return 0 with error_type: multi_turn:force_terminated when len(rollout) != len(ground_truth), and add a test. Related nit: upstream's counter allows 21 executed steps before it force-quits (count += 1 then if count > MAXIMUM_STEP_LIMIT), while range(max_steps) allows 20.

  3. src/olmo_eval/inference/providers/vllm_server.py:1113,1123
    _generate_or_mark_overflow changes agenerate for every caller of vllm_server, not only the BFCL scaffold. The runner's batch and chat paths check request_error, so plain tasks still fail the instance. But two other callers read .text directly:

    • src/olmo_eval/evals/external/benchmarks/scicode/eval.py:238 (text = results[0][0].text). I reproduced this with a stubbed _generate_single_async that raises a "maximum context length" error. On the base branch, agenerate returns [[]] and SciCode raises IndexError, so the instance fails. On this branch it returns [[LMOutput(text="")]], so SciCode extracts empty code for the step and scores it. A context overflow has become a silent zero, which the repo treats as a blocking failure-visibility problem.
    • src/olmo_eval/common/scorers/llm_judge.py:363 already turned the dispatch failure into "" before this PR. That gap is in the existing framework (the one raised in #429), but the new marked output keeps it alive.

    Could we make the marking opt-in so it only reaches the caller that asked for it? For example, the scaffold could catch the overflow itself, or agenerate could take a flag. Alternatively, add a small shared helper that raises on request_error and use it in SciCode and the judge, e.g.:

    def first_output(outputs: Sequence[LMOutput]) -> LMOutput:
        """The first output of a request, raising if the provider marked it failed."""
        error = request_error(outputs)
        if error is not None or not outputs:
            raise RuntimeError(error or "Provider returned no output.")
        return outputs[0]

    Please add a test showing that a non-BFCL caller still fails on an overflow.

Non-blocking

  1. src/olmo_eval/harness/scaffolds/bfcl_multi_turn.py:229
    In prompting mode, execution results go back as one user message containing repr(results), a list of bare strings. The comment says this matches the reference, but the model then can't tell which result belongs to which call. Upstream's API prompting path sends repr([{"role": "tool", "name": <decoded call>, "content": <result>}, ...]) (model_handler/utils.py:format_execution_results_prompting). Its OSS handler, the one a local Olmo or Qwen would use, appends one {"role": "tool", "name": ..., "content": ...} message per result (oss_model/base_oss_handler.py:_add_execution_results_prompting). Which handler did the Olmo reference run use? Since base is also below the reference (0.075 vs 0.130), this is the first thing I would check for the prompting gap.

  2. src/olmo_eval/evals/tasks/bfcl/multi_turn.py:179,196
    The PR notes that bfcl_error doesn't reach the saved predictions. The framework already has a channel that does: set_scorer_result(output, self.name, {...}) from common/scorers/base.py, which build_predictions saves under scorer_results. Could the scorer record error_type and error that way? The step-budget and context-overflow flags should go there too. Then a parse failure, a forced stop and an overflow can each be counted from the predictions file instead of the logs. That matters because overflow counts depend on the server's max_model_len, which is not part of the task hash.

  3. src/olmo_eval/harness/scaffolds/bfcl_multi_turn.py:159
    +1 to the existing thread comment. When a reply's tool calls fail to decode, _record_assistant still writes the malformed tool_calls into the history. vLLM then rejects the next request with a 400, and the instance is dropped from the denominator. That biases comparisons toward models that emit malformed calls. Please fold in the fix from pd_bfcl_multiturn-h038 (9538453) or an equivalent, with its test.

  4. src/olmo_eval/inference/errors.py:64
    is_context_overflow re-implements the exception-chain walk in classify_terminal_provider_error (same file, line 20). Could both use one generator?

    def _exception_chain(exc: BaseException) -> Iterator[BaseException]:
        current: BaseException | None = exc
        seen: set[int] = set()
        while current is not None and id(current) not in seen:
            seen.add(id(current))
            yield current
            current = current.__cause__ or current.__context__
  5. src/olmo_eval/harness/scaffolds/bfcl_multi_turn.py:75
    The supports_tools check and its error message duplicate Harness._check_tools_supported (harness/harness.py:97). Could that become a module-level helper (e.g. require_tool_support(provider)) that both call? Then the guard and its wording live in one place.

  6. src/olmo_eval/common/scorers/bfcl/multi_turn/execution.py:63
    parse_call_strings repeats the dotted-name walk from resolve_ast_call (common/scorers/bfcl/decoding.py:107). Could we factor out a call_name(node: ast.Call) -> str in decoding.py and use it in both places?

  7. src/olmo_eval/evals/tasks/bfcl/multi_turn.py:227–260, 332, 349
    BFCLMultiTurnTask re-implements most of BFCLTask: the DataSource(path=BFCL_REPO, ..., revision=BFCL_REVISION) construction (three times here, twice in __init__.py), the lazy _load_answers cache, the instances passthrough, format_request, and the type(...) plus setattr(module, ...) registration loop. Could the shared parts move to a small base class, e.g. a _BFCLDataTask with a _load(data_files) helper and the answer cache, that both tasks extend? The guide also asks us to replace dynamic type() generation with __init_subclass__ or one class plus configuration. With a shared base, both registration loops can be fixed at once. I'm fine with that as a follow-up issue, since #429 introduced the pattern.

  8. src/olmo_eval/evals/suites/bfcl.py:101 and src/olmo_eval/evals/tasks/bfcl/multi_turn.py:60
    MULTI_TURN_CATEGORIES is defined twice. Please keep one, in the task module, and import it in the suite. That direction is allowed: suites may import from tasks.

Nits

  • Nit: src/olmo_eval/evals/tasks/bfcl/multi_turn.py:91: category_from_id is used only by a test, and it shadows the package's category_from_id, which has different semantics (it keeps the prefix). Please remove it, or rename it if it gets a caller.
  • Nit: src/olmo_eval/harness/scaffolds/bfcl_multi_turn.py:84: payload.get("max_steps", ...) is never set by the formatter. Please remove the parameter or make it a task setting.
  • Nit: src/olmo_eval/evals/tasks/bfcl/multi_turn.py:280: Language and prepare_function_docs are imported inside process_doc from modules that are already imported at the top of the file.
  • Nit: src/olmo_eval/evals/tasks/bfcl/multi_turn.py:324: "functions": visible has no consumer in the multi-turn path.
  • Nit: src/olmo_eval/common/scorers/bfcl/multi_turn/checker.py:127: the inline from .execution import parse_call_strings can join the top-level import from the same module.
  • Nit: LONG_CONTEXT_CATEGORIES is a one-element frozenset. self.category == "long_context" says the same thing.

Before merge

Please make the following changes, each with a regression test:

  • Remove the irrelevance check from scoring, and report rescored miss_* numbers next to the reference.
  • Fail entries that were force-terminated early.
  • Keep the context-overflow marking from reaching SciCode and the judge as an empty reply.

After that, you can merge once #429 lands, the branch is rebased, and CI is green. Please open follow-up issues for:

  • the shared BFCL task base and removing the type() registration (non-blocking item 7);
  • the framework gap where dispatch turns a provider exception into an empty output for direct agenerate callers.

@pdasigi
pdasigi force-pushed the pd_bfcl_multiturn branch from 0b277c0 to 925827e Compare October 6, 2026 23:04
@pdasigi

pdasigi commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

Thanks for the review. All three blocking items are addressed in 925827e. The branch is rebased onto #429, which now includes a3265e5 (see the note at the end).

Blocking 1: irrelevance check. Removed from the scored path. Upstream defines the check but never calls it. I confirmed that at the pinned commit ac59a475, at the October 2025 version that was current when the reference runs were made (4620df7), and on today's main. The regression test uses your reproduction ([[], ["add(a=1, b=2)"]], with add on both turns, graded valid). A second test checks that calls on an ungraded turn still change the state compared at the next turn.

Before rerunning, I regraded the saved rollouts without the check. The reruns came out close to that prediction:

Qwen3-8B, thinking off before regrade rerun reference
miss_param 0.040 0.115 0.125 0.135
miss_func 0.005 0.020 0.030 0.155

That closes miss_param but not miss_func. For miss_func, 107 of the 194 failures are the model making no call at all on the turn where the withheld function is offered. I checked that the offered schema arrives intact and isn't visible before its turn, and I haven't found the cause. It's listed under "Open discrepancy" in the description.

Blocking 2: force-terminated. A rollout with fewer turns than the ground truth now scores 0 as multi_turn:force_terminated. The test uses your reproduction. The step limit now counts as upstream does: the counter goes up after each executed step and the turn stops once it passes 20, so a turn can run 21 steps. max_steps moved from the unused payload key to the scaffold's scaffold_kwargs. In the reruns, one entry in each FC run was force-terminated.

Blocking 3: overflow reaching other callers. I took the helper route rather than making the marking opt-in. With opt-in, an ordinary task whose prompt overflows would go back to dispatch's empty output and score zero silently, whereas the runner already records a marked reply as a failed instance. SciCode now reads its reply through first_output, which raises on a reply the provider marked failed. The judge does the same, but still returns "" for an empty result, as it did before. The regression test drives SciCodeExternalEval._run_problem through the real VLLMServerProvider.agenerate, with the HTTP call stubbed to raise vLLM's overflow error. It raises RuntimeError with the context-length message, and it fails on the old results[0][0].text line.

Non-blocking

  1. Result format. A prompted model now gets one tool message per result, named after its call, as base_oss_handler._add_execution_results_prompting sends them.
    • Which handler did the Olmo reference use? Neither upstream handler. Both references ran a modified build (shashankg/bfcl-latest) at temperature 0. The Olmo one used a custom handler (allenai/general-tool-use-dev) with USE_ENVIRONMENT_ROLE=1 and USE_OPENAI_FUNCTION_DEFINITION_FIXES=1. Olmo 3's chat template renders tool and environment messages the same way, so the new format matches that run.
    • It didn't close the Olmo prompting gap: base is 0.065 against the reference's 0.130.
  2. set_scorer_result now records valid, error_type, error and step_budget_exhausted for every entry. Overflow, force-terminated and step-limit counts per run are in the description.
  3. Folded in 9538453 from the H038 session, with its test.
  4. _exception_chain is shared by both classifiers.
  5. require_tool_support(provider) in inference/base.py is used by the harness guard and the scaffold.
  6. call_name(node) in decoding.py is used by resolve_ast_call and parse_call_strings.
  7. Not done here: the shared BFCL task base and removing the type() registration.
  8. MULTI_TURN_CATEGORIES is defined once, in the task module, and imported by the suite.

All six nits are done.

Rerun results (925827e1). Every instance was saved, and none failed:

base miss_func miss_param long_context
Olmo-3-7B-Instruct, FC 0.135 0.040 0.045 0.035
Olmo-3-7B-Instruct, prompting 0.065 0.050 0.025 0.035
Qwen3-8B, thinking off 0.205 0.030 0.125 0.130

Qwen3-8B with thinking on is still running and will be added to the description when it finishes.

Also fixed, in #429 (a3265e5). While working on this I found that #429's new SamplingParams.fit_max_tokens_to_context field had changed the task hash of every task in the repo, because TaskConfig.to_dict serialized every sampling field. It's now added to the config only when set, following the convention to_dict already uses for newer fields. Non-BFCL tasks and the bfcl_*:base specs hash as they do on main again. A test fails if a SamplingParams field is added without the same treatment.

Local checks pass (ruff, format, ty, 3065 tests). The CI workflow doesn't appear to run on a PR based on pd_bfcl_instruct, so it will first run once this is retargeted to main.

Base automatically changed from pd_bfcl_instruct to main October 8, 2026 16:49
pdasigi and others added 15 commits October 8, 2026 10:15
The multi-turn categories are graded on what a model's calls did, not on what
it wrote: after each turn the involved API instances must hold the state the
ground truth path leaves them in, and everything the ground truth's calls
returned must also have come back from the model's.

The API classes are vendored from the reference implementation, which is where
the benchmark defines them; an instance's attributes after a turn are what a
prediction is compared against, so reimplementing them would change the
scores. They are kept as they are upstream apart from their imports, and are
excluded from linting so they stay that way. Each simulates its domain in
memory, with no file, network or process access.

Calls are dispatched by looking the method up on the instance that defines it,
rather than rendering them back to source and evaluating them as the reference
does. Calls arrive already decoded, so nothing a model writes is executed as
code, and it can reach only methods the involved classes have.

Replaying every ground truth path executes 4,700 calls across multi_turn_base,
miss_func, miss_param and long_context without a single failure, and the
checker passes all 800 of those rollouts while rejecting every rollout with a
call removed.

multi_turn_composite is left out. Its ground truth calls an older signature
than the other categories do, and some of its calls are not valid Python, so
it cannot execute against the classes any version of the reference ships; it
is also absent from the v3 multi-turn summary.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
They are kept as they are upstream, so their diagnostics are not ours to fix
and would drown the ones that are. Lint already skips them for the same
reason.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
A multi-turn entry is a conversation rather than a single request: for each
user turn the model is asked for calls, those calls run against the entry's API
instances, their results come back as the next message, and the turn ends when
the model stops calling. Both regimes are driven the same way, differing only
in whether calls arrive as tool_calls answered with tool messages, or as text
answered in the user's next message.

The rollout's instances only exist to answer the model. What it did is graded
afterwards by replaying its calls against fresh instances, which keeps a score
independent of anything the rollout left behind.

Two of the categories perturb the conversation, and both are handled here: a
turn may hold back functions the model needs, offering them partway through
with a stock message, which a prompted model needs spelled out since it has no
tool list to update; and a turn may be one the model cannot satisfy yet, where
calling nothing is what is being measured.

Scaffolds only receive the request, and nothing carried the state a rollout
acts on, so LMRequest gains a metadata field for a task to hand one a payload.

Replaying every ground truth path through the scaffold and the checker scores
174 of 200 entries correct in each category. The rest are the entries whose
ground truth writes an argument positionally, which model-side decoding drops
as it does upstream; the same paths written the way the benchmark asks a model
to write them score 99 in 100.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
An entry names the API classes it involves rather than carrying their
functions, so the documents are assembled here from the dataset's per-class
files, through a mapping that does not always follow the class names. One
category holds functions back until a turn partway through: those are resolved
from the names the entry gives, taken out of the tools the model is shown, and
handed to the scaffold to offer at their turn. Both halves share one sanitized
name map, so a call made after a function is offered still reads back under the
name the dataset gives it.

Driving a rollout needs the bfcl_multi_turn scaffold, which a task cannot ask
for, so a harness preset carries it and the scorer refuses a reply with no
recorded rollout rather than scoring it zero; a missing harness would otherwise
read as a weak model.

bfcl:multi_turn averages the four categories as equals, as the leaderboard
does. There is no base regime: a pretrained model is not asked to drive a
twenty-step tool-executing rollout.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
The prompting formatter inherits from the tool calling one, which sends the
function schemas, so a prompted rollout was given its functions twice: once in
the system prompt it is meant to read them from, and again as schemas. A model
answering the second way would have produced calls this regime does not read,
and a server not configured to parse tool calls would have refused the request
outright.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
…mode

The scaffold added each held-back function to the tool list whatever the
regime, so the first miss_func turn gave every later request a tool list.
A server started for prompting rejects those, which failed all 200
instances of bfcl_multi_turn_miss_func:prompt and tripped the hard
failure gate.

The prompting path already announces the functions in the message, so the
schemas only belong in the tool list when the model calls natively.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
A prompted rollout announced the functions a miss_func turn offers by
formatting the tool API schemas, while the system prompt had written the
rest as BFCL function documents. The model was handed a function in a
dialect it had not seen anywhere else in the conversation.

The task now renders the offer alongside the schemas the tool regime
needs, and a prompted rollout that reaches a turn without one is refused
rather than falling back to the schemas.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
The rendered documents were put on the instance but not copied into the
request, so a prompted rollout reached a miss_func turn without them and
was refused. The payload test now reads the offer off the request, which
is what the scaffold sees.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
The rollout asked for a flat 1024 tokens at temperature 0. It now samples
like the single-turn regimes: up to 4096 tokens, cut back to the room the
conversation leaves in the context window, at temperature 0.001.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
A long conversation can grow past the model's context window partway
through. The reference implementation records that failure as the
model's answer and grades the entry wrong. Here it failed the instance
instead, and enough of them failed the whole long context category on a
model with a 40k window.

vLLM's rejection of an over-long prompt is now returned as a marked
reply rather than raised. Retrying such a request cannot succeed. The
multi-turn rollout ends on that reply and the scorer gives it zero.
Every other failed request still fails its instance. A step that gets
no reply at all now says so, where it used to raise an IndexError.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
Such an entry is graded wrong without failing, and the reason the scorer
records is not kept with the saved predictions, so nothing showed how
many entries a run lost this way. The scaffold now logs each one, as it
does for an exhausted step budget.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
The harness leaves tool support to a scaffold, since most scaffolds send
their tools over their own client. This one sends its schemas through
the provider, so on a provider that drops them a native function calling
rollout would show the model no functions and score zero. The scaffold
now refuses that case itself.

The examples no longer pass enable_auto_tool_choice, which the runner now
sets whenever a task sends tool schemas.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
… recorded as text, not re-sent as tool_calls

vLLM re-renders the history through the chat template and answers 400 when an assistant
turn carries tool-call arguments that do not decode to an object, so the next step got no
reply and the entry was dropped from the run (excluded from the denominator). The reference
grades such a step wrong and goes on; so does this now: the step still reads as no calls,
the model's words stay in the history as text, and the rollout continues. Seen on H038's
control arm (5 of the first 18 entries) with the qwen3_xml parser.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YF5pJMhpQYBzsXcJ3rGcP5
Grading now matches the reference implementation:
- The irrelevance check is no longer run. The reference defines it but
  never calls it, so a call on a turn the ground truth leaves alone was
  failing entries the reference passes.
- A rollout with fewer turns than the ground truth scores zero as
  force_terminated. It was padded with empty turns, which passed when
  the remaining ground truth was empty.
- A turn stops once more than the step limit has run, as the reference
  counts, so it can run 21 steps rather than 20. The limit is a scaffold
  setting rather than an unused payload key.
- A prompted model gets each result back as a tool message named after
  the call that produced it, as the reference handler for local models
  sends them, instead of one user message listing bare results.

A context overflow marked on a reply no longer reaches a direct caller as
an empty answer. SciCode and the LLM judge read replies through
first_output, which raises on a reply the provider marked failed; the
judge still returns an empty string when nothing came back at all.

Each prediction's scorer_results now records whether the entry passed,
why it failed, and whether a turn ran out of steps, so these can be
counted from the predictions file.

The tool-support check, the exception-chain walk and the dotted call-name
walk each live in one place now, MULTI_TURN_CATEGORIES is defined once,
and an unused helper, payload entry and constant are gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9Qzbda9kPQePRC7MKJxnu
@pdasigi
pdasigi force-pushed the pd_bfcl_multiturn branch from 925827e to 0733a26 Compare October 8, 2026 17:20
@pdasigi
pdasigi merged commit 5111afe into main Oct 8, 2026
8 checks passed
@pdasigi
pdasigi deleted the pd_bfcl_multiturn branch October 8, 2026 17:32
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