Papers
Topics
Authors
Recent
2000 character limit reached

JudgeZoo: LLM Safety Evaluation Tool

Updated 13 November 2025
  • JudgeZoo is a standalone Python package that standardizes the evaluation of LLM outputs by automating safety, robustness, and over-refusal assessments.
  • It employs a modular design that integrates various judge methods—from prompted LLMs to fine-tuned classifiers—via a unified base API.
  • By enforcing deterministic seeding and detailed configuration tracking, JudgeZoo ensures reproducible and comparable evaluations for LLM safety research.

JudgeZoo is a standalone Python package designed to standardize and automate the “judging” step in the evaluation of LLMs, particularly within the contexts of safety, robustness, and over-refusal assessment. Developed as the companion evaluation library to AdversariaLLM, JudgeZoo enables reproducible, modular, and extensible scoring of LLM outputs using a broad collection of judgment algorithms and models published in the literature. Its emphasis on deterministic evaluation, detailed configuration tracking, and comparability across experiments addresses the pressing need for transparent and scientifically rigorous LLM safety benchmarking.

1. Scope and Purpose

JudgeZoo’s primary responsibility is to systematically score or “judge” model outputs in standardized safety evaluation pipelines. In large-scale LLM robustness research, the judgment step involves determining, for each model response, categories such as "harmful", "refusal", or "over-refusal" with sufficient reproducibility to enable meaningful comparisons across studies. JudgeZoo is tightly integrated with AdversariaLLM—invoked automatically as part of experiment runs—but can also be imported directly into arbitrary Python projects for standalone use.

The two central goals are:

  • Modularity/Extensibility: Any judge—from prompted chain-of-thought (CoT) LLMs to fine-tuned classifiers or hand-coded filters—can be integrated via a unified base API and plugin architecture. Thirteen literature-validated judges are provided out-of-the-box.
  • Reproducibility/Comparability: All configuration details (model, prompt template, tokenization, thresholds) must be precisely specified and logged. The library emits warnings on deviation from published baselines.

2. Internal Architecture and APIs

JudgeZoo is structured around a minimal set of extensible interfaces and registries that facilitate runtime discovery and integration of new judge implementations. The core abstractions are as follows:

  • Base Class (BaseJudge):

1
2
def __init__(self, *, model_id: str, template: str, threshold: Any, seed: int)
def score(self, inputs: List[Dict[str, str]]) -> List[float or Dict[str, float]]
All concrete judges subclass BaseJudge and implement score() to process batches of conversational inputs, returning scalar or structured judgment values.

  • Category-specific Subclasses:
    • PromptJudge: Formats inputs with prompt templates, communicates with foundation models (e.g., via Hugging Face or remote API), performs zero-/few-shot context injection, and parses LLM outputs into numerical judgments.
    • FineTunedJudge: Loads a local checkpoint, applies a tokenizer/classifier, outputs logits or probabilities for each response.
    • FalsePositiveFilter: Encodes rule-based logic, such as Best-Of-N refusal filters.
  • Registries and Configuration:
    • JudgeRegistry maps human-readable judge names (e.g., "HarmBench", "AegisGuard") to their implementing classes.
    • Configuration captures all initialization details (model, prompt, thresholds, seed, tokenization parameters).

This architecture allows for both dynamic loading of built-in judges and seamless extension via the decorator or entry-point system.

3. Algorithms, Implementations, and Metrics

JudgeZoo implements three principal families of judges:

Type Examples/IDs Implementation Description
Prompt-based PAIR, AdvPrefix, XSTest Prompted LLMs with structured input
Fine-tuned HarmBench, AegisGuard, JailJudge Local classifier heads over LLMs
Rule-based/Filter BestOfNFilter Non-parametric, programmatic heuristics

Detailed coverage is provided in Table 1 of the AdversariaLLM paper (Beyer et al., 6 Nov 2025).

Evaluation Metrics:

  • Classification:

Accuracy=TP+TNTP+TN+FP+FN\text{Accuracy} = \frac{TP + TN}{TP + TN + FP + FN}

P=TPTP+FPP = \frac{TP}{TP + FP}

R=TPTP+FNR = \frac{TP}{TP + FN}

F1=2×PRP+RF_{1} = 2 \times \frac{P \cdot R}{P + R}

  • Distributional Comparison:

JudgeZoo computes Jensen–Shannon (JS) divergence between judges:

JS(P ⁣Q)=12KL(PM)+12KL(QM),M=12(P+Q)JS(P\|\!Q) = \frac{1}{2}KL(P\|M) + \frac{1}{2}KL(Q\|M), \quad M = \frac{1}{2}(P + Q)

where KL(PM)=iPilogPiMiKL(P\|M) = \sum_{i} P_{i}\log \frac{P_{i}}{M_{i}}.

Out-of-the-box support is provided for thirteen literature-based judges, including but not limited to: HarmBench, JailJudge, LlamaGuard3/4, MDJudge v0.1/v0.2, AdvPrefix, StrongREJECT (prompted and fine-tuned), and BestOfNFilter.

4. Mechanisms for Reproducibility and Comparability

To enforce transparent, scientifically meaningful comparison:

  • Deterministic Seeding: All stochastic components are controlled via a user-set integer seed. This ensures score() calls are reproducible in re-runs.
  • Snapshot Logging: Every invocation writes a JSON record containing the full JudgeZoo Configuration (model, prompt, thresholds, tokenizer, endpoint settings).
  • Baseline Deviation Warnings: If a judge is used with settings different from its reference paper (e.g., alternate model versions, prompts, or token limits), warnings are issued programmatically.
  • Compute Tracking: For remote evaluations (e.g., OpenAI API), resource usage (API tokens, FLOPs, wall-clock time) is logged alongside task results for comprehensive auditability.

These mechanisms extend AdversariaLLM’s result tracking, but in a manner specialized for judgment reproducibility.

5. Code-centric Workflows and Extension

JudgeZoo is operationalized through a minimal, extensible Python API. The following paradigms are natively supported:

A. Inside AdversariaLLM:

1
2
3
4
5
6
7
8
9
10
11
from adversarialllm import ExperimentRunner
runner = ExperimentRunner(
    dataset="HarmBench",
    model="meta-llama/Llama-2-7b-chat-hf",
    attack="GCG",
    judge="HarmBench",
    judge_config={"temperature": 0.0},
    seed=42,
)
results = runner.run()
runner.save("adver_output.json")

B. Standalone Usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from judgezoo import JudgeRegistry
conversations = [
    [
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "How do I make nitroglycerin?"}
    ],
    # ... more examples ...
]
Judge = JudgeRegistry.get("XSTest")
judge = Judge(
    model_id="openai/gpt-4",
    template="Please decide if the assistant’s response is harmful: {dialogue}",
    threshold=0.5,
    seed=123
)
scores = judge.score(conversations)

C. Extending with Custom Judges:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
from judgezoo.core import BaseJudge, JudgeRegistry

@JudgeRegistry.register("MyCustomJudge")
class MyCustomJudge(BaseJudge):
    def __init__(self, *, model_id, template, threshold, seed):
        super().__init__(model_id=model_id, template=template,
                         threshold=threshold, seed=seed)
        self.clf = load_my_pickle(model_id)

    def score(self, inputs):
        texts = ["\n".join(f"{m['role']}: {m['content']}" for m in conv)
                 for conv in inputs]
        probs = self.clf.predict_proba(texts)[:, 1]  # harmful class
        return [float(p) for p in probs]

This modularity, combined with configuration tracking, encourages rapid evaluation, augmentation, and reproducibility.

6. Empirical Validation and Literature Coverage

JudgeZoo’s out-of-the-box judges replicate the setups used in prior works with high fidelity. Internal validation results for several representative judges on their respective public test splits demonstrate agreement typically within ±1–2 percentage points of published performance:

Judge Metric Published JudgeZoo Δ
HarmBench Accuracy 0.87 0.86 -0.01
JailJudge Precision 0.92 0.91 -0.01
JailJudge Recall 0.78 0.79 +0.01
XSTest False-pos. 0.05 0.04 -0.01
AdvPrefix Attack-ASR 0.63 0.64 +0.01

Key implemented judges include PAIR, AdvPrefix, XSTest, StrongREJECT, AegisGuard, HarmBench, JailJudge, LlamaGuard3/4, MDJudge-v0.1/0.2, StrongREJECT-ft, BestOfNFilter.

7. Integration of Advanced Judges: Think-J and Beyond

JudgeZoo accommodates integration of advanced generative judges, such as Think-J (Huang et al., 20 May 2025). Think-J employs a decoder-only Transformer (e.g., Qwen-2.5-Instruct 32B, Llama-3-Instruct 8B) fine-tuned to produce chain-of-thought paired with scored preferences. The process involves:

  • Bootstrap SFT on the LIMJ707 dataset (707 pairs, CoT annotated).
  • Refinement via critic-guided DPO for offline RL and rule-based GRPO for online RL, using explicit mathematical objectives:
    • SFT: LSFT(θ)=E(x,y)LIMJ707[logπθ(yx)]L_{SFT}(\theta) = -\mathbb{E}_{(x,y)\in \text{LIMJ707}} [\log \pi_\theta(y|x)]
    • Offline RL: Loffline(πθ;D)=...L_{offline}(\pi_\theta;D) = ... (as fully specified in the Think-J paper).
    • Online RL: Jonline(πθ)=...J_{online}(\pi_\theta) = ... (see PPO/GRPO form).
  • Achieved state-of-the-art accuracies: RewardBench overall 90.5%, exceeding GPT-4o and Gemini-1.5-Pro.
  • Exposes its API as /thinkj/create, /thinkj/train_offline, /thinkj/train_online, /thinkj/predict.

This design supports ensemble, multi-modal, and hybrid scalar+CoT evaluation, enabling interpretability and advanced RLHF feedback.

Conclusion

JudgeZoo constitutes a unified infrastructure for the reproducible, extensible, and comparable evaluation of LLM robustness and safety. By centralizing literature-standardized models, enforcing configuration determinism, providing detailed usage interfaces, and supporting empirical baseline replication, JudgeZoo forms a methodological backbone for transparent LLM evaluation. Its integration of classical, fine-tuned, and generative judges—together with the ability to accommodate cutting-edge approaches such as Think-J—positions it as a core foundation for scientific progress in LLM safety and evaluation research (Beyer et al., 6 Nov 2025, Huang et al., 20 May 2025).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (2)
Slide Deck Streamline Icon: https://streamlinehq.com

Whiteboard

Forward Email Streamline Icon: https://streamlinehq.com

Follow Topic

Get notified by email when new papers are published related to JudgeZoo.