Files changed (1) hide show
  1. README.md +242 -230
README.md CHANGED
@@ -1,231 +1,243 @@
1
- ---
2
- base_model:
3
- - Qwen/Qwen2.5-7B-Instruct
4
- language:
5
- - en
6
- library_name: transformers
7
- license: apache-2.0
8
- ---
9
-
10
- # Model Card for EdgeRunner-Command-Nested
11
-
12
- EdgeRunner-Command-Nested is an advanced large language model designed specifically for handling complex nested function calls. Initialized from Qwen2.5-7B-Instruct, further enhanced by the integration of the Hermes function call template and additional training on a specialized dataset (based on TinyAgent). This extra dataset focuses on personal domain applications, providing the model with a robust understanding of nested function scenarios that are typical in complex user interactions.
13
-
14
- ### Data Processing Process
15
-
16
- #### 1. **Data Augmentation:**
17
- - **TinyAgent Augmentation:**
18
- TinyAgent consists of 16 core functions, but each sample only requires a subset of these functions to work. To ensure diversity and avoid overfitting, we used an augmentation technique where each sample is provided with a random superset of functions. This superset covers all the functions that the specific sample requires but is always a subset of the 16 total functions available in TinyAgent. By doing so, we allow the model to generalize across various combinations of functions while still providing the necessary context for each sample to execute correctly.
19
-
20
- #### 2. **Additional Data Samples:**
21
- - **GPT-4o Augmented Samples:**
22
- To further enhance the dataset, we used GPT-4 for function synthesis in the personal assistant domain. This was done by using a pipeline that automatically generates function definitions, corresponding queries, and execution plans. After generating the function data, each sample was verified for validity to ensure the correctness of the functional outputs. Through this pipeline, we produced approximately 2,000 additional samples. These samples follow the TinyAgent format but introduce a broader range of new and more complex functions. This expanded set of functions enriches the model's understanding of diverse scenarios, allowing it to handle more varied function calls beyond the synthesis-based functions of TinyAgent, thereby improving its ability to generalize across tasks.
23
-
24
- #### 3. **Data Conversion:**
25
- - **Hermes Format Conversion:**
26
- All function call data, including those from TinyAgent, the additional samples generated, and the function call data we had previously, were converted to the Hermes format. In TinyAgent, the Hermes format uses the `$ + number` format to indicate nested use cases. This ensures consistency in data representation while also clearly defining nested function use cases for enhanced interpretability. Standardizing all data in Hermes format allows the model to efficiently process and understand function calls across a variety of scenarios.
27
-
28
- ### Example Code
29
-
30
- ```python
31
- from transformers import AutoModelForCausalLM, AutoTokenizer
32
- import torch
33
-
34
- model_id = "edgerunner-ai/EdgeRunner-Command-Nested"
35
- tokenizer = AutoTokenizer.from_pretrained(model_id)
36
-
37
- # You can find the full tools list here https://jsonblob.com/1290566717196328960
38
- tools = [{
39
- "name": "open_and_get_file_path",
40
- "description": "Opens the file and returns its path.",
41
- "parameters": {
42
- "type": "object",
43
- "properties": {
44
- "file_name": {
45
- "type": "str",
46
- "description": "The name of the file to open"
47
- }
48
- },
49
- "required": [
50
- "file_name"
51
- ]
52
- }
53
- }, ...]
54
-
55
- conversation = [{
56
- "role": "user",
57
- "content": "Send an email to Andrea attached with the file 'report.pdf' and ask when he is available for a meeting."
58
- }]
59
-
60
- # Render the tool use prompt as a string:
61
- tool_use_prompt = tokenizer.apply_chat_template(
62
- conversation,
63
- tools=tools,
64
- tokenize=False,
65
- add_generation_prompt=True,
66
- )
67
-
68
- inputs = tokenizer(tool_use_prompt, return_tensors="pt")
69
-
70
- model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
71
-
72
- outputs = model.generate(**inputs, max_new_tokens=1000)
73
- print(tokenizer.decode(outputs[0], skip_special_tokens=True))
74
- ```
75
-
76
- # Examples
77
-
78
- ## Simple function
79
-
80
- ### Single turn
81
-
82
- ```markdown
83
- **User:**
84
- How is the weather today in New York?
85
-
86
- **Assistant:**
87
- I don't have direct access to real-time data like current weather conditions. However, I can help you find out by performing a web search. Let me do that now.
88
-
89
- <tool_call>
90
- {"name": "web_search", "arguments": {"query": "weather today New York"}}
91
- </tool_call>
92
- ```
93
-
94
- ### Multi turn
95
-
96
- ```markdown
97
- **User:**
98
- I want to search for some information about music, can you help me with that?
99
-
100
- **Assistant:**
101
- Of course! What specific information about music are you looking for?
102
-
103
- **User:**
104
- I'm looking for information about the history of rock music.
105
-
106
- **Assistant:**
107
- <tool_call>
108
- {"name": "web_search", "arguments": {"query": "history of rock music"}}
109
- </tool_call>
110
- ```
111
-
112
- ```markdown
113
- **User:**
114
- I want to search for some information about music, can you help me with that?
115
-
116
- **Assistant:**
117
- Of course! What specific information about music are you looking for?
118
-
119
- **User:**
120
- I'm looking for information about the history of rock music and also information about Justin Bieber.
121
-
122
- **Assistant:**
123
- <tool_call>
124
- {"name": "web_search", "arguments": {"query": "history of rock music"}}
125
- </tool_call>
126
- <tool_call>
127
- {"name": "web_search", "arguments": {"query": "information about Justin Bieber"}}
128
- </tool_call>
129
- ```
130
-
131
- ## Nested functions
132
-
133
- ### Success
134
-
135
- ```markdown
136
- **User:**
137
- Create a meeting with Mr.A and Mr.B to discuss Edgerunner on 27/9/2024 at 5:00 PM.
138
-
139
- **Assistant:**
140
- <tool_call>
141
- {"name": "get_email_address", "arguments": {"name": "Mr.A"}}
142
- </tool_call>
143
- <tool_call>
144
- {"name": "get_email_address", "arguments": {"name": "Mr.B"}}
145
- </tool_call>
146
- <tool_call>
147
- {"name": "create_calendar_event", "arguments": {"title": "Edgerunner Discussion", "start_date": "2024-09-27 17:00:00", "end_date": "2024-09-27 18:00:00", "location": "", "invitees": ["$1", "$2"], "notes": "", "calendar": null}}
148
- </tool_call>
149
- ```
150
-
151
- ```markdown
152
- **User:**
153
- Generate an image with the prompt 'A beautiful landscape with mountains and a lake' and send it to the Discord server with the message 'Here is a beautiful landscape'.
154
-
155
- **Assistant:**
156
- <tool_call>
157
- {"name": "generate_image", "arguments": {"prompt": "A beautiful landscape with mountains and a lake"}}
158
- </tool_call>
159
- <tool_call>
160
- {"name": "send_to_discord", "arguments": {"message": "Here is a beautiful landscape.", "attachments": ["$1"]}}
161
- </tool_call>
162
- ```
163
-
164
-
165
- ```markdown
166
- **User:**
167
- Send the directions to the Eiffel Tower from the Louvre Museum to Mr. C and Mr. D with an SMS message.
168
-
169
- **Assistant:**
170
- <tool_call>
171
- {"name": "get_phone_number", "arguments": {"name": "Mr.C"}}
172
- </tool_call>
173
- <tool_call>
174
- {"name": "get_phone_number", "arguments": {"name": "Mr.D"}}
175
- </tool_call>
176
- <tool_call>
177
- {"name": "maps_show_directions", "arguments": {"start_location": "Louvre Museum", "end_location": "Eiffel Tower", "transport": "d"}}
178
- </tool_call>
179
- <tool_call>
180
- {"name": "send_sms", "arguments": {"recipients": ["$1", "$2"], "message": "Here are the directions to get from Louvre Museum to Eiffel Tower: $3"}}
181
- </tool_call>
182
- ```
183
-
184
- ```markdown
185
- **User:**
186
- Send an email to Mr. A attached with the file 'report.pdf' and ask when he is available for a meeting.
187
-
188
- **Assistant:**
189
- <tool_call>
190
- {"name": "get_email_address", "arguments": {"name": "Mr.A"}}
191
- </tool_call>
192
- <tool_call>
193
- {"name": "open_and_get_file_path", "arguments": {"file_name": "report.pdf"}}
194
- </tool_call>
195
- <tool_call>
196
- {"name": "compose_new_email", "arguments": {"recipients": ["$1"], "cc": [], "subject": "Availability for Meeting", "context": "Please find the attached report. When are you available for a meeting?", "attachments": ["$2"]}}
197
- </tool_call>
198
- ```
199
-
200
- ### Failed
201
-
202
- ```markdown
203
- **User:**
204
- I want to generate an image and send it to Discord. Can you help me with that?
205
-
206
- **Assistant:**
207
- Of course! Could you please provide me with a description or prompt for the image you would like to generate?
208
-
209
- **User:**
210
- I want to generate an image of a cat with a gray background.
211
-
212
- **Assistant:**
213
- <tool_call>
214
- {"name": "generate_image", "arguments": {"prompt": "a cat with a gray background"}}
215
- </tool_call>
216
- <tool_call>
217
- {"name": "send_to_discord", "arguments": {"message": "", "attachments": ["image.png"]}}
218
- </tool_call>
219
- ```
220
-
221
- # Benchmarks
222
-
223
- ## Berkeley Function Calling Benchmark Results
224
-
225
- | Test Name | EdgeRunner-Command-Nested| Qwen/Qwen2.5-7B-Instruct |
226
- |-----------------------------|------------------------------------------------|--------------------------|
227
- | multiple_function | 0.95 | 0.81 |
228
- | parallel_multiple_function | 0.84 | 0.655 |
229
- | parallel_function | 0.86 | 0.69 |
230
- | simple | 0.96 | 0.9275 |
 
 
 
 
 
 
 
 
 
 
 
 
231
  | irrelevance | 0.74 | 0.625 |
 
1
+ ---
2
+ base_model:
3
+ - Qwen/Qwen2.5-7B-Instruct
4
+ language:
5
+ - zho
6
+ - eng
7
+ - fra
8
+ - spa
9
+ - por
10
+ - deu
11
+ - ita
12
+ - rus
13
+ - jpn
14
+ - kor
15
+ - vie
16
+ - tha
17
+ - ara
18
+ library_name: transformers
19
+ license: apache-2.0
20
+ ---
21
+
22
+ # Model Card for EdgeRunner-Command-Nested
23
+
24
+ EdgeRunner-Command-Nested is an advanced large language model designed specifically for handling complex nested function calls. Initialized from Qwen2.5-7B-Instruct, further enhanced by the integration of the Hermes function call template and additional training on a specialized dataset (based on TinyAgent). This extra dataset focuses on personal domain applications, providing the model with a robust understanding of nested function scenarios that are typical in complex user interactions.
25
+
26
+ ### Data Processing Process
27
+
28
+ #### 1. **Data Augmentation:**
29
+ - **TinyAgent Augmentation:**
30
+ TinyAgent consists of 16 core functions, but each sample only requires a subset of these functions to work. To ensure diversity and avoid overfitting, we used an augmentation technique where each sample is provided with a random superset of functions. This superset covers all the functions that the specific sample requires but is always a subset of the 16 total functions available in TinyAgent. By doing so, we allow the model to generalize across various combinations of functions while still providing the necessary context for each sample to execute correctly.
31
+
32
+ #### 2. **Additional Data Samples:**
33
+ - **GPT-4o Augmented Samples:**
34
+ To further enhance the dataset, we used GPT-4 for function synthesis in the personal assistant domain. This was done by using a pipeline that automatically generates function definitions, corresponding queries, and execution plans. After generating the function data, each sample was verified for validity to ensure the correctness of the functional outputs. Through this pipeline, we produced approximately 2,000 additional samples. These samples follow the TinyAgent format but introduce a broader range of new and more complex functions. This expanded set of functions enriches the model's understanding of diverse scenarios, allowing it to handle more varied function calls beyond the synthesis-based functions of TinyAgent, thereby improving its ability to generalize across tasks.
35
+
36
+ #### 3. **Data Conversion:**
37
+ - **Hermes Format Conversion:**
38
+ All function call data, including those from TinyAgent, the additional samples generated, and the function call data we had previously, were converted to the Hermes format. In TinyAgent, the Hermes format uses the `$ + number` format to indicate nested use cases. This ensures consistency in data representation while also clearly defining nested function use cases for enhanced interpretability. Standardizing all data in Hermes format allows the model to efficiently process and understand function calls across a variety of scenarios.
39
+
40
+ ### Example Code
41
+
42
+ ```python
43
+ from transformers import AutoModelForCausalLM, AutoTokenizer
44
+ import torch
45
+
46
+ model_id = "edgerunner-ai/EdgeRunner-Command-Nested"
47
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
48
+
49
+ # You can find the full tools list here https://jsonblob.com/1290566717196328960
50
+ tools = [{
51
+ "name": "open_and_get_file_path",
52
+ "description": "Opens the file and returns its path.",
53
+ "parameters": {
54
+ "type": "object",
55
+ "properties": {
56
+ "file_name": {
57
+ "type": "str",
58
+ "description": "The name of the file to open"
59
+ }
60
+ },
61
+ "required": [
62
+ "file_name"
63
+ ]
64
+ }
65
+ }, ...]
66
+
67
+ conversation = [{
68
+ "role": "user",
69
+ "content": "Send an email to Andrea attached with the file 'report.pdf' and ask when he is available for a meeting."
70
+ }]
71
+
72
+ # Render the tool use prompt as a string:
73
+ tool_use_prompt = tokenizer.apply_chat_template(
74
+ conversation,
75
+ tools=tools,
76
+ tokenize=False,
77
+ add_generation_prompt=True,
78
+ )
79
+
80
+ inputs = tokenizer(tool_use_prompt, return_tensors="pt")
81
+
82
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
83
+
84
+ outputs = model.generate(**inputs, max_new_tokens=1000)
85
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
86
+ ```
87
+
88
+ # Examples
89
+
90
+ ## Simple function
91
+
92
+ ### Single turn
93
+
94
+ ```markdown
95
+ **User:**
96
+ How is the weather today in New York?
97
+
98
+ **Assistant:**
99
+ I don't have direct access to real-time data like current weather conditions. However, I can help you find out by performing a web search. Let me do that now.
100
+
101
+ <tool_call>
102
+ {"name": "web_search", "arguments": {"query": "weather today New York"}}
103
+ </tool_call>
104
+ ```
105
+
106
+ ### Multi turn
107
+
108
+ ```markdown
109
+ **User:**
110
+ I want to search for some information about music, can you help me with that?
111
+
112
+ **Assistant:**
113
+ Of course! What specific information about music are you looking for?
114
+
115
+ **User:**
116
+ I'm looking for information about the history of rock music.
117
+
118
+ **Assistant:**
119
+ <tool_call>
120
+ {"name": "web_search", "arguments": {"query": "history of rock music"}}
121
+ </tool_call>
122
+ ```
123
+
124
+ ```markdown
125
+ **User:**
126
+ I want to search for some information about music, can you help me with that?
127
+
128
+ **Assistant:**
129
+ Of course! What specific information about music are you looking for?
130
+
131
+ **User:**
132
+ I'm looking for information about the history of rock music and also information about Justin Bieber.
133
+
134
+ **Assistant:**
135
+ <tool_call>
136
+ {"name": "web_search", "arguments": {"query": "history of rock music"}}
137
+ </tool_call>
138
+ <tool_call>
139
+ {"name": "web_search", "arguments": {"query": "information about Justin Bieber"}}
140
+ </tool_call>
141
+ ```
142
+
143
+ ## Nested functions
144
+
145
+ ### Success
146
+
147
+ ```markdown
148
+ **User:**
149
+ Create a meeting with Mr.A and Mr.B to discuss Edgerunner on 27/9/2024 at 5:00 PM.
150
+
151
+ **Assistant:**
152
+ <tool_call>
153
+ {"name": "get_email_address", "arguments": {"name": "Mr.A"}}
154
+ </tool_call>
155
+ <tool_call>
156
+ {"name": "get_email_address", "arguments": {"name": "Mr.B"}}
157
+ </tool_call>
158
+ <tool_call>
159
+ {"name": "create_calendar_event", "arguments": {"title": "Edgerunner Discussion", "start_date": "2024-09-27 17:00:00", "end_date": "2024-09-27 18:00:00", "location": "", "invitees": ["$1", "$2"], "notes": "", "calendar": null}}
160
+ </tool_call>
161
+ ```
162
+
163
+ ```markdown
164
+ **User:**
165
+ Generate an image with the prompt 'A beautiful landscape with mountains and a lake' and send it to the Discord server with the message 'Here is a beautiful landscape'.
166
+
167
+ **Assistant:**
168
+ <tool_call>
169
+ {"name": "generate_image", "arguments": {"prompt": "A beautiful landscape with mountains and a lake"}}
170
+ </tool_call>
171
+ <tool_call>
172
+ {"name": "send_to_discord", "arguments": {"message": "Here is a beautiful landscape.", "attachments": ["$1"]}}
173
+ </tool_call>
174
+ ```
175
+
176
+
177
+ ```markdown
178
+ **User:**
179
+ Send the directions to the Eiffel Tower from the Louvre Museum to Mr. C and Mr. D with an SMS message.
180
+
181
+ **Assistant:**
182
+ <tool_call>
183
+ {"name": "get_phone_number", "arguments": {"name": "Mr.C"}}
184
+ </tool_call>
185
+ <tool_call>
186
+ {"name": "get_phone_number", "arguments": {"name": "Mr.D"}}
187
+ </tool_call>
188
+ <tool_call>
189
+ {"name": "maps_show_directions", "arguments": {"start_location": "Louvre Museum", "end_location": "Eiffel Tower", "transport": "d"}}
190
+ </tool_call>
191
+ <tool_call>
192
+ {"name": "send_sms", "arguments": {"recipients": ["$1", "$2"], "message": "Here are the directions to get from Louvre Museum to Eiffel Tower: $3"}}
193
+ </tool_call>
194
+ ```
195
+
196
+ ```markdown
197
+ **User:**
198
+ Send an email to Mr. A attached with the file 'report.pdf' and ask when he is available for a meeting.
199
+
200
+ **Assistant:**
201
+ <tool_call>
202
+ {"name": "get_email_address", "arguments": {"name": "Mr.A"}}
203
+ </tool_call>
204
+ <tool_call>
205
+ {"name": "open_and_get_file_path", "arguments": {"file_name": "report.pdf"}}
206
+ </tool_call>
207
+ <tool_call>
208
+ {"name": "compose_new_email", "arguments": {"recipients": ["$1"], "cc": [], "subject": "Availability for Meeting", "context": "Please find the attached report. When are you available for a meeting?", "attachments": ["$2"]}}
209
+ </tool_call>
210
+ ```
211
+
212
+ ### Failed
213
+
214
+ ```markdown
215
+ **User:**
216
+ I want to generate an image and send it to Discord. Can you help me with that?
217
+
218
+ **Assistant:**
219
+ Of course! Could you please provide me with a description or prompt for the image you would like to generate?
220
+
221
+ **User:**
222
+ I want to generate an image of a cat with a gray background.
223
+
224
+ **Assistant:**
225
+ <tool_call>
226
+ {"name": "generate_image", "arguments": {"prompt": "a cat with a gray background"}}
227
+ </tool_call>
228
+ <tool_call>
229
+ {"name": "send_to_discord", "arguments": {"message": "", "attachments": ["image.png"]}}
230
+ </tool_call>
231
+ ```
232
+
233
+ # Benchmarks
234
+
235
+ ## Berkeley Function Calling Benchmark Results
236
+
237
+ | Test Name | EdgeRunner-Command-Nested| Qwen/Qwen2.5-7B-Instruct |
238
+ |-----------------------------|------------------------------------------------|--------------------------|
239
+ | multiple_function | 0.95 | 0.81 |
240
+ | parallel_multiple_function | 0.84 | 0.655 |
241
+ | parallel_function | 0.86 | 0.69 |
242
+ | simple | 0.96 | 0.9275 |
243
  | irrelevance | 0.74 | 0.625 |