phone-tool-bench / README.md
DedeProGames's picture
Publish PhoneToolBench (520 items)
78f3315 verified
|
Raw History Blame Contribute Delete
9.24 kB
metadata
license: apache-2.0
pretty_name: PhoneToolBench
language:
  - en
  - pt
  - es
  - de
task_categories:
  - text-generation
tags:
  - tool-use
  - function-calling
  - phone-assistant
  - reasoning
  - benchmark
size_categories:
  - n<1K
configs:
  - config_name: default
    data_files:
      - split: test
        path: data/test.jsonl

PhoneToolBench

A held-out benchmark for phone tool calling, built on the exact tool catalog and scoring rules of the LiquidAI phone-assistant tools dataset. It is meant for small reasoning models (roughly 1B to 8B parameters) that emit <think> blocks and support tool calling. Use it to measure how much a model improved after fine-tuning on the phone tool set, compared with its base model.

  • 520 items, 130 per language (English, Portuguese, Spanish, German).
  • 108 tools, the full phone catalog. Every item is shown the whole catalog, as in training.
  • 66 items use 10 held-out tools that never appear in the training or test splits (see below).
  • Gold answers are exact tool-call lists. Scoring is deterministic: no LLM judge.

Why it is hard

  • Lookalike pairs. 71 items ask for an action where a near-duplicate tool exists in the catalog (for example a stopwatch versus a timer), so the model must pick the right one.
  • Reasoning items (123) need arithmetic, unit or currency conversion, or date and duration arithmetic from the context timestamp before the arguments are correct.
  • Multi-call items (79) need two or three calls in one turn.
  • Partial items (38) are only partly possible. The right answer calls the possible tool and says what it cannot do.
  • Abstention items (86) need no tool. Of these, 41 need no tool at all and 45 need a clarifying question because a required detail is missing. A model that always calls a tool scores poorly here.
  • Held-out tools (66 items) test generalization to tools the model has not seen in training.

Requests are generated from templates, so the phrasing is more regular than real user speech. See Limitations.

Data format

data/test.jsonl, one JSON object per line:

field type meaning
id str ptb-0000 … ptb-0519
language str en, pt, es, de
category str single, multi, reasoning, lookalike, partial, no_tool, clarify
subtype str or null for reasoning: the kind of arithmetic needed, e.g. duration+date, currency, unit+arithmetic
tool_split str seen (all gold tools appear in training) or heldout (at least one gold tool is held out)
gold_tools list[str] names of the tools in the gold calls (for reporting only; the model is not shown this list)
context dict datetime (local, ISO 8601), timezone (IANA), locale
request str the user's message
calls str JSON list of gold calls {"name": ..., "arguments": {...}}

Gold calls use the same format as the training data. Gold call counts: 86 items with 0 calls, 306 with 1, 99 with 2, 29 with 3.

Held-out tools

These tools never appear in the training or test splits of the source dataset:

append_to_note, control_smart_plug, draft_email, get_air_quality, get_ride_estimate, request_money, search_hotels, set_hotspot, set_sleep_timer, share_location

Protocol

  1. Build each prompt with the system prompt from phonebench/prompt.py. It is copied verbatim from the training notebook, with the date, time, timezone and locale filled in from context.
  2. Pass the full 108-tool catalog (tools.json) as the tool list, through the model's chat template. Do not pass gold_tools.
  3. Turn on the model's reasoning mode (--thinking on) for reasoning models. Decode greedily (temperature 0).
  4. Parse the answer. Thinking is split at </think>, and tool calls are read from Hermes <tool_call> JSON or from a pythonic list ([name(arg=value)]). A server that returns structured tool_calls (vLLM, llama.cpp, Ollama) is scored directly.
  5. Score each item against its gold calls.

Scoring

  • Exact match: the predicted call list equals the gold list. Call order does not matter. Each argument is compared according to its kind from scoring.json: expr (arithmetic is evaluated and compared), datetime, date and time (parsed and compared), name (case and accent insensitive), text (similarity), code (punctuation and spacing ignored), enum (case insensitive), and bool, int and number (compared by value).
  • Micro exact match: mean over all 520 items.
  • Macro exact match: mean of the per-category accuracies. This is the headline number, because the categories are unequal in size.
  • Tool-name F1: how well the set of predicted tool names matches the gold set.
  • False-call rate on no-call items (no_tool, clarify): lower is better.
  • Schema error rate on predicted calls: calls that break the tool's argument schema.
  • Parse error rate and truncation rate: output that could not be read, or hit the token limit.
  • Breakdowns by category, reasoning subtype, language, and seen versus held-out tools.

Reference points: the oracle (gold answers) scores 100%. A model that never calls a tool scores 16.5% exact match (it gets every no-call item right and nothing else).

Using the harness

The repo ships the benchmark data, the scorer, and a runner.

pip install -r requirements.txt

# harness sanity checks (should print 100% and 16.5%)
python -m phonebench.run --backend oracle --name oracle
python -m phonebench.run --backend no_call --name no_call

# local Hugging Face model, reasoning on (needs a GPU for models this size)
python -m phonebench.run --backend hf --model <hf-model-id> --thinking on --batch-size 8

# any OpenAI-compatible server (vLLM, llama.cpp server, Ollama, LM Studio)
python -m phonebench.run --backend openai --base-url http://localhost:8000/v1 --model <served-name> --thinking on

# quick check on the first 50 items
python -m phonebench.run --backend hf --model <hf-model-id> --limit 50

Each run writes results/<name>/records.jsonl (one record per item, with predicted and gold calls and the raw output), summary.json, and summary.md.

Serving the model through a server with its own tool-call parser is the most reliable route for models whose tool-call format is not Hermes or pythonic. Otherwise the parser can count valid calls as parse errors. If the chat template does not receive tools, the model cannot know the catalog and the score will mostly reflect that. Check summary.md for parse and schema errors before trusting a number.

To compare fine-tuned and base models, run both with identical settings (same --thinking, --max-new-tokens, and decoding) and compare macro exact match, the seen versus held-out split, and the false-call rate.

Tests and validation

python scripts/validate.py          # schema, self-match, uniqueness, catalog coverage
python -m unittest discover -s tests -v   # parser, scorer, prompt and data tests

Rebuilding the data

scripts/build_bench.py regenerates the benchmark deterministically (seed 20260314) from the source dataset:

python scripts/build_bench.py --hub LiquidAI/phone-assistant-tools --out data/test.jsonl --items 520 --seed 20260314

It also checks every item against the tool schema, rejects requests that duplicate training or test text after normalization, and verifies that gold answers match themselves.

Files

README.md                  this dataset card
data/test.jsonl            the benchmark (520 items)
tools.json                 phone tool catalog (108 tools), from LiquidAI, Apache-2.0
scoring.json               argument kinds for scoring, from LiquidAI, Apache-2.0
phonebench/                scorer, prompt, parser, backends, runner
scripts/build_bench.py     deterministic generator
scripts/validate.py        integrity checks
tests/test_harness.py      unit tests
requirements.txt

Limitations

  • Template phrasing. Requests are generated from templates in four languages. They are less varied than real user speech, and a score here does not guarantee the same score on real requests.
  • Four languages. The source training data covers 16. Only en, pt, es and de are included here.
  • Catalog coverage. The benchmark uses the 108 tools of the source catalog. Tools outside that catalog are not tested.
  • Thinking format. The parser splits <think> blocks and reads Hermes or pythonic calls. Other formats need a server-side parser, as described above.
  • Single turn. Each item is one user message. Multi-turn follow-ups, such as answering a clarifying question, are not tested.
  • Status. The harness is unit-tested, and the oracle and no-call baselines have been run. No model scores have been published with this release.

Attribution

The tool catalog, argument kinds, and training-style prompt come from LiquidAI/phone-assistant-tools, licensed Apache-2.0. The benchmark items, generator and harness are released under the same license.