ジャッジモデルのカスタマイズに関するメッセージ

モデルベースの指標の場合、Gen AI Evaluation Service は、判定モデルとして構成された Gemini などの基盤モデルを使用してモデルを評価します。このページでは、プロンプト エンジニアリング手法を使用して、そのジャッジモデルの品質を向上させ、ニーズに合わせてカスタマイズする方法について説明します。

概要

人間の判定者を使用して大規模言語モデル(LLM)を評価すると、費用と時間がかかります。判定モデルを使用すると、LLM をよりスケーラブルに評価できます。

Gen AI 評価サービスは、デフォルトで Gemini 1.5 Pro を判定モデルとして使用し、さまざまなユースケースでモデルを評価するためのカスタマイズ可能なプロンプトを使用します。多くの基本的なユースケースはモデルベースの指標テンプレートで説明されていますが、次の手順に沿って、基本的なユースケースを超えて判定モデルをさらにカスタマイズできます。

  1. ユースケースを代表するプロンプトを含むデータセットを作成します。推奨されるデータセットのサイズは 100 ~ 1,000 プロンプトです。

  2. プロンプトを使用して、プロンプト エンジニアリング手法でジャッジモデルを変更します。

  3. ジャッジモデルを使用して評価を実行します。

プロンプト エンジニアリングの手法

このセクションでは、ジャッジモデルの変更に使用できるプロンプト エンジニアリング手法について説明します。これらの例ではゼロショット プロンプトを使用していますが、プロンプトで少数ショットの例を使用してモデルの品質を向上させることもできます。

まず、評価データセット全体に適用されるプロンプトから始めます。プロンプトには、評価の概要と評価用の評価基準を含め、判定モデルからの最終的な判定を求める必要があります。さまざまなユースケースの評価基準と評価基準の例については、指標プロンプト テンプレートをご覧ください。

Chain-of-Thought プロンプトを使用する

論理的に整合性のある一連のアクションまたはステップで候補モデルを評価するように判定モデルにプロンプトを出します。

たとえば、次の手順を使用できます。

"Please first list down the instructions in the user query."
"Please highlight such specific keywords."
"After listing down instructions, you should rank the instructions in the order of importance."
"After that, INDEPENDENTLY check if response A and response B for meeting each of the instructions."
"Writing quality/style should NOT be used to judge the response quality unless it was requested by the user."
"When evaluating the final response quality, please value Instruction Following a more important rubrics than Truthfulness."

次のプロンプト例では、審査モデルに思考の流れプロンプトを使用してテキストタスクを評価するよう指示しています。

# Rubrics
Your mission is to judge responses from two AI models, Model A and Model B, and decide which is better. You will be given the previous conversations between the user and the model, a prompt, and responses from both models.
Please use the following rubric criteria to judge the responses:
<START OF RUBRICS>
Your task is to first analyze each response based on the two rubric criteria: instruction_following, and truthfulness (factual correctness). Start your analysis with "Analysis".
(1) Instruction Listing
Please first list down the instructions in the user query. In general, an instruction is VERY important if it is specific asked in the prompt and deviate from the norm. Please highlight such specific keywords.
You should also derive the task type from the prompt and include the task specific implied instructions.
Sometimes, no instruction is available in the prompt. It is your job to infer if the instruction is to auto-complete the prompt or asking LLM for followups.
After listing down instructions, you should rank the instructions in the order of importance.
After that, INDEPENDENTLY check if response A and response B for meeting each of the instructions. You should itemize for each instruction, if response meet, partially meet or does not meet the requirement using reasoning. You should start reasoning first before reaching a conclusion whether response satisfies the requirement. Citing examples while making reasoning is preferred.

(2) Truthfulness
Compare response A and response B for factual correctness. The one with less hallucinated issues is better.
If response is in sentences and not too long, you should check every sentence separately.
For longer responses, to check factual correctness, focus specifically on places where response A and B differ. Find the correct information in the text to decide if one is more truthful to the other or they are about the same.
If you cannot determine validity of claims made in the response, or response is a punt ("I am not able to answer that type of question"), the response has no truthful issues.
Truthfulness check is not applicable in the majority of creative writing cases ("write me a story about a unicorn on a parade")

Writing quality/style should NOT be used to judge the response quality unless it was requested by the user.

In the end, express your final verdict in one of the following choices:
1. Response A is better: [[A>B]]
2. Tie, relatively the same: [[A=B]]
3. Response B is better: [[B>A]]
Example of final verdict: "My final verdict is tie, relatively the same: [[A=B]]".

When evaluating the final response quality, please value Instruction Following a more important rubrics than Truthfulness.
When for both response, instruction and truthfulness are fully meet, it is a tie.

<END OF RUBRICS>

レーティング ガイドラインを使用してモデルの推論をガイドする

評価ガイドラインを使用して、判定モデルがモデルの推論を評価できるようにします。評価ガイドラインは評価基準とは異なります。

たとえば、次のプロンプトでは評価基準が使用されています。これにより、審査モデルは「指示に従う」タスクを「重大な問題」、「軽微な問題」、「問題なし」の評価基準で評価するように指示されます。

Your task is to first analyze each response based on the three rubric criteria: verbosity, instruction_following, truthfulness (code correctness) and (coding) executability. Please note that the model responses should follow "response system instruction" (if provided). Format your judgment in the following way:
Response A - verbosity:too short|too verbose|just right
Response A - instruction_following:major issues|minor issues|no issues
Response A - truthfulness:major issues|minor issues|no issues
Response A - executability:no|no code present|yes-fully|yes-partially
Then do the same for response B.

After the rubric judgements, you should also give a brief rationale to summarize your evaluation considering each individual criteria as well as the overall quality in a new paragraph starting with "Reason: ".

In the last line, express your final judgment in the format of: "Which response is better: [[verdict]]" where "verdict" is one of {Response A is much better, Response A is better, Response A is slightly better, About the same, Response B is slightly better, Response B is better, Response B is much better}. Do not use markdown format or output anything else.

次のプロンプトでは、評価ガイドラインを使用して、判定モデルが「指示に従う」タスクを評価できるようにします。

You are a judge for coding related tasks for LLMs. You will be provided with a coding prompt, and two responses (Response A and Response B) attempting to answer the prompt. Your task is to evaluate each response based on the following criteria:

Correctness: Does the code produce the correct output and solve the problem as stated?
Executability: Does the code run without errors?
Instruction Following: Does the code adhere to the given instructions and constraints?

Please think about the three criteria, and provide a side-by-side comparison rating to to indicate which one is better.

判定モデルを参照解答で調整する

一部またはすべてのプロンプトの参照回答を使用して、判定モデルを調整できます。

次のプロンプトは、参照回答を使用する方法についてジャッジモデルに指示します。

"Note that you can compare the responses with the reference answer to make your judgment, but the reference answer may not be the only correct answer to the query."

次の例では、推論、思考プロセスの促し、評価ガイドラインを使用して、「指示に従う」タスクの評価プロセスをガイドします。

# Rubrics
Your mission is to judge responses from two AI models, Model A and Model B, and decide which is better. You will be given a user query, source summaries, and responses from both models. A reference answer
may also be provided - note that you can compare the responses with the reference answer to make your judgment, but the reference answer may not be the only correct answer to the query.

Please use the following rubric criteria to judge the responses:

<START OF RUBRICS>
Your task is to first analyze each response based on the three rubric criteria: grounding, completeness, and instruction_following. Start your analysis with "Analysis".

(1) Grounding
Please first read through all the given sources in the source summaries carefully and make sure you understand the key points in each one.
After that, INDEPENDENTLY check if response A and response B use ONLY the given sources in the source summaries to answer the user query. It is VERY important to check that all
statements in the response MUST be traceable back to the source summaries and ACCURATELY cited.

(2) Completeness
Please first list down the aspects in the user query. After that, INDEPENDENTLY check if response A and response B for covering each of the aspects by using ALL RELEVANT information from the sources.

(3) Instruction Following
Please read through the following instruction following rubrics carefully. After that, INDEPENDENTLY check if response A and response B for following each of the instruction following rubrics successfully.
  * Does the response provide a final answer based on summaries of 3 potential answers to a user query?
  * Does the response only use the technical sources provided that are relevant to the query?
  * Does the response use only information from sources provided?
  * Does the response select all the sources that provide helpful details to answer the question in the Technical Document?
  * If the sources have significant overlapping or duplicate details, does the response select sources which are most detailed and comprehensive?
  * For each selected source, does the response prepend source citations?
  * Does the response use the format: "Source X" where x represents the order in which the technical source appeared in the input?
  * Does the response use original source(s) directly in its response, presenting each source in its entirety, word-for-word, without omitting and altering any details?
  * Does the response create a coherent technical final answer from selected Sources without inter-mixing text from any of the Sources?

Writing quality/style can be considered, but should NOT be used as critical rubric criteria to judge the response quality.

In the end, express your final verdict in one of the following choices:
1. Response A is better: [[A>B]]
2. Tie, relatively the same: [[A=B]]
3. Response B is better: [[B>A]]
Example of final verdict: "My final verdict is tie, relatively the same: [[A=B]]".

When for both response, grounding, completeness, and instruction following are fully meet, it is a tie.

<END OF RUBRICS>

次のステップ

  • 変更したジャッジモデルを使用して評価を実行します。