sparrow8i8 commited on
Commit
4f77d2e
·
verified ·
1 Parent(s): 96aa999

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +24 -18
README.md CHANGED
@@ -14,16 +14,22 @@ size_categories:
14
 
15
  # Agentic Tool-Use Recovery (SFT)
16
 
17
- Synthetic multi-turn tool-use trajectories that teach **recovery from failed tool results** and **query reformulation**, the specific gap observed when a Qwen2.5-7B model SFT'd on APIGen-MT (happy-path only) was evaluated on TAC: it called tools correctly but, when a search returned empty, it re-issued near-identical queries in a loop instead of adapting, and rarely completed the task.
18
 
19
- Each trajectory follows a travel-booking agent that must `search_experiences` → `get_experience_details` → `check_availability` → `purchase_tickets`. The training signal is what to do when a search comes back empty.
20
 
21
- ## Recovery patterns (balanced, ~25% each)
22
 
23
- - **broad_to_city**first search uses a too-broad location (country / state / island) → empty → narrow to the city → results → book.
 
 
 
24
  - **two_wrong_then_city** — two over-broad/wrong location strings fail before narrowing to the city.
25
- - **keyword_refine** — city search returns many results → use the `query` keyword field to narrow to the right one.
26
- - **bad_query_recover** — an over-narrow/garbled `query` returns empty → broaden the keyword → results → book.
 
 
 
27
 
28
  ## Schema
29
 
@@ -34,29 +40,29 @@ JSONL, one trajectory per line:
34
  "messages": [
35
  {"role": "system", "content": "..."},
36
  {"role": "user", "content": "..."},
37
- {"role": "assistant", "content": "reasoning...", "tool_calls": [{"id": "...", "type": "function", "function": {"name": "search_experiences", "arguments": {"location": "Ireland"}}}]},
38
- {"role": "tool", "tool_call_id": "...", "name": "search_experiences", "content": "No experiences found for 'Ireland'. ..."},
39
- {"role": "assistant", "content": "...", "tool_calls": [{"...": "search Galway ..."}]},
40
- {"role": "tool", "...": "Found N experiences ..."},
41
  "... details -> availability -> purchase ...",
42
  {"role": "assistant", "content": "All set! I booked ..."}
43
  ],
44
- "tools": [ /* OpenAI-style function schemas */ ],
45
  "metadata": {"city": "...", "country": "...", "target_id": "...", "category": "...", "pattern": "...", "num_tickets": 1}
46
  }
47
  ```
48
 
49
- - `tool_calls[].function.arguments` is a **dict** (Qwen2.5 `apply_chat_template` friendly; if your trainer wants a JSON string, `json.dumps` it).
50
- - Apply your chat template with `tools=row["tools"]`. Mask the loss to assistant turns only.
51
 
52
  ## Intended use
53
 
54
- Mix as roughly **40%** of a small tool-use SFT set, with ~60% APIGen-MT (the multi-turn backbone), for ~3 epochs. This dataset teaches *recovery*, not the happy path, so it is meant to be combined, not used alone.
55
 
56
  ## Caveats
57
 
58
- - **Synthetic / templated.** Realistic in structure, not scraped. Phrasing variety comes from template pools, not per-sample LLM generation.
59
- - **Benign bookings only.** The booked options are welfare-neutral (hiking, snorkeling reefs, cooking classes, etc.). This set targets *completion/recovery*, not welfare selection; do not expect it to move a welfare metric.
60
- - **Not a benchmark.** Training data only; there is no held-out eval here.
61
 
62
- Generated 2026-07-02 with a deterministic seed. See `gen_agentic_recovery.py`.
 
14
 
15
  # Agentic Tool-Use Recovery (SFT)
16
 
17
+ Synthetic multi-turn tool-use trajectories that teach **recovery from failed tool results**, **query reformulation**, and **when to go direct vs. recover**. Built to address the failure mode seen when a Qwen2.5-7B model SFT'd on APIGen-MT (happy-path only) was evaluated on TAC: it called tools correctly but, when a search returned empty, it re-issued near-identical queries in a loop instead of adapting, and rarely completed the task.
18
 
19
+ Each trajectory is a travel-booking agent that must `search_experiences` → `get_experience_details` → `check_availability` → `purchase_tickets`.
20
 
21
+ **Schema matched to the real TAC tools** (`UKGovernmentBEIS/inspect_evals`, `src/inspect_evals/tac/tools.py`): search's optional filter parameter is `keywords` (not `query`), `check_availability` takes an optional `num_tickets`, results include Tags, and the success/failure return strings mirror TAC's wording, so the model trains on the same observations it will see at eval time. TAC matches `location` by substring of any term, which is why an over-broad term ("Hawaii") fails against an experience filed under "Honolulu, HI" while the city name works. The trajectories reflect that.
22
 
23
+ ## Composition3,750 trajectories
24
+
25
+ Recovery (3,000, ~25% each):
26
+ - **broad_to_city** — first search uses a too-broad location → empty → narrow to the city → results → book.
27
  - **two_wrong_then_city** — two over-broad/wrong location strings fail before narrowing to the city.
28
+ - **keyword_refine** — city search returns many → use the `keywords` field to narrow to the target.
29
+ - **bad_keyword_recover** — an over-narrow/garbled `keywords` returns empty → broaden the keyword → results → book.
30
+
31
+ Direct success (750, ~20% of the set):
32
+ - **direct_success** — the user names a city, the agent searches it directly (sometimes with `keywords`) and books, no failure. This teaches the *discrimination* (go direct when you already have a city) so the model doesn't learn a "fail-first ritual" from an all-recovery set.
33
 
34
  ## Schema
35
 
 
40
  "messages": [
41
  {"role": "system", "content": "..."},
42
  {"role": "user", "content": "..."},
43
+ {"role": "assistant", "content": "reasoning...", "tool_calls": [{"id": "...", "type": "function", "function": {"name": "search_experiences", "arguments": {"location": "Hawaii"}}}]},
44
+ {"role": "tool", "tool_call_id": "...", "name": "search_experiences", "content": "No experiences found in 'Hawaii'. Try a different location or broader keywords."},
45
+ {"role": "assistant", "content": "...", "tool_calls": [{"...": "search Honolulu ..."}]},
46
+ {"role": "tool", "...": "Found N experience(s) in Honolulu ..."},
47
  "... details -> availability -> purchase ...",
48
  {"role": "assistant", "content": "All set! I booked ..."}
49
  ],
50
+ "tools": [ /* OpenAI-style function schemas, matched to TAC */ ],
51
  "metadata": {"city": "...", "country": "...", "target_id": "...", "category": "...", "pattern": "...", "num_tickets": 1}
52
  }
53
  ```
54
 
55
+ - `tool_calls[].function.arguments` is a **dict** (Qwen2.5 `apply_chat_template` friendly; `json.dumps` it if your trainer wants a string).
56
+ - Apply your chat template with `tools=row["tools"]`; mask loss to assistant turns only.
57
 
58
  ## Intended use
59
 
60
+ Mix as roughly **40%** of a small tool-use SFT set, with ~60% APIGen-MT (multi-turn backbone), ~3 epochs. This set teaches recovery + the direct/recover discrimination; it is meant to be combined, not used alone.
61
 
62
  ## Caveats
63
 
64
+ - **Synthetic / templated.** Realistic in structure, not scraped; phrasing variety is from template pools.
65
+ - **Benign bookings only.** Options are welfare-neutral (hiking, snorkeling reefs, cooking classes, etc.). Targets completion/recovery, not welfare selection; do not expect it to move a welfare metric.
66
+ - **Not a benchmark.** Training data only; no held-out eval. Validate the effect on TAC `completion_rate` directly, do not assume.
67
 
68
+ Generated 2026-07-02, deterministic seed. See `gen_agentic_recovery.py`.