LLM Judge
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:
- Each model's response to the prompt
- Scores and explanations from other models judging the response
- A performance summary showing average, min, and max scores
- 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
Metadata
Release files for llm-judger 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llm_judger-0.1.0.tar.gz | 18.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llm_judger-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.5 kB
Release files / llm_judger-0.1.0.tar.gz
| Download URL | llm_judger-0.1.0.tar.gz |
|---|---|
| Size | 18.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4b694e7cb0b23209d2344f99e8f023a58dfbf3fd43ceaec75b35cd6572ecf2dc
|
|
BLAKE2b-256 checksum How to use checksums |
201ff2f35d69eaec6302b500d74d3e77299480e14000ddacc640b2d60be97245
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 28, 2024.
Transparency logRelease files / llm_judger-0.1.0-py3-none-any.whl
| Download URL | llm_judger-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
79992933c054de33b24a2a344e2e82044edbaed76d2868a753f1d40f18aa5e45
|
|
BLAKE2b-256 checksum How to use checksums |
addf62875f9a5b5c4ef88453583df562367e55a05cb084e6b6798bcfee31d9eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 28, 2024.
Transparency log