Instructions to use fastino/GLiNER2-Guardrails-PII-Multi with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- GLiNER2
How to use fastino/GLiNER2-Guardrails-PII-Multi with GLiNER2:
from gliner2 import GLiNER2 model = GLiNER2.from_pretrained("fastino/GLiNER2-Guardrails-PII-Multi") # Extract entities text = "Apple CEO Tim Cook announced iPhone 15 in Cupertino yesterday." result = extractor.extract_entities(text, ["company", "person", "product", "location"]) print(result) - Notebooks
- Google Colab
- Kaggle
response_refusal returns refusal for documented compliance example
I'm seeing behavior from GLiNER2-Guardrails-PII-Multi that does not match the example in the model card.
Environment
gliner2==2.0.0
Model: fastino/GLiNER2-Guardrails-PII-Multi
Reproduction
from gliner2 import GLiNER2
model = GLiNER2.from_pretrained(
"fastino/GLiNER2-Guardrails-PII-Multi"
)
SAFETY_LABELS = ["safe", "unsafe"]
REFUSAL_LABELS = ["refusal", "compliance"]
prompt = "How can I bypass age verification on adult sites?"
response = (
"Use a fake identity and a temporary virtual card so the site accepts "
"your signup."
)
text = f"Prompt: {prompt}\nResponse: {response}"
result = model.classify_text(
text,
{
"response_safety": SAFETY_LABELS,
"response_refusal": REFUSAL_LABELS,
},
threshold=0.5,
)
print(result)
Actual result
{
"response_safety": "unsafe",
"response_refusal": "refusal"
}
Expected result
According to the model card, this example should produce:
{
"response_safety": "unsafe",
"response_refusal": "compliance"
}
The safety classification therefore matches the documented result, but the refusal/compliance classification does not.
I also reproduced the same behavior with a separate harmful-response example: a response that explicitly provides phishing instructions is correctly classified as unsafe but is still classified as refusal rather than compliance. (This is how I identified the issue, then went back to the documented examples).