Downloads · 30 days
23
1% of all-time downloads
oneryalcin/gliner2-relation-verifier
gliner2-relation-verifier is a text classification model from oneryalcin. Use it when you need a label for a piece of text. It is set up for gliner2. The card lists the license as apache-2.0.
Semantic verifier for filtering false positive relations extracted by GLiNER2.
Downloads · 30 days
23
1% of all-time downloads
All-time downloads
3.1K
Public
Repo size
10.7 MB
Likes
2
Public
Click a slice to open those files.
.pt10.7 MB · 100%
From the Hugging Face model README
Semantic verifier for filtering false positive relations extracted by GLiNER2.
GLiNER2's relation extraction can produce false positives when entities co-occur without expressing the claimed relation. This verifier uses a lightweight MLP trained on relation extraction datasets to filter these false positives.
Performance:
pip install gliner2
from gliner2.verifiers import RelationVerifier
# Load verifier
verifier = RelationVerifier.from_pretrained("oneryalcin/gliner2-relation-verifier")
# Verify relations
text = "Steve Jobs founded Apple in 1976."
relations = {
"founded": [
{"head": {"text": "Steve Jobs", "start": 0, "end": 10},
"tail": {"text": "Apple", "start": 19, "end": 24}}
]
}
verified = verifier.verify(text, relations)
print(verified)
# {'founded': [{'head': {...}, 'tail': {...}, 'verifier_score': 0.85}]}
from gliner2 import GLiNER2
from gliner2.verifiers import RelationVerifier
# Load models
model = GLiNER2.from_pretrained("fastino/gliner2-base-v1")
verifier = RelationVerifier.from_pretrained("oneryalcin/gliner2-relation-verifier")
# Extract and verify
text = "John read a book about Apple."
results = model.extract_relations(text, ["works_for"], return_dict=True)
verified = verifier.verify(text, results.get("relation_extraction", {}))
# Empty - correctly filtered the false positive!
| Threshold | Precision | Recall | FPR | Use Case |
|---|---|---|---|---|
| 0.50 | 70% | 58% | 25% | Balanced |
| 0.55 | 75% | 44% | 14% | Recommended |
| 0.60 | 80% | 36% | 9% | High precision |
| 0.75 | 87% | 21% | 3% | Very conservative |
# Adjust threshold
verifier.set_threshold(0.60) # More conservative
Trained on:
See training details.
@misc{gliner2-verifier,
author = {Oner Yalcin},
title = {GLiNER2 Relation Verifier},
year = {2024},
publisher = {HuggingFace},
url = {https://huggingface.co/oneryalcin/gliner2-relation-verifier}
}
Apache 2.0