> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openlit.io/llms.txt
> Use this file to discover all available pages before exploring further.

# LLM-as-a-Judge

> Use LLMs to evaluate AI application quality, safety, and performance with automated scoring and detailed analysis

LLM-as-a-Judge is a technique to evaluate the quality of LLM applications by using powerful language models as evaluators. The LLM judge analyzes your AI outputs and provides structured scores, classifications, and detailed reasoning about response quality, safety, and performance.

## Why use LLM-as-a-Judge?

* **Scalable & Cost-Effective**: Evaluate thousands of LLM outputs automatically at a fraction of human evaluation costs
* **Human-Like Quality Assessment**: Capture nuanced quality dimensions like helpfulness, safety, and coherence that simple metrics miss
* **Consistent & Reproducible**: Apply uniform evaluation criteria across all outputs with repeatable scoring for reliable model comparisons
* **Actionable Insights**: Get structured reasoning and detailed explanations for evaluation decisions to systematically improve your AI systems

## Built-in evaluators

OpenLIT provides **11 evaluation types** that can be used to evaluate the output of your LLM calls. Each type can be independently enabled, customized with custom prompts, and linked to Rule Engine rules for conditional evaluation.

### Core evaluators (enabled by default)

<CardGroup cols={2}>
  <Card title="Hallucination" icon="circle-exclamation">
    Identifies factual inaccuracies, contradictions, and fabricated information. Evaluates responses against the provided context as the source of truth.
  </Card>

  <Card title="Bias" icon="people-arrows">
    Monitors for discriminatory patterns across protected attributes including gender, ethnicity, age, religion, and nationality.
  </Card>

  <Card title="Toxicity" icon="shield-virus">
    Screens for harmful, offensive, threatening, or hateful language including profanity, insults, and harassment.
  </Card>
</CardGroup>

### Extended evaluators (opt-in)

<CardGroup cols={2}>
  <Card title="Relevance" icon="bullseye">
    Evaluates how directly and completely the response addresses the user's prompt.
  </Card>

  <Card title="Coherence" icon="link">
    Assesses logical flow, clarity, and internal consistency of the response.
  </Card>

  <Card title="Faithfulness" icon="book-open">
    Measures strict alignment with the provided context or source material.
  </Card>

  <Card title="Safety" icon="shield-halved">
    Detects jailbreak attempts, prompt injection, and generation of harmful instructions.
  </Card>

  <Card title="Instruction Following" icon="list-check">
    Evaluates whether the response follows instructions, constraints, and formatting requirements precisely.
  </Card>

  <Card title="Completeness" icon="circle-check">
    Assesses whether the response fully addresses all parts and sub-questions of the query.
  </Card>

  <Card title="Conciseness" icon="compress">
    Evaluates whether the response is appropriately concise without unnecessary filler or repetition.
  </Card>

  <Card title="Sensitivity" icon="lock">
    Detects PII leakage, credential exposure, confidential data, and privacy-related concerns.
  </Card>
</CardGroup>

<Info>
  **Context is the source of truth**: When context is provided, evaluations judge the LLM response against the provided context — not against real-world knowledge. If the context says "2+2=5" and the LLM says "2+2=4", the evaluation flags it as a factual inaccuracy because it contradicts the provided context.
</Info>

## Running evaluations

OpenLIT provides two ways to configure evaluation settings — from the Settings page or directly from a trace.

### Configure from Settings

<Frame>
  <img src="https://mintcdn.com/openlit/bDceVwnmhemq49YN/images/setup-auto-evals-from-settings.png?fit=max&auto=format&n=bDceVwnmhemq49YN&q=85&s=6cb17024e4cb53b1172833c71fdb3cd6" width="3024" height="1722" data-path="images/setup-auto-evals-from-settings.png" />
</Frame>

1. Navigate to **Evaluations** in the sidebar, then click **Settings**
2. Select your **Provider** (OpenAI, Anthropic, Google, Mistral, etc.) and **Model** to use as a judge
3. Add your LLM provider API key from Vault or create a new one
4. Optionally enable **Auto Evaluation** with a cron schedule for continuous monitoring
5. Click **Save Changes**

<Tip>
  Evaluations are powered by the **Vercel AI SDK** and support 11+ providers including OpenAI, Anthropic, Google, Mistral, Cohere, Groq, Perplexity, DeepSeek, xAI, Together, and Fireworks.
</Tip>

### Configure evaluation types

After saving the base configuration, go to the **Evaluation Types** tab to manage all 11 evaluation types:

<Frame>
  <img src="https://mintcdn.com/openlit/bDceVwnmhemq49YN/images/evaluation-types-settings-list.png?fit=max&auto=format&n=bDceVwnmhemq49YN&q=85&s=9e9a0d226fde433a3edf7f1098e5b064" width="3024" height="1720" data-path="images/evaluation-types-settings-list.png" />
</Frame>

* **Enable/disable** individual evaluation types (hallucination, bias, toxicity, safety, etc.)
* **Customize prompts** for each evaluation type to fit your specific use case
* **Link Rule Engine rules** to evaluation types for conditional evaluation based on trace attributes

Click on any evaluation type to configure its custom prompt and linked rules:

<Frame>
  <img src="https://mintcdn.com/openlit/bDceVwnmhemq49YN/images/evaluation-types-settings-detail.png?fit=max&auto=format&n=bDceVwnmhemq49YN&q=85&s=046af8af9bc1a2943b1235000b3ed50d" width="3024" height="1720" data-path="images/evaluation-types-settings-detail.png" />
</Frame>

### Custom evaluation types

In addition to the 11 built-in types, you can create your own evaluation types tailored to your use case. From the **Evaluation Types** tab, click **Create Custom Type** and provide:

* **ID**: A unique identifier in `lowercase_underscore` format (e.g., `domain_accuracy`)
* **Label**: A human-readable name displayed in the UI
* **Description**: A brief explanation of what this evaluation checks
* **Evaluation Prompt**: The prompt used by the LLM judge. It should start with a `[Label evaluation context]` header describing the evaluation criteria

Custom types work exactly like built-in types — they can be enabled or disabled, linked to Rule Engine rules, and run in both auto and manual evaluations. The only difference is that custom types can be deleted when they are no longer needed, while built-in types cannot.

### Run from a trace

<Frame>
  <img src="https://mintcdn.com/openlit/bDceVwnmhemq49YN/images/setup-auto-evals-from-trace.png?fit=max&auto=format&n=bDceVwnmhemq49YN&q=85&s=09760599b1c9b40941bfc86acf6395e9" width="3024" height="1718" data-path="images/setup-auto-evals-from-trace.png" />
</Frame>

1. Open any LLM trace in the **Requests** page
2. Click the **Evaluation** tab in the trace details
3. Click **Run Evaluation** to evaluate that specific trace
4. Your evaluation configuration applies to the selected trace

## Context and Rule Engine integration

Evaluations integrate with the [Rule Engine](/latest/openlit/prompts-experiments/rule-engine) and [Context](/latest/openlit/prompts-experiments/context) system:

* **Rule-based context**: Link rules to evaluation types. When a trace matches rule conditions, the associated context is included in the evaluation prompt.
* **Context as ground truth**: The provided context is always treated as the source of truth. The LLM judge evaluates responses strictly against the context, not against its own knowledge.
* **Dynamic evaluation**: Different models, services, or environments can have different evaluation rules and contexts.

## Monitor & Iterate

Once evaluations are running, OpenLIT continuously analyzes your LLM responses and provides actionable insights:

* **Review Individual Results**: Examine detailed evaluation scores, classifications, and explanations for each LLM trace
* **Track Quality Trends**: Monitor aggregate metrics across time periods and compare performance between different models or versions
* **Manage Evaluations**: Enable, disable, or modify evaluation settings as your application evolves

### Detailed results in traces

<Frame>
  <img src="https://mintcdn.com/openlit/bDceVwnmhemq49YN/images/auto-evals-result.png?fit=max&auto=format&n=bDceVwnmhemq49YN&q=85&s=e63541bab072d5bda5b8c29f53c5676c" width="3024" height="1722" data-path="images/auto-evals-result.png" />
</Frame>

1. Go to the Requests page to see all your LLM traces
2. Click on any LLM trace to view details — the trace ID and span ID are reflected in the URL for easy sharing

<Frame caption="Trace and span IDs in URL for shareable links">
  <img src="https://mintcdn.com/openlit/bDceVwnmhemq49YN/images/trace-url-params.png?fit=max&auto=format&n=bDceVwnmhemq49YN&q=85&s=314f8f2b0cb107e561ea861b602236ca" width="3024" height="1820" data-path="images/trace-url-params.png" />
</Frame>

3. Click the **Evaluation** tab to see evaluation results for that specific trace
4. **Detailed Metrics**: Each evaluation shows:
   * **Score**: Numerical score (0-1) indicating the severity or likelihood of the issue
   * **Classification**: Category classification (e.g., "factual\_inaccuracy", "off\_topic", "jailbreak")
   * **Explanation**: Detailed reasoning from the LLM judge about why this score was given
   * **Verdict**: Simple yes/no determination based on your threshold settings

### Aggregate statistics in dashboard

<Frame>
  <img src="https://mintcdn.com/openlit/o7M0DoQ9lLUZaVc9/images/auto-evals-dashboard.png?fit=max&auto=format&n=o7M0DoQ9lLUZaVc9&q=85&s=a255130223a92dc574282cdc80333000" width="2778" height="678" data-path="images/auto-evals-dashboard.png" />
</Frame>

* **Total Hallucination Detected**: Count of traces flagged for hallucination issues
* **Total Bias Detected**: Number of traces identified with bias concerns
* **Total Toxicity Detected**: Count of traces containing toxic or harmful content
* **Detection Rate Trends**: Percentage changes and trends over time periods

***

<CardGroup cols={3}>
  <Card title="Quickstart: LLM Guardrails" href="/latest/openlit/quickstart-guard" icon="bolt">
    Protect and secure your LLM responses in 2 simple steps
  </Card>

  <Card title="Integrations" href="/latest/sdk/integrations/overview" icon="circle-nodes">
    60+ AI integrations with automatic instrumentation and performance tracking
  </Card>

  <Card title="Create a dashboard" href="/latest/openlit/dashboards/overview" icon="grid">
    Create custom visualizations with flexible widgets, queries, and real-time AI monitoring
  </Card>
</CardGroup>
