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

[BFCL] Fix language_specific_pre_processing for Java and JavaScript Test Category #538

Merged
merged 5 commits into from
Jul 22, 2024

Conversation

HuanzhiMao
Copy link
Collaborator

@HuanzhiMao HuanzhiMao commented Jul 21, 2024

In our BFCL official communication channels, including the evaluation manual blog, GitHub issue replies (such as #424), and our Discord channel, we have previously stated the following:

For Java and JavaScript test category, before querying the model, we do some pre-processing on the prompt and function document. Specifically, at the end of the prompt, we will explicitly state that the provided function is in Java 8/JavaScript/Python syntax. And for parameter types that are not native to JSON, we will change their type to String (since String is JSON compatible) and add in the parameter description that f" This is Java/JavaScript {value['type']} in string representation."
As an example, when expecting type ArrayList, model will get the instruction that this is a String type parameter with the parameter description containing "This is Java ArrayList in string representation.", and thus the model should output the value in String format (eg, "new ArrayList<>(Arrays.asList(10, 20, 30))"), which is JSON compatible.

However, the code for language_specific_pre_processing did not implement this correctly. Due to an indentation issue, the parameter description was only modified when the parameter type was any, and the part where the parameter type is cast to String was never implemented.

This issue was unnoticed until PR #516 was merged because of the double-casting problem.

It significantly impacts the evaluation score for the Java and JavaScript categories. We will update the leaderboard very soon.

This PR:

  • Addresses the above issue and ensures that the evaluation logic aligns with the previously described behaviour
  • Updates two entries in the JavaScript dataset, due to their parameters missing a description field
    • Index: 14, 45

We sincerely apologize for the oversight.

@HuanzhiMao HuanzhiMao marked this pull request as ready for review July 21, 2024 06:37
Copy link
Collaborator

@Fanjia-Yan Fanjia-Yan left a comment

Choose a reason for hiding this comment

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

lgtm

HuanzhiMao added a commit to HuanzhiMao/gorilla that referenced this pull request Jul 22, 2024
Squashed commit of the following:

commit 407d443
Author: Huanzhi Mao <[email protected]>
Date:   Sun Jul 21 00:35:32 2024 -0700

    Add missing description field for 2 entry in javascript dataset

commit 2c0d311
Author: Huanzhi Mao <[email protected]>
Date:   Sat Jul 20 23:37:20 2024 -0700

    update change log

commit 0d3bc83
Author: Huanzhi Mao <[email protected]>
Date:   Sat Jul 20 23:03:43 2024 -0700

    clean up

commit 33b9fc3
Author: Huanzhi Mao <[email protected]>
Date:   Sat Jul 20 22:44:05 2024 -0700

    remove unused parameter string_param from all model_handlers

commit ad7c337
Author: Huanzhi Mao <[email protected]>
Date:   Sat Jul 20 22:43:27 2024 -0700

    fix language_specific_pre_processing
@ShishirPatil ShishirPatil merged commit 5b7635e into ShishirPatil:main Jul 22, 2024
@HuanzhiMao HuanzhiMao deleted the java&js-inference-fix branch July 22, 2024 06:40
ShishirPatil pushed a commit that referenced this pull request Jul 25, 2024
…ry, Part 2 (#545)

This PR fixes the function doc pre-processing issues for the Java and
JavaScript test categories, following up on PR #538.

- Some unnecessary steps in the `convert_to_tool` function are removed.
These steps should not exist as not every model handler calls the
`convert_to_tool` function (for example, the OSS models) and would
unfairly benefit the models that use it. To make sure that every model
gets the same pre-processed function doc, the pre-processing phase needs
to be in the `language_specific_pre_processing` function (which is used
by every handler).
- Properly handle the inner element type for nested types.
ShishirPatil pushed a commit that referenced this pull request Jul 28, 2024
…551)

This PR updates the leaderboard to reflect the changes in score due to
the following PR merge.

- #538
- #545

The scores for the following categories are affected:
- Java
- JavaScript

Consequently, the aggregated score also gets updated: 
- Simple Func AST
- AST Summary
- Overall Acc

![Java Simple Function
AST_table](https://github.com/user-attachments/assets/42396560-4884-46fa-b95f-5f6119ab06ca)
![JavaScript Simple Function
AST_table](https://github.com/user-attachments/assets/bfba17f2-7f0e-40c5-b51f-1904ced31d32)
![Simple Function
AST_table](https://github.com/user-attachments/assets/c886a039-7246-4366-b019-5b842aed42a2)
![AST
Summary_table](https://github.com/user-attachments/assets/7d471399-ad68-4b0a-85eb-f2dc9dbc6e76)
![Overall
Acc_table](https://github.com/user-attachments/assets/621ec5e6-717e-41cd-b5f9-78022ad9be52)

![Rank_table](https://github.com/user-attachments/assets/dfdbf17b-3e72-4a7d-9315-b5fa74a1b98b)
aw632 pushed a commit to vinaybagade/gorilla that referenced this pull request Aug 22, 2024
…est Category (ShishirPatil#538)

In our BFCL official communication channels, including the evaluation
manual blog, GitHub issue replies (such as ShishirPatil#424), and our Discord
channel, we have previously stated the following:

> For Java and JavaScript test category, before querying the model, we
do some pre-processing on the prompt and function document.
Specifically, at the end of the prompt, we will explicitly state that
`the provided function is in Java 8/JavaScript/Python syntax`. And for
parameter types that are not native to JSON, we will change their type
to `String` (since `String` is JSON compatible) and add in the parameter
description that `f" This is Java/JavaScript {value['type']} in string
representation."`
> As an example, when expecting type `ArrayList`, model will get the
instruction that this is a `String` type parameter with the parameter
description containing `"This is Java ArrayList in string
representation."`, and thus the model should output the value in
`String` format (eg, `"new ArrayList<>(Arrays.asList(10, 20, 30))"`),
which is JSON compatible.

However, the code for `language_specific_pre_processing` did not
implement this correctly. Due to an indentation issue, the parameter
description was only modified when the parameter type was `any`, and the
part where the parameter type is cast to `String` was never implemented.

This issue was unnoticed until PR ShishirPatil#516 was merged because of the
double-casting problem.

It *significantly impacts* the evaluation score for the Java and
JavaScript categories. We will update the leaderboard very soon.

This PR:
- Addresses the above issue and ensures that the evaluation logic aligns
with the previously described behaviour
- Updates two entries in the JavaScript dataset, due to their parameters
missing a `description` field
  - Index: `14, 45`

We sincerely apologize for the oversight.
aw632 pushed a commit to vinaybagade/gorilla that referenced this pull request Aug 22, 2024
…ry, Part 2 (ShishirPatil#545)

This PR fixes the function doc pre-processing issues for the Java and
JavaScript test categories, following up on PR ShishirPatil#538.

- Some unnecessary steps in the `convert_to_tool` function are removed.
These steps should not exist as not every model handler calls the
`convert_to_tool` function (for example, the OSS models) and would
unfairly benefit the models that use it. To make sure that every model
gets the same pre-processed function doc, the pre-processing phase needs
to be in the `language_specific_pre_processing` function (which is used
by every handler).
- Properly handle the inner element type for nested types.
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.

3 participants