> For the complete documentation index, see [llms.txt](https://docs.mozilla.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mozilla.ai/any-guardrail/api-reference/index/general-judge/glider.md).

# GLIDER

Prompt-based LLM judge that grades text against user-supplied pass criteria and rubric, returning reasoning and highlighted phrases.

GLIDER is a compact (3B) evaluator LLM fine-tuned to score arbitrary text on arbitrary user-defined criteria. Each call wraps the text in GLIDER's evaluation prompt together with `pass_criteria` and `rubric`; the model replies with a `<reasoning>` block, a `<highlight>` list of the decisive words/phrases, and an integer `<score>`.

Verdict mapping onto `GuardrailOutput`:

* `valid` is `rubric_score >= pass_threshold` (or `<=` when `higher_is_better=False`).
* `score` (canonical risk: higher = riskier) is populated only when `score_range` is supplied — the rubric score is normalized onto \[0, 1] and inverted when higher rubric values mean better text. Otherwise `score` is `None`.
* `explanation` is the model's `<reasoning>` block (the full generation when the block is missing).
* `extra` holds the raw integer `rubric_score` and the `highlights` string.
* When no `<score>` can be parsed, the output fails closed: `valid=False` with `extra={"parse_failure": True}`.

Inputs are single strings: `input_text` (required) plus an optional `output_text` judged alongside it (typically a model response); list/batch input is not supported.

It runs through `provider.generate_chat`, so it can be served from either a `HuggingFaceProvider` or a `LlamafileProvider`.

For more information, see:

* [GLIDER model card](https://huggingface.co/PatronusAI/glider)
* [GLIDER: Grading LLM Interactions and Decisions using Explainable Ranking](https://arxiv.org/abs/2412.14140)

Raises: ValueError: Can only use model path to GLIDER from HuggingFace.

## Supported Models

* `PatronusAI/glider`

## Constructor

| Parameter          | Type                                                 | Required | Default | Description                                                                                                                                                                                                                                              |
| ------------------ | ---------------------------------------------------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `pass_criteria`    | `str`                                                | Yes      | —       | A question or description of what is being judged, e.g. `"Is the response free of unsupported medical claims?"`.                                                                                                                                         |
| `rubric`           | `str`                                                | Yes      | —       | A free-text scoring rubric telling the model what each score means, e.g. `"0: contains unsupported claims. 1: all claims are supported."`.                                                                                                               |
| `pass_threshold`   | `int`                                                | Yes      | —       | The rubric score at which the text counts as passing. `valid` is `rubric_score >= pass_threshold` (or `<=` when `higher_is_better=False`). Must be on the same scale as the rubric.                                                                      |
| `model_id`         | \`str                                                | None\`   | No      | `None`                                                                                                                                                                                                                                                   |
| `provider`         | `Optional[Provider[dict[str, Any], dict[str, Any]]]` | No       | `None`  | Optional pre-configured provider. When `None`, a `HuggingFaceProvider` is built targeting `AutoModelForCausalLM` / `AutoTokenizer` (transformers is imported lazily here). Pass a `LlamafileProvider` to run a GGUF build without the huggingface extra. |
| `higher_is_better` | `bool`                                               | No       | `True`  | Whether higher rubric scores mean better/passing text. Set to `False` for rubrics where higher scores mean worse text (e.g. a severity scale).                                                                                                           |
| `score_range`      | \`tuple\[int, int]                                   | None\`   | No      | `None`                                                                                                                                                                                                                                                   |
| `prompt`           | \`PromptTemplate                                     | None\`   | No      | `None`                                                                                                                                                                                                                                                   |
| `prompt_version`   | \`str                                                | None\`   | No      | `None`                                                                                                                                                                                                                                                   |

Initialize the GLIDER guardrail.

## validate

Use the provided pass criteria and rubric to judge the input and output text provided.

**Parameters**

| Parameter     | Type  | Required | Default | Description                                                                                                                                                                                          |
| ------------- | ----- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `input_text`  | `str` | Yes      | —       | The text to evaluate, wrapped in `<INPUT>` tags in GLIDER's evaluation prompt. Typically the user prompt or the standalone text being judged. Single string only; list/batch input is not supported. |
| `output_text` | \`str | None\`   | No      | `None`                                                                                                                                                                                               |

**Returns:** `GuardrailOutput`

## Benchmarks

### General Judge

| Dataset (rev)              | Metric           | Threshold    | Value    | Harness                 | Source                           | Contam. |
| -------------------------- | ---------------- | ------------ | -------- | ----------------------- | -------------------------------- | ------- |
| judgebench (unspecified)   | choice\_accuracy | native-valid | 0.624561 | guardrail-bench+ag0.7.4 | measured:guardrail-bench+ag0.7.4 |         |
| llmbar (unspecified)       | choice\_accuracy | native-valid | 0.533333 | guardrail-bench+ag0.7.4 | measured:guardrail-bench+ag0.7.4 |         |
| rewardbench2 (unspecified) | choice\_accuracy | native-valid | 0.305263 | guardrail-bench+ag0.7.4 | measured:guardrail-bench+ag0.7.4 |         |

## License

* **Vendor:** Patronus AI
* **Default license:** `cc-by-nc-4.0` (of the default model/service)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mozilla.ai/any-guardrail/api-reference/index/general-judge/glider.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
