Skip to content

Commit 17b93bb

Browse files
authored
Merge pull request #44 from ku-nlp/add/wandb
Add the wandb integration
2 parents ddb7b16 + 8823b50 commit 17b93bb

32 files changed

+1382
-2154
lines changed

README.md

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,20 @@ There are several options to use GPT-4 as a judge, such as pairwise win-rate and
4444
OPENAI_API_KEY=<YOUR-KEY> python llm_judge/gen_judgment.py \
4545
--mode {single|pairwise-baseline|pairwise-all} \
4646
[--baseline-model <BASELINE-MODEL-ID>] \
47-
[--model-list <LIST-OF-MODEL-IDS>]
47+
[--model-list <LIST-OF-MODEL-IDS>] \
48+
[--wandb]
4849
```
4950

5051
Arguments & Options:
5152
- `--mode {single|pairwise-baseline|pairwise-all}` is the mode of judgment.
52-
- `pairwise-baseline`: run pairwise comparison against a baseline model.
53+
- `pairwise-baseline`: run pairwise comparison against a baseline model. This mode will be used by default.
5354
- `pairwise-all`: run pairwise comparison between all model pairs.
5455
- `single`: run score-based single-model grading.
5556
- `--baseline-model <BASELINE-MODEL-ID>` is the model ID of the baseline model. This option is only available in `pairwise-baseline` mode. If not specified, the baseline model is set to `text-davinci-003`.
5657
- `--model-list <LIST-OF-MODEL-IDS>` is a list of model IDs to be evaluated. If not specified, all models in `data/jp_bench/model_answer` will be evaluated.
58+
- `--wandb` is a flag to enable logging to W&B. You can upload the results later to W&B by running `upload_result.py`, as described in the next section.
5759

58-
**Mode: `pairwise-baseline`**
60+
**Mode: `pairwise-baseline` (Default)**
5961

6062
This mode runs pairwise comparison against a baseline model.
6163
By default, the baseline model is set to `text-davinci-003`.
@@ -114,6 +116,17 @@ python llm_judge/show_result.py \
114116
--model-list rinna--japanese-gpt-neox-3.6b-instruction-ppo
115117
```
116118

119+
#### Step 3. Upload the results to W&B (Optional)
120+
121+
If you want to upload the results to W&B, you can run the following command:
122+
123+
```bash
124+
python llm_judge/upload_result.py \
125+
--mode {single|pairwise-baseline|pairwise-all} \
126+
[--baseline-model <BASELINE-MODEL-ID>] \
127+
[--model-list <LIST-OF-MODEL-IDS>]
128+
```
129+
117130
## Sample Outputs
118131

119132
Question: 植物性タンパク源と動物性タンパク源の違いは何ですか?
@@ -131,13 +144,13 @@ Model outputs:
131144

132145
## Pairwise win-rate compared with GPT-3.5-davinci-003
133146

134-
| Model | Win | Loss | Tie | Win Rate | Loss Rate | Win Rate Adjusted |
135-
|----------------------------------------------------------|-----|------|-----|----------|-----------|-------------------|
136-
| llm-jp--llm-jp-13b-instruct-lora-jaster-dolly-oasst-v1.0 | 22 | 48 | 10 | 0.2750 | 0.6000 | 0.33750 |
137-
| rinna--japanese-gpt-neox-3.6b-instruction-ppo | 10 | 61 | 9 | 0.1250 | 0.7625 | 0.18125 |
138-
| llm-jp--llm-jp-13b-instruct-full-jaster-dolly-oasst-v1.0 | 7 | 65 | 8 | 0.0875 | 0.8125 | 0.13750 |
139-
| rinna--japanese-gpt-neox-3.6b-instruction-sft-v2 | 8 | 69 | 3 | 0.1000 | 0.8625 | 0.11875 |
140-
| cyberagent--calm2-7b-chat | 5 | 67 | 8 | 0.0625 | 0.8375 | 0.11250 |
147+
| Model | Win Rate | Loss Rate | Win Rate Adjusted |
148+
|----------------------------------------------------------|----------|-----------|-------------------|
149+
| llm-jp--llm-jp-13b-instruct-lora-jaster-dolly-oasst-v1.0 | 28.7 | 62.5 | 33.1 |
150+
| rinna--japanese-gpt-neox-3.6b-instruction-ppo | 13.8 | 13.8 | 18.8 |
151+
| rinna--japanese-gpt-neox-3.6b-instruction-sft-v2 | 8.8 | 82.5 | 13.1 |
152+
| cyberagent--calm2-7b-chat | 6.2 | 81.2 | 12.5 |
153+
| llm-jp--llm-jp-13b-instruct-full-jaster-dolly-oasst-v1.0 | 10.0 | 87.5 | 11.2 |
141154

142155
## Supported baseline Models
143156

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"model_id": "openai--text-davinci-003",
3+
"model_name_or_path": null,
4+
"lora_model_name_or_path": null,
5+
"tokenizer_name_or_path": null,
6+
"prompt_template": "{instruction}",
7+
"generation_config": {
8+
"engine": "text-davinci-003",
9+
"temperature": 0.0,
10+
"max_tokens": 2048,
11+
"top_p": 1.0,
12+
"frequency_penalty": 0.0,
13+
"presence_penalty": 0.0
14+
},
15+
"special_token_map": {}
16+
}

data/jp_bench/judge_prompts.jsonl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{"name": "pair", "type": "pairwise", "system_prompt": "以下に示されるユーザーの質問に対して2人のAIアシスタントが提供した回答の質を評価してください。回答の内容がユーザーの指示に従っており、ユーザーの質問によりよく答えているアシスタントを選んでください。具体的には、回答の有用性、関連性、正確性、深さ、創造性、詳細レベルなどの要素を考慮する必要があります。評価の際には、まず2つの回答を比較し、簡単な説明をしてください。立場が偏らないようにし、回答の提示順があなたの判断に影響しないようにしてください。回答の長さが評価に影響しないこと、特定のアシスタントの名前を好まないこと、できるだけ客観的であること、に気をつけてください。説明の後に、最終的な判断を以下の形式に従って出力してください:アシスタントAが優れていれば[[A]]、アシスタントBが優れていれば[[B]]、同点の場合は[[C]]", "prompt_template": "[ユーザーの質問]\n{question}\n\n[アシスタントAの答えの始まり]\n{answer_a}\n[アシスタントAの答えの終わり]\n\n[アシスタントBの答えの始まり]\n{answer_b}\n[アシスタントBの答えの終わり]", "description": "Prompt for general questions", "category": "general", "output_format": "[[A]]"}
2+
{"name": "pair-math", "type": "pairwise", "system_prompt": "以下に示されるユーザーの質問に対して2人のAIアシスタントが提供した回答の質を評価してください。回答の内容がユーザーの指示に従っており、ユーザーの質問によりよく答えているアシスタントを選んでください。参考解答、アシスタントAの回答、アシスタントBの回答が与えられるので、どちらのアシスタントの回答が優れているかを評価してください。評価の際には、まずそれぞれのアシスタントの回答を参考解答と比較し、回答の誤りを見つけて修正してください。立場が偏らないようにし、回答の提示順があなたの判断に影響しないようにしてください。回答の長さが評価に影響しないこと、特定のアシスタントの名前を好まないこと、できるだけ客観的であること、に気をつけてください。説明の後に、最終的な判断を以下の形式に従って出力してください:アシスタントAが優れていれば[[A]]、アシスタントBが優れていれば[[B]]、同点の場合は[[C]]", "prompt_template":"[ユーザーの質問]\n{question}\n\n[参考解答の始まり]\n{ref_answer_1}\n[参考解答の終わり]\n\n[アシスタントAの答えの始まり]\n{answer_a}\n[アシスタントAの答えの終わり]\n\n[アシスタントBの答えの始まり]\n{answer_b}\n[アシスタントBの答えの終わり]", "description": "Prompt for math questions", "category": "math", "output_format": "[[A]]"}
3+
{"name": "single", "type": "single", "system_prompt": "あなたは役に立つアシスタントです。", "prompt_template": "[インストラクション]\n以下に示されるユーザーの質問に対してAIアシスタントが提供した回答の質を評価してください。具体的には、回答の有用性、関連性、正確性、深さ、創造性、詳細レベルなどの要素を考慮して評価してください。評価の際には、まず回答内容を簡単に、できるだけ客観的に説明してください。説明を行った後、必ず「[[rating]]」という形式で、回答を1から10の尺度で評価してください(例:[[5]])。\".\n\n[ユーザーの質問]\n{question}\n\n[アシスタントの答えの始まり]\n{answer}\n[アシスタントの答えの終わり]", "description": "Prompt for general questions", "category": "general", "output_format": "[[rating]]"}
4+
{"name": "single-math", "type": "single", "system_prompt": "あなたは役に立つアシスタントです。", "prompt_template": "[インストラクション]\n以下に示されるユーザーの質問に対してAIアシスタントが提供した回答の質を評価してください。具体的には、回答の正しさと親切さを考慮して評価してください。参考解答とアシスタントの回答が与えられます。評価の際には、まずアシスタントの回答を参考解答と比較し、回答の誤りを見つけて修正してください。評価はできるだけ客観的に行ってください。最後に、必ず「[[rating]]」という形式で、回答を1から10の尺度で評価してください(例:[[5]])。\".\n\n[ユーザーの質問]\n{question}\n\n[参考解答の始まり]\n{ref_answer_1}\n[参考解答の終わり]\n\n[アシスタントの答えの始まり]\n{answer}\n[アシスタントの答えの終わり]", "description": "Prompt for general questions", "category": "math", "output_format": "[[rating]]"}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"model_id": "cyberagent--calm2-7b-chat",
3+
"model_name_or_path": "cyberagent/calm2-7b-chat",
4+
"lora_model_name_or_path": null,
5+
"tokenizer_name_or_path": null,
6+
"prompt_template": "USER: {instruction}\nASSISTANT: ",
7+
"generation_config": {
8+
"do_sample": true,
9+
"max_length": 2048,
10+
"temperature": 0.8
11+
},
12+
"special_token_map": {}
13+
}
File renamed without changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"model_id": "llm-jp--llm-jp-13b-instruct-full-jaster-dolly-oasst-v1.0",
3+
"model_name_or_path": "llm-jp/llm-jp-13b-instruct-full-jaster-dolly-oasst-v1.0",
4+
"lora_model_name_or_path": null,
5+
"tokenizer_name_or_path": null,
6+
"prompt_template": "{instruction} ### 回答:",
7+
"generation_config": {
8+
"do_sample": true,
9+
"max_length": 2048,
10+
"temperature": 0.7,
11+
"top_p": 0.95
12+
},
13+
"special_token_map": {}
14+
}
File renamed without changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"model_id": "llm-jp--llm-jp-13b-instruct-lora-jaster-dolly-oasst-v1.0",
3+
"model_name_or_path": "llm-jp/llm-jp-13b-v1.0",
4+
"lora_model_name_or_path": "llm-jp/llm-jp-13b-instruct-lora-jaster-dolly-oasst-v1.0",
5+
"tokenizer_name_or_path": null,
6+
"prompt_template": "{instruction} ### 回答:",
7+
"generation_config": {
8+
"do_sample": true,
9+
"max_length": 2048,
10+
"temperature": 0.7,
11+
"top_p": 0.95
12+
},
13+
"special_token_map": {}
14+
}
File renamed without changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"model_id": "openai--text-davinci-003",
3+
"model_name_or_path": null,
4+
"lora_model_name_or_path": null,
5+
"tokenizer_name_or_path": null,
6+
"prompt_template": "{instruction}",
7+
"generation_config": {
8+
"engine": "text-davinci-003",
9+
"temperature": 0.0,
10+
"max_tokens": 2048,
11+
"top_p": 1.0,
12+
"frequency_penalty": 0.0,
13+
"presence_penalty": 0.0
14+
},
15+
"special_token_map": {}
16+
}

0 commit comments

Comments
 (0)