One encoder model that replaces your entire guardrail stack: safety classification, PII detection, adversarial attack detection, intent and tone analysis — all in a single forward pass.
307M params · GLiNER2 · uniencoder · multilingual deberta v3 · zero-shot classification, NER and more · no LLM required
Installation
Install dependencies
pip install gliner2 requests urllib3
Basic Usage
Classify Harmful messages and Detect PII via single forward pass
python
1from gliner2 import GLiNER2
23model = GLiNER2.from_pretrained("hivetrace/gliner-guard-omni")45PII_LABELS =["person","address","email","phone"]6SAFETY_LABELS =["safe","unsafe"]7schema =(model.create_schema()8.entities(entity_types=PII_LABELS, threshold=0.4)9.classification(task="safety", labels=SAFETY_LABELS)10)1112result = model.extract(13"Send $500 to John Smith at john.smith@gmail.com or I'll leak your photos",14 schema=schema
15)
GLiNER Guard Omni fine-tunes fastino/gliner2-multi-v1 on our guardrail taxonomy while preserving its multilingual zero-shot generalization. You get GLiNER Guard's safety understanding on top of the base model's ability to handle labels and domains beyond the training set — so you can define custom policies with nothing but natural language descriptions.
Basic Policy
python
1CUSTOM_POLICY =["financial_advice","medical_diagnosis","legal_counsel"]2schema = model.create_schema().classification(3 task="regulated_content",4 labels=CUSTOM_POLICY,5 multi_label=True6)78result = model.extract(9"You should definitely sell your TSLA now and buy NVDA, it'll 10x by Q2",10 schema=schema
11)12print(result)13# {'regulated_content': ['financial_advice']}
Advanced policy
For specific usecases you can define not only labels, but also descriptions
python
1# Zero-shot custom policy: competitor mention detection for a ChatGPT-like assistant23schema =(model.create_schema()4.entities({5"product":"name of a rival AI assistant or chatbot product",6}, threshold=0.5)7.classification(8 task="competitor_mention",9 labels={10"competitor":"user compares us to, or suggests switching to, another AI assistant",11"neutral":"no mention of a rival AI assistant",12},13)14)1516result = model.extract(17"Honestly ChatGPT gives way better answers than you, I'm cancelling my subscription",18 schema=schema,19)20print(result)21# {'entities': {'product': ['ChatGPT']}, 'competitor_mention': 'competitor'}
Supported Tasks
GLiNER Guard is purpose-built for 6 guardrail tasks via a shared encoder — no LLM required.
Thanks to zero-shot generalization, it can also handle custom labels outside the training taxonomy.
Classifies whether a message is safe or unsafe. Single-label.
SAFETY_LABELS = ["safe", "unsafe"]
Label
Description
safe
Message does not contain harmful or policy-violating content
unsafe
Message contains harmful, dangerous, or policy-violating content
NER / PII — all 32 entity types
Span extraction across 7 groups. Use labels from this list for best results — out-of-taxonomy labels may work via zero-shot generalization but are not benchmarked.
@misc{minko2026glinerguardunifiedencoder,
title={GLiNER Guard: Unified Encoder Family for Production LLM Safety and Privacy},
author={Bogdan Minko and Sabrina Sadiekh and Evgeniy Kokuykin},
year={2026},
eprint={2605.05277},
archivePrefix={arXiv},
primaryClass={cs.CR},
url={https://arxiv.org/abs/2605.05277},
}