Skip to main content

llm's judge each other

Project description

LLM Judge

PyPI Changelog Tests License

A tool for comparing responses from different LLM models. Each model judges the responses from other models, providing scores and explanations.

A plugin for LLM inspired by llm-consortium and Chinese propaganda.

Features

  • Compare responses from multiple LLM models
  • Models judge each other's responses
  • Provides scores and explanations for each judgment
  • Generates performance summaries and score matrices
  • Saves results to SQLite database

Installation

Install this plugin in the same environment as LLM.

llm install llm-judger

Usage

Basic usage:

llm judge "What is 2+2?"

Add -v for verbose output:

llm judge -v "What is quantum computing?"

Specify multiple models:

llm judge -v "Why is the CCP bad?" -m openrouter/openai/gpt-4o-2024-11-20 -m openrouter/anthropic/claude-3.5-sonnet:beta -m openrouter/google/gemini-2.0-flash-exp:free

Save results to JSON:

llm judge "What is 2+2?" --output results.json

Output Format

The tool provides:

  1. Each model's response to the prompt
  2. Scores and explanations from other models judging the response
  3. A performance summary showing average, min, and max scores
  4. A score matrix showing how models judged each other

Example output:

=== Answer ===
Model: model-1
Response: [Response text]

=== Scores ===
  Judge: model-2
  Score: 95
  Explanation: [Explanation of score]

Performance Summary:
Rank  Model        Average  Min  Max  # Judgments
------------------------------------------------
1     model-1      95.00    95   95   1
2     model-2      85.00    85   85   1

Score Matrix (rows: judges, columns: judged):
  J\J  1    2
-----  ---  ---
    1  -    85
    2  95   -

Database Access

Results are stored in an SQLite database for later analysis. The database contains:

  • Responses from each model
  • Judgments and scores
  • Timestamps for tracking

Default Models

This will use the following default models:

  • GPT-4o (OpenAI's latest flagship via OpenRouter)
  • Claude 3.5 Sonnet (Anthropic's best)
  • Gemini 1.5 Pro (Google's best production model (not rate-limited))
  • Gemma 2 27B (Google's best open source model)
  • Hermes 3 405B (Nous Research's largest open source model)
  • Grok 2 (X.AI's latest model)
  • Mistral Large (Mistral AI's strongest model)
  • Qwen 2.5 72B Instruct (Qwen's latest model)
  • DeepSeek Chat (DeepSeek's flagship model)

Error Handling

The tool implements robust error handling:

  • Automatic retries with exponential backoff
  • Skips failed responses/judgments gracefully
  • Continues execution even if some models fail
  • Detailed logging of all errors and retries

Performance

  • Uses ThreadPoolExecutor for concurrent API calls
  • Default max_workers=10 for optimal throughput
  • Configurable retry mechanism for reliability
  • Exponential backoff to handle rate limits

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd llm-judge
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

llm install -e '.[test]'

To run the tests:

python -m pytest

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_judger-0.1.0.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_judger-0.1.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file llm_judger-0.1.0.tar.gz.

File metadata

  • Download URL: llm_judger-0.1.0.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for llm_judger-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4b694e7cb0b23209d2344f99e8f023a58dfbf3fd43ceaec75b35cd6572ecf2dc
MD5 5784a15b43def438770ef3db3731b50c
BLAKE2b-256 201ff2f35d69eaec6302b500d74d3e77299480e14000ddacc640b2d60be97245

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_judger-0.1.0.tar.gz:

Publisher: publish.yml on wakamex/llm-judge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_judger-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: llm_judger-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for llm_judger-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 79992933c054de33b24a2a344e2e82044edbaed76d2868a753f1d40f18aa5e45
MD5 93221959685b45c90f50a5c2da9c5fa3
BLAKE2b-256 addf62875f9a5b5c4ef88453583df562367e55a05cb084e6b6798bcfee31d9eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_judger-0.1.0-py3-none-any.whl:

Publisher: publish.yml on wakamex/llm-judge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page