Skip to main content
This evaluation approach uses multiple LLMs to evaluate the same output. You can do this to obtain an aggregate evaluation result — e.g., consider an output a “pass” only if all or the majority of LLMs approve — or to explicitly surface disagreements. Blog explaining the concept of LLM jury: https://www.evidentlyai.com/blog/llm-judges-jury . Code example as a Jupyter notebook: https://github.com/evidentlyai/community-examples/blob/main/tutorials/LLM_as_a_jury_Example.ipynb

Preparation

Install Evidently:
(Or install evidently[llm].) Import the components you’ll use:

Step 1: Set up evaluator LLMs

Pass the API keys for the LLMs you’ll use as judges.
You can use any other LLMs, including self-hosted ones. Check the docs on LLM judges.
Optional. Set up Evidently Cloud workspace:
Create a project to store your evaluation results:

Step 1: Toy Data

Let’s define a small dataset of user intents and generated emails. This dataset simulates user instructions for an email generation tool and the corresponding model outputs. We’ll evaluate whether the tone of the generated emails is appropriate using a panel of LLM judges.

Step 2: Define the Evaluation Prompt

Use BinaryClassificationPromptTemplate to define what the LLM is judging.

Step 3: Create a panel of LLM judges

We’ll create evaluators from multiple LLM providers using the same evaluation prompt. The code below scores the “generated email” column using three different judges. Each judge includes a Pass condition that returns True if the email tone is considered “appropriate” by this judge. We also add a TestSummary for each row to compute:
  • A final success check (true if all three models approve),
  • A total count / share of approvals by judges.
Need help with understanding the API?
To explicitly flag disagreements among LLMs, let’s add a custom descriptor. It will return “DISAGREE” if the success rate is not 0 or 1 (i.e., not unanimously rejected or approved).

Step 4. Run and view the report

To explore results locally, export them to a DataFrame:
To get a summary report with overall metrics (such as the share of approved emails and disagreements), run:
To upload results to Evidently Cloud for ease of exploration:
Or to view locally:
Here’s a preview of the results. 5 emails received mixed judgments from the LLMs: You can filter and inspect individual examples with selectors: