Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ToolACE handler #619

Closed
wants to merge 3 commits into from
Closed

Add ToolACE handler #619

wants to merge 3 commits into from

Conversation

XuHwang
Copy link

@XuHwang XuHwang commented Sep 2, 2024

This PR adds the handler of the ToolACE model, which finetunes LLaMA-3.1-8B-Instruct model with ToolACE dataset, obtaining wonderful points in functional calling.

Here are the results on the latest (0824) version evaluated in our machine:

Rank Overall Acc Model AST Summary Exec Summary Simple AST Multiple AST Parallel AST Parallel Multiple AST Simple Exec Multiple Exec Parallel Exec Parallel Multiple Exec Irrelevance Relevance
1 85.91% ToolACE-8B (FC) 80.24% 92.21% 70.76% 85.78% 84.00% 80.42% 96.86% 94.00% 88.00% 90.00% 81.50% 87.80%

Thanks for your efforts in holding such a wonderful leaderboard. We need your help (@HuanzhiMao, @CharlieJCJ ) in adding our model to the leaderboard. Thanks a lot~

@XuHwang XuHwang changed the title add ToolACE handler Add ToolACE handler Sep 2, 2024
@HuanzhiMao
Copy link
Collaborator

Thank you for the PR and welcome! We’re currently busy with a new dataset release. I’ll review your submission later this week and aim to provide feedback by next Monday. Apologies for the delay.

@HuanzhiMao
Copy link
Collaborator

Hey @XuHwang, one quick question: Where can I find the documentation of this model? Eg, it's input schema, prompt format, etc.

@XuHwang
Copy link
Author

XuHwang commented Sep 7, 2024

Hey @XuHwang, one quick question: Where can I find the documentation of this model? Eg, it's input schema, prompt format, etc.

Thanks for the reply.

The format of prompt is actually given in the handler, which is similar to the prompt of LLaMA3. The format should be:

<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\n{SYSTEM_PROMPT}{TOOL_DESC}<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n{QUERY}\n{LANGUAGE_SPECIFIC_HINT}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n

@HuanzhiMao
Copy link
Collaborator

HuanzhiMao commented Sep 7, 2024

So why can't we just use the LlamaHandler instead? The ToolACEHandler has the exact same _format_prompt, decode_ast, decode_execute, etc as the LlamaHandler.

@XuHwang
Copy link
Author

XuHwang commented Sep 7, 2024

So why can't we just use the LlamaHandler instead? The ToolACEHandler has the exact same _format_prompt, decode_ast, decode_execute, etc as the LlamaHandler.

Actually the decode_ast, decode_execute are consistent with the LlamaHandler, but the _format_prompt and process_input are slightly different, and we find it would cause obvious performance degradation.

Copy link
Collaborator

@HuanzhiMao HuanzhiMao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compared with the current latest LlamaHandler from main branch commit eca516a, your ToolACEHandler differs in the following two ways:

  1. Your _format_prompt has two more \n after each <|end_header_id|> tag. This is an oversight on our end; we missed it for the Llama models. I have just fixed it in [BFCL] Fix Llama Handler #626. After the fix, they should be the exact same.
  2. You choose to add the language_specific_hint to the end of the last user prompt instead of as part of the function description in the function doc. This is not allowed. The func_doc_language_specific_pre_processing is not model-specific (on the other hand, functions like convert_to_tool are model-specific); we perform it for all models regardless, you can think of it as part of the dataset transformation process (before we enter the model-specific format transformation phase)

@XuHwang
Copy link
Author

XuHwang commented Sep 14, 2024

Compared with the current latest LlamaHandler from main branch commit eca516a, your ToolACEHandler differs in the following two ways:

  1. Your _format_prompt has two more \n after each <|end_header_id|> tag. This is an oversight on our end; we missed it for the Llama models. I have just fixed it in [BFCL] Fix Llama Handler #626. After the fix, they should be the exact same.
  2. You choose to add the language_specific_hint to the end of the last user prompt instead of as part of the function description in the function doc. This is not allowed. The func_doc_language_specific_pre_processing is not model-specific (on the other hand, functions like convert_to_tool are model-specific); we perform it for all models regardless, you can think of it as part of the dataset transformation process (before we enter the model-specific format transformation phase)

Thanks for the explanation and sorry for the late reply and updates.
We follow your suggestions for using LlamaHandler as our model. And our model is updated, maybe you need to update the local copy if you have always downloaded it before.

@XuHwang
Copy link
Author

XuHwang commented Sep 23, 2024

We close this PR because we have updated the ToolACE handler to make it compatible with the latest BFCL in #653 .

@XuHwang XuHwang closed this Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants