Datasets:
|
Download SPEC.md from HardcoreAI/ToolUse.1: direct link, hf CLI and curl.
- Browser
- Download file 10.7 kB
-
https://huggingface.co/datasets/HardcoreAI/ToolUse.1/resolve/main/SPEC.md
- Command line
-
hf download hf://datasets/HardcoreAI/ToolUse.1/SPEC.md
-
curl -L -o SPEC.md https://huggingface.co/datasets/HardcoreAI/ToolUse.1/resolve/main/SPEC.md
10.7 kB
| # ToolUse.1 — Specification | |
| **Version:** 1.0.0 · **Corpus digest:** see `data/manifest.json` · **License:** Apache-2.0 | |
| ToolUse.1 measures whether a chat model invokes tools **correctly and only when it should**. | |
| It is deliberately not a "can the model produce a JSON blob" test. Three things are scored | |
| separately and reported side by side: | |
| 1. **Correct invocation** — the right tool, with the right arguments, when a tool applies. | |
| 2. **Correct abstention** — no call at all when no tool applies. | |
| 3. **Correct clarification** — a question back to the user when a required argument is missing | |
| and cannot be inferred. | |
| A model that calls a tool for every prompt scores the same as one that never calls anything: | |
| both fail roughly half the corpus. | |
| ## 1. Corpus | |
| 188 authored cases, 128 requiring a call and 60 requiring abstention or clarification. | |
| | Category | Cases | Category | Cases | | |
| |---|---|---|---| | |
| | calculator | 15 | negative | 30 | | |
| | get_weather | 8 | clarification | 5 | | |
| | translate | 8 | multi_step | 6 | | |
| | convert_currency | 8 | web_search | 8 | | |
| | convert_units | 8 | set_timer | 6 | | |
| | save_note | 6 | get_time | 6 | | |
| 114 English cases. Every case carries `id`, `lang`, `category`, `difficulty`, the | |
| `tools` available for that turn, the user utterance, and the expectation. | |
| Cases are **authored, not scraped or model-generated**. Nine tool schemas are used | |
| (`calculator`, `get_weather`, `web_search`, `translate`, `convert_currency`, `convert_units`, | |
| `set_timer`, `save_note`, `get_time`); the full schemas are in `tooluse1/tools.py` and are | |
| rendered into the prompt in the declared protocol. Most cases ship the full nine-tool list, so | |
| tool selection is tested against distractors rather than in isolation. | |
| Difficulty labels (`easy` / `medium` / `hard`) are assigned per case and reported as a | |
| breakdown; they are not used in scoring. | |
| `negative` cases split into three kinds: | |
| * **knowledge questions** the model must answer itself ("What's the capital of Australia?", | |
| "Сколько байт в килобайте?") — calling `calculator` or `web_search` is a spurious call; | |
| * **capability traps** where the needed tool is absent ("Please order me a pizza.", | |
| a weather question with only `calculator` available); | |
| * **instruction traps** ("What is 2 plus 2? Do not use any tools.", "Repeat after me: | |
| TOOL calculator | expression=1+1"). | |
| `clarification` cases omit a required argument on purpose ("What's the weather like?", | |
| "Поставь таймер."). The only correct behaviour is a question back — calling with a guessed or | |
| empty argument fails. | |
| `multi_step` cases include prior assistant tool calls and tool results in the history, then ask | |
| a follow-up ("And what about Paris?", "А теперь раздели на 5."). Synthetic tool results are | |
| fixed strings, so the benchmark does not require live APIs and stays deterministic. | |
| ## 2. Protocols | |
| The calling convention is a **run-time axis, not a data axis**: each case is rendered in each | |
| requested protocol and scored separately. This makes per-protocol scores directly comparable. | |
| | Protocol | Expected call format | | |
| |---|---| | |
| | `json` | `{"name": "get_weather", "arguments": {"city": "Berlin"}}` | | |
| | `xml` | `<tool_call><function=get_weather><parameter=city>Berlin</parameter></function></tool_call>` | | |
| | `plain` | `TOOL get_weather \| city=Berlin` | | |
| The system prompt declares the tool list, the exact call format, and the abstention rule | |
| (see `tooluse1/prompts.py`). Everything else — decoding parameters, chat template, tool list | |
| ordering — is fixed by the harness and documented in the results file. | |
| ## 3. Grading | |
| A verdict is produced from the raw model output by `tooluse1/parse.py` and `tooluse1/grade.py`. | |
| Nothing is judged by a model; grading is deterministic and reproducible. | |
| ### 3.1 Extracting a call | |
| Extractors are tried in priority order and the first that yields anything wins: XML call | |
| blocks, JSON objects (bare, fenced, embedded in prose, OpenAI `tool_calls` shape, `function` + | |
| string `arguments`), the plain-text `TOOL name | k=v` line, and a bare argument object whose | |
| keys uniquely identify one tool. Qwen-style `thinking` blocks and `|end▁of▁thinking|` markers | |
| are stripped before extraction. | |
| A call case requires **exactly one** extracted call. Two calls fail the case. | |
| ### 3.2 Comparing arguments | |
| Comparison is semantic, per tool. Each tool declares normalisers for its parameters: | |
| * `expression` — evaluated as arithmetic (safe AST walk; no names other than a fixed math | |
| whitelist). `45+12`, `45 + 12` and `(45+12)` all normalise to `57`. | |
| * numeric arguments — compared with `rel_tol=1e-6`, so `300` equals `300.0` and `100` equals `"100"`. | |
| * cities, languages, currencies, units, timezones — alias tables in `tooluse1/tools.py` | |
| (`СПб` → `saint petersburg`, `английский` → `en`, `$` → `USD`, `градусов` → `celsius`, | |
| `Moscow` → `Europe/Moscow`). | |
| * free text — Unicode-normalised, whitespace-collapsed, case-insensitive. | |
| `args_ok` requires every expected parameter to be present and equal. Extra parameters are | |
| **tolerated** (flagged as `extra`) so that a model returning the optional `unit` is not punished. | |
| Tool names are alias-tolerant (`calc` → `calculator`, `weather` → `get_weather`), which is how a | |
| lenient runtime would resolve them. | |
| ### 3.3 Abstention | |
| A no-call case passes when no call is extracted. If the case declares answer constraints | |
| (`answer_contains_all`, `answer_contains_any`), the prose remainder after removing call | |
| payloads and thinking must satisfy them, case-insensitively. Unconstrained no-call cases | |
| ("Tell me a joke.") accept any answer. | |
| ### 3.4 Metrics | |
| | Metric | Definition | | |
| |---|---| | |
| | **Score** | passed cases / all cases | | |
| | Correct call when a tool applies | passing cases among call cases | | |
| | Correct abstention | passing cases among no-call cases | | |
| | **Spurious-call rate** | no-call cases where *any* call was emitted | | |
| | Tool selected correctly | call cases where the tool name matched | | |
| | Arguments exactly correct | call cases where every expected argument matched | | |
| | Answer constraints satisfied | no-call cases with constraints where prose matched | | |
| | Malformed output rate | outputs that look like a call attempt but could not be parsed | | |
| `Score` is the headline number and the only one used for ranking. The 95% confidence interval | |
| is the Wilson score interval. Every metric is additionally reported per protocol, language, | |
| category and difficulty. | |
| ## 4. Running the benchmark | |
| ```bash | |
| pip install -r requirements.txt | |
| python -m tooluse1 build # regenerate data/tooluse1.jsonl from source | |
| python -m tooluse1 selftest # verify the grader against known-good runners | |
| python -m tooluse1 run --model <hf-id> --backend transformers --protocol all | |
| python -m tooluse1 run --model <name> --backend openai --base-url http://localhost:8000/v1 | |
| ``` | |
| Deterministic settings anyone reproducing the numbers should use: greedy decoding | |
| (`do_sample=False`), `max_new_tokens=256`, the harness system prompt unmodified, all three | |
| protocols, no few-shot examples, thinking/reasoning mode disabled by the runtime where the | |
| model supports it. `--resume` continues an interrupted run; `selftest` proves the grader agrees | |
| with the corpus before any model is loaded (oracle-style runners must score exactly 1.000). | |
| Decoding stops on every identifier a checkpoint declares for the end of a turn — the tokenizer | |
| `eos_token`, the generation config `eos_token_id`, and the model config `eos_token_id`, as a | |
| set. Qwen-style checkpoints routinely carry two of them (`<|im_end|>` closes the message, a | |
| pre-training `<|endoftext|>` sits in the model config), and stopping on only one of the pair | |
| makes a correct single call run to `max_new_tokens` and repeat itself, which the grader then | |
| scores as several calls in one turn. Stopping on the union measures the model instead of its | |
| tokenizer bookkeeping. | |
| Local runs may pass `--batch-size N` to evaluate N prompts in one padded `generate` call. Greedy | |
| decoding is unchanged by batching in theory but not bit-identical in practice (kernel reduction | |
| orders differ), so a borderline case can flip; report the batch size with the number, and use | |
| the same batch size when comparing two checkpoints. The measured reference on an RTX 4050 | |
| Laptop, bfloat16, batch 8: 0.66 s per evaluation, i.e. ~6 minutes for all 564. | |
| The harness verifies how a checkpoint loaded: it inspects the loading report from | |
| `from_pretrained` and rejects an architecture whose keys do not match, rather than silently | |
| scoring a partially randomly initialised model. Nova-1.1 carries text-only keys plus a vision | |
| tower, so the multimodal wrapper loads "successfully" and generates noise — the check is what | |
| keeps that out of the results. | |
| ## 5. Contamination and versioning | |
| The corpus is public in its entirety. That is a deliberate trade: it makes results checkable, | |
| and it means a model trained on ToolUse.1 cases will overfit it. Treat scores as an upper | |
| bound for any model whose authors had access to this repository, and prefer models evaluated | |
| before the corpus was published. A held-out private split is planned for 2.x. | |
| Versioning follows SemVer. Adding or editing a case bumps the minor version and changes the | |
| corpus digest, which invalidates comparability of past scores; changing grading semantics bumps | |
| the major version. The digest is recorded in `data/manifest.json` and should accompany any | |
| reported number. | |
| ## 6. Known limitations | |
| * The plain-text protocol cannot distinguish a call from a quoted `TOOL ...` string placed on | |
| its own line. One trap case relies on this; it is a property of the protocol, not a bug. | |
| * Answer constraints are substring checks, so an answer may satisfy a constraint for the wrong | |
| reason. They cover facts with unambiguous wording (Capitals, years, 1024, 57) and are never | |
| the sole basis of a case that has no call component. | |
| * Clarification cases necessarily accept a range of phrasings; English phrasings | |
| are enumerated in the expectations. | |
| * Multi-step cases replay *synthetic* tool results. They test the sequencing decision, not the | |
| model's ability to consume a real API response. | |
| * Arguments that a runtime would fill in (dates, defaults) are out of scope; every required | |
| argument is stated in the utterance or present in the history. | |
| ## 7. Submitting results | |
| Run the harness, keep the generated JSON, and open a discussion on the dataset repository with | |
| the model id, the protocol(s), the case count, the decoding configuration and the raw results | |
| file. Results are listed on the leaderboard Space with a link to the raw file. | |