πŸ“„ Mt Bench Multi Turn With ReferenceΒΆ

templates.response_assessment.pairwise_comparison.mt_bench_multi_turn_with_reference

DialogPairwiseChoiceTemplate(
    dialog_fields=[
        DialogFieldsData(
            dialog_field="reference_dialog",
            assistant_role_label="### Reference answer:",
            user_role_label="### User:",
            system_role_label="### System:",
        ),
        DialogFieldsData(
            dialog_field="dialog_a",
            assistant_role_label="### Assistant A:",
            user_role_label="### User:",
            system_role_label="### System:",
        ),
        DialogFieldsData(
            dialog_field="dialog_b",
            assistant_role_label="### Assistant B:",
            user_role_label="### User:",
            system_role_label="### System:",
        ),
    ],
    turns_separator="

",
    label_separator="
",
    choice_a_field="dialog_a",
    choice_b_field="dialog_b",
    answer_field="winner",
    choice_a_label="A",
    choice_b_label="B",
    choice_tie_label="C",
    shuffle=False,
    instruction="Please act as an impartial judge and evaluate the quality of the responses provided by two AI assistants to the user questions. Your evaluation should consider correctness and helpfulness. You will be given reference answers, the assistant A's answers, the assistant B's answers. Your job is to determine which assistant provides correct and helpful answers to the second user question. Begin your evaluation by comparing both assistants' answers with the reference answers. Identify and correct any mistakes. Avoid any position biases and ensure that the order in which the responses were presented does not influence your decision. Do not allow the length of the responses to influence your evaluation. Do not favor certain names of the assistants. Be as objective as possible. After providing your explanation, output your final verdict by strictly following this format: "[[A]]" if assistant A is better, "[[B]]" if assistant B is better, and "[[C]]" for a tie.

",
    input_format="<|The Start of Reference Answer|>

{reference_dialog}

<|The End of Reference Answer|>


<|The Start of Assistant A's Conversation with User|>

{dialog_a}

<|The End of Assistant A's Conversation with User|>


<|The Start of Assistant B's Conversation with User|>

{dialog_b}

<|The End of Assistant B's Conversation with User|>",
    output_format="[[{winner}]]",
    postprocessors=[
        "processors.extract_mt_bench_label_judgment",
    ],
)
[source]

from unitxt.templates import DialogFieldsData

References: processors.extract_mt_bench_label_judgment

Read more about catalog usage here.