JaspinXu commited on
Commit
7f8c3dc
·
verified ·
1 Parent(s): 9964a8d

Update model card

Browse files
Files changed (1) hide show
  1. README.md +59 -44
README.md CHANGED
@@ -25,41 +25,83 @@ tags:
25
 
26
  **Code** [github.com/JaspinXu/KnowWhenToHandOff](https://github.com/JaspinXu/KnowWhenToHandOff) · **Data** [KnowWhenToHandOff-data](https://huggingface.co/datasets/JaspinXu/KnowWhenToHandOff-data) · **Family** [SFT](https://huggingface.co/JaspinXu/KnowWhenToHandOff-Qwen3-4B-SFT) · [R1](https://huggingface.co/JaspinXu/KnowWhenToHandOff-Qwen3-4B-R1) · [R2](https://huggingface.co/JaspinXu/KnowWhenToHandOff-Qwen3-4B-R2)
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  ## Quick start
29
 
30
- The model is a standard Qwen3 chat model with tool calling. It was trained with
31
- the τ²-bench domain policy as the system prompt and the domain's tools,
32
- including `transfer_to_human_agents`; for faithful behaviour run it inside the
33
- evaluation harness of the [code repository](https://github.com/JaspinXu/KnowWhenToHandOff).
34
 
35
  ```python
36
  from transformers import AutoModelForCausalLM, AutoTokenizer
37
 
38
  repo = "JaspinXu/KnowWhenToHandOff-Qwen3-4B-R2"
39
  tokenizer = AutoTokenizer.from_pretrained(repo)
40
- model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype="auto", device_map="auto")
41
-
42
- tools = [{"type": "function", "function": {
43
- "name": "transfer_to_human_agents",
44
- "description": "Transfer the user to a human agent with a summary of the issue.",
45
- "parameters": {"type": "object", "properties": {"summary": {"type": "string"}}, "required": ["summary"]},
46
- }}]
 
 
 
 
 
 
 
 
 
47
  messages = [
48
- {"role": "system", "content": "<the airline or retail policy from tau2-bench>"},
49
- {"role": "user", "content": "I need to book the unaccompanied-minor escort service for my child."},
50
  ]
51
- inputs = tokenizer.apply_chat_template(messages, tools=tools, add_generation_prompt=True, return_tensors="pt").to(model.device)
 
 
 
52
  output = model.generate(inputs, max_new_tokens=512)
53
  print(tokenizer.decode(output[0][inputs.shape[-1]:], skip_special_tokens=True))
54
  ```
55
 
56
- Serving with vLLM (OpenAI-compatible, tool calls parsed):
57
 
58
  ```bash
59
- vllm serve JaspinXu/KnowWhenToHandOff-Qwen3-4B-R2 --enable-auto-tool-choice --tool-call-parser hermes
 
60
  ```
61
 
62
- ## Model
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  - Base model: Qwen/Qwen3-4B-Instruct-2507 (revision
65
  `cdbee75f17c01a7cc42f958dc650907174af0554`), Apache-2.0.
@@ -70,17 +112,6 @@ vllm serve JaspinXu/KnowWhenToHandOff-Qwen3-4B-R2 --enable-auto-tool-choice --to
70
  `fc0055dc4e0a316c3f83133267fbd6faaa770992`; all sources in
71
  [reports/main/sources.json](https://github.com/JaspinXu/KnowWhenToHandOff/blob/main/reports/main/sources.json).
72
 
73
- ## Model family
74
-
75
- | Model | Training | Hand-off F1 | Over-escalation | Use it for |
76
- | --- | --- | --- | --- | --- |
77
- | [SFT (B2)](https://huggingface.co/JaspinXu/KnowWhenToHandOff-Qwen3-4B-SFT) | LoRA SFT on 790 filtered teacher dialogues | 0.768 | 0.016 | starting point; precise but misses hand-offs |
78
- | [R1](https://huggingface.co/JaspinXu/KnowWhenToHandOff-Qwen3-4B-R1) | GRPO from B2, task reward only | 0.802 | 0.462 | studying the outcome-reward loophole |
79
- | [R2](https://huggingface.co/JaspinXu/KnowWhenToHandOff-Qwen3-4B-R2) | GRPO from B2, task reward + violation and hand-off penalties | **0.812** | 0.103 | the best-calibrated hand-off model |
80
-
81
- Task success on the official test tasks is the same for all three within
82
- noise (0.33–0.35).
83
-
84
  ## Intended use
85
 
86
  Studying when a tool-using customer-service agent should hand off to a human,
@@ -95,22 +126,6 @@ requests for a human, out-of-scope requests, hard negatives); the user
95
  simulator is Qwen3-30B-A3B-Instruct-2507. No real user data. Test tasks were
96
  never used for training or selection.
97
 
98
- ## Evaluation
99
-
100
- Test split, protocol frozen in [ADR-005](https://github.com/JaspinXu/KnowWhenToHandOff/blob/main/docs/adr/ADR-005-evaluation-protocol.md); 95 % bootstrap intervals over tasks.
101
-
102
- | Metric | This model | B2 (SFT start) | Source |
103
- | --- | --- | --- | --- |
104
- | Success (pass^1), test_main | 0.342 [0.245, 0.449] | 0.327 [0.224, 0.434] | [main table](https://github.com/JaspinXu/KnowWhenToHandOff/blob/main/reports/main/main_table.md) |
105
- | Paired Δ success vs B2 | +0.015 [−0.056, 0.082] | — | [paired differences](https://github.com/JaspinXu/KnowWhenToHandOff/blob/main/reports/main/paired_differences.md) |
106
- | pass^4 | 0.122 [0.041, 0.224] | 0.102 [0.041, 0.204] | [main table](https://github.com/JaspinXu/KnowWhenToHandOff/blob/main/reports/main/main_table.md) |
107
- | Violation rate (incl. off-reference writes) | 0.444 | 0.469 | same |
108
- | Hand-off F1 / precision / recall, test_handoff | **0.812** / 0.886 / 0.750 | 0.768 / 0.976 / 0.633 | [`R2-final-test_handoff-s0-20261007`](https://huggingface.co/datasets/JaspinXu/KnowWhenToHandOff-data/blob/main/runs/R2-final-test_handoff-s0-20261007/metrics.json) |
109
- | Over-escalation, test_handoff | 0.103 | 0.016 | same |
110
- | Worst-style success / style gap | 0.316 / 0.112 | 0.327 / 0.112 | [styles](https://github.com/JaspinXu/KnowWhenToHandOff/blob/main/reports/main/styles.md) |
111
-
112
- **Known behaviour.** R2 removes R1's over-escalation but sometimes makes the opposite error on out-of-scope requests: it refuses and tells the user to contact the company directly without calling the transfer tool, or substitutes an unrelated write (under-escalation 0.25). Once it justified a hand-off with a policy that does not exist.
113
-
114
  ## Limitations
115
 
116
  - One user simulator (Qwen3-30B-A3B-Instruct-2507, which also generated the
 
25
 
26
  **Code** [github.com/JaspinXu/KnowWhenToHandOff](https://github.com/JaspinXu/KnowWhenToHandOff) · **Data** [KnowWhenToHandOff-data](https://huggingface.co/datasets/JaspinXu/KnowWhenToHandOff-data) · **Family** [SFT](https://huggingface.co/JaspinXu/KnowWhenToHandOff-Qwen3-4B-SFT) · [R1](https://huggingface.co/JaspinXu/KnowWhenToHandOff-Qwen3-4B-R1) · [R2](https://huggingface.co/JaspinXu/KnowWhenToHandOff-Qwen3-4B-R2)
27
 
28
+ **R2** is Qwen3-4B-Instruct-2507 trained with SFT and then multi-turn GRPO on the τ²-bench airline and retail domains, with a reward that adds penalties for rule violations, unnecessary hand-offs and missed hand-offs. It has the best hand-off F1 of the study (0.812) with 10 % over-escalation, at the same task success as its SFT starting point.
29
+
30
+ ## Model family
31
+
32
+ | Model | Training | Hand-off F1 | Over-escalation | Use it for |
33
+ | --- | --- | --- | --- | --- |
34
+ | [SFT (B2)](https://huggingface.co/JaspinXu/KnowWhenToHandOff-Qwen3-4B-SFT) | LoRA SFT on 790 filtered teacher dialogues | 0.768 | 0.016 | starting point; precise but misses hand-offs |
35
+ | [R1](https://huggingface.co/JaspinXu/KnowWhenToHandOff-Qwen3-4B-R1) | GRPO from B2, task reward only | 0.802 | 0.462 | studying the outcome-reward loophole |
36
+ | [R2](https://huggingface.co/JaspinXu/KnowWhenToHandOff-Qwen3-4B-R2) | GRPO from B2, task reward + violation and hand-off penalties | **0.812** | 0.103 | the best-calibrated hand-off model |
37
+
38
+ Task success on the official test tasks is the same for all three within
39
+ noise (0.33–0.35).
40
+
41
  ## Quick start
42
 
43
+ A standard Qwen3 chat model with tool calling. It was trained with the
44
+ τ²-bench domain policy as the system prompt and the domain's tools, including
45
+ `transfer_to_human_agents`; for faithful behaviour run it inside the evaluation
46
+ harness of the [code repository](https://github.com/JaspinXu/KnowWhenToHandOff).
47
 
48
  ```python
49
  from transformers import AutoModelForCausalLM, AutoTokenizer
50
 
51
  repo = "JaspinXu/KnowWhenToHandOff-Qwen3-4B-R2"
52
  tokenizer = AutoTokenizer.from_pretrained(repo)
53
+ model = AutoModelForCausalLM.from_pretrained(
54
+ repo, torch_dtype="auto", device_map="auto"
55
+ )
56
+
57
+ transfer = {
58
+ "type": "function",
59
+ "function": {
60
+ "name": "transfer_to_human_agents",
61
+ "description": "Transfer the user to a human agent.",
62
+ "parameters": {
63
+ "type": "object",
64
+ "properties": {"summary": {"type": "string"}},
65
+ "required": ["summary"],
66
+ },
67
+ },
68
+ }
69
  messages = [
70
+ {"role": "system", "content": "<airline or retail policy>"},
71
+ {"role": "user", "content": "I need the unaccompanied-minor service."},
72
  ]
73
+ inputs = tokenizer.apply_chat_template(
74
+ messages, tools=[transfer], add_generation_prompt=True,
75
+ return_tensors="pt",
76
+ ).to(model.device)
77
  output = model.generate(inputs, max_new_tokens=512)
78
  print(tokenizer.decode(output[0][inputs.shape[-1]:], skip_special_tokens=True))
79
  ```
80
 
81
+ Serve it with vLLM (OpenAI-compatible API, tool calls parsed):
82
 
83
  ```bash
84
+ vllm serve JaspinXu/KnowWhenToHandOff-Qwen3-4B-R2 \
85
+ --enable-auto-tool-choice --tool-call-parser hermes
86
  ```
87
 
88
+ ## Evaluation
89
+
90
+ Test split, protocol frozen in [ADR-005](https://github.com/JaspinXu/KnowWhenToHandOff/blob/main/docs/adr/ADR-005-evaluation-protocol.md); 95 % bootstrap intervals over tasks.
91
+
92
+ | Metric | This model | B2 (SFT start) | Source |
93
+ | --- | --- | --- | --- |
94
+ | Success (pass^1), test_main | 0.342 [0.245, 0.449] | 0.327 [0.224, 0.434] | [main table](https://github.com/JaspinXu/KnowWhenToHandOff/blob/main/reports/main/main_table.md) |
95
+ | Paired Δ success vs B2 | +0.015 [−0.056, 0.082] | — | [paired differences](https://github.com/JaspinXu/KnowWhenToHandOff/blob/main/reports/main/paired_differences.md) |
96
+ | pass^4 | 0.122 [0.041, 0.224] | 0.102 [0.041, 0.204] | [main table](https://github.com/JaspinXu/KnowWhenToHandOff/blob/main/reports/main/main_table.md) |
97
+ | Violation rate (incl. off-reference writes) | 0.444 | 0.469 | same |
98
+ | Hand-off F1 / precision / recall, test_handoff | **0.812** / 0.886 / 0.750 | 0.768 / 0.976 / 0.633 | [`R2-final-test_handoff-s0-20261007`](https://huggingface.co/datasets/JaspinXu/KnowWhenToHandOff-data/blob/main/runs/R2-final-test_handoff-s0-20261007/metrics.json) |
99
+ | Over-escalation, test_handoff | 0.103 | 0.016 | same |
100
+ | Worst-style success / style gap | 0.316 / 0.112 | 0.327 / 0.112 | [styles](https://github.com/JaspinXu/KnowWhenToHandOff/blob/main/reports/main/styles.md) |
101
+
102
+ **Known behaviour.** R2 removes R1's over-escalation but sometimes makes the opposite error on out-of-scope requests: it refuses and tells the user to contact the company directly without calling the transfer tool, or substitutes an unrelated write (under-escalation 0.25). Once it justified a hand-off with a policy that does not exist.
103
+
104
+ ## Training details
105
 
106
  - Base model: Qwen/Qwen3-4B-Instruct-2507 (revision
107
  `cdbee75f17c01a7cc42f958dc650907174af0554`), Apache-2.0.
 
112
  `fc0055dc4e0a316c3f83133267fbd6faaa770992`; all sources in
113
  [reports/main/sources.json](https://github.com/JaspinXu/KnowWhenToHandOff/blob/main/reports/main/sources.json).
114
 
 
 
 
 
 
 
 
 
 
 
 
115
  ## Intended use
116
 
117
  Studying when a tool-using customer-service agent should hand off to a human,
 
126
  simulator is Qwen3-30B-A3B-Instruct-2507. No real user data. Test tasks were
127
  never used for training or selection.
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  ## Limitations
130
 
131
  - One user simulator (Qwen3-30B-A3B-Instruct-2507, which also generated the