> 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/prompt-injection/deepset.md).

# Deepset

Binary prompt-injection classifier.

Encoder sequence classifier that labels a text as `LEGIT` or `INJECTION`. Feed it the raw user prompt (or any untrusted text such as retrieved snippets); no model response or extra context is involved. `validate` accepts a single string or a `list[str]`, in which case the whole list runs as one true batched inference call and a list of outputs is returned in the same order.

Verdict mapping onto `GuardrailOutput`:

* `valid` is `True` when the predicted label is not `INJECTION`.
* `score` is the probability of the `INJECTION` class (canonical risk direction: higher = riskier), regardless of which label won the argmax.
* `categories` holds the full label distribution — one entry per class with its probability; the predicted class is marked `triggered=True`.

For more information, see:

* [deepset/deberta-v3-base-injection model card](https://huggingface.co/deepset/deberta-v3-base-injection).

## Supported Models

* `deepset/deberta-v3-base-injection`

## Constructor

| Parameter  | Type                                                 | Required | Default |
| ---------- | ---------------------------------------------------- | -------- | ------- |
| `model_id` | \`str                                                | None\`   | No      |
| `provider` | `Optional[Provider[dict[str, Any], dict[str, Any]]]` | No       | `None`  |

Initialize the Deepset guardrail.

## validate

Default validation pipeline: preprocess -> inference -> postprocess.

**Parameters**

| Parameter    | Type  | Required     | Default | Description |
| ------------ | ----- | ------------ | ------- | ----------- |
| `input_text` | \`str | list\[str]\` | Yes     | —           |

**Returns:** `GuardrailOutput | list[GuardrailOutput]`

## Benchmarks

### Prompt Injection

| Dataset (rev)              | Metric | Threshold    | Value    | Harness                 | Source                           | Contam. |
| -------------------------- | ------ | ------------ | -------- | ----------------------- | -------------------------------- | ------- |
| deepset\_pi (unspecified)  | f1     | native-valid | 0.991597 | guardrail-bench+ag0.7.4 | measured:guardrail-bench+ag0.7.4 | ⚠️      |
| notinject (unspecified)    | fpr    | native-valid | 0.705263 | guardrail-bench+ag0.7.4 | measured:guardrail-bench+ag0.7.4 |         |
| gandalf (unspecified)      | recall | native-valid | 0.883929 | guardrail-bench+ag0.7.4 | measured:guardrail-bench+ag0.7.4 |         |
| bipia\_email (unspecified) | f1     | native-valid | 0.7806   | bir\@fd86c16            | measured:bir\@fd86c16            |         |
| bipia\_table (unspecified) | f1     | native-valid | 0.876783 | bir\@fd86c16            | measured:bir\@fd86c16            |         |

## License

* **Vendor:** deepset
* **Default license:** `mit` (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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mozilla.ai/any-guardrail/api-reference/index/prompt-injection/deepset.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
