← Back to models

gliner2-base-v1

recognizerLabelsZero-shotClassificationRelations
v1.0.00 B
antfly inference pull fastino/gliner2-base-v1
By fastinoHuggingFaceCreated: 9/13/2026

About GLiNER2#

GLiNER2 is a unified multi-task model that performs named entity recognition, zero-shot classification, relation extraction, and structured JSON extraction — all from a single model. It uses a DeBERTa-v3-base encoder with the GLiNER2 architecture.

Unlike traditional NER models that are limited to predefined entity types, GLiNER2 accepts arbitrary labels at inference time, making it extremely flexible for diverse extraction tasks.

Capabilities#

  • Named Entity Recognition: Extract entities with custom labels
  • Relation Extraction: Extract (subject, relation, object) triplets from text
  • Zero-Shot Classification: Classify text into arbitrary categories
  • JSON Extraction: Extract structured data matching a schema

Use Cases#

Use CaseDescription
Document ProcessingExtract people, organizations, dates from contracts or reports
Knowledge GraphsBuild knowledge graphs by extracting entities and their relationships
Content TaggingClassify articles, support tickets, or reviews into custom categories
Data ExtractionPull structured fields from unstructured text (e.g., invoices, resumes)

Antfly Inference API Usage#

Named Entity Recognition#

Extract entities with custom labels — no predefined entity types needed:

curl -X POST "http://localhost:8080/ai/v1/recognize" \
-H "Content-Type: application/json" \
-d '{
"model": "gliner2-base-v1",
"texts": ["Steve Jobs founded Apple in Cupertino, California."],
"labels": ["person", "organization", "location"]
}'

Relation Extraction#

Extract relationships between entities as (subject, relation, object) triplets:

curl -X POST "http://localhost:8080/ai/v1/recognize" \
-H "Content-Type: application/json" \
-d '{
"model": "gliner2-base-v1",
"texts": ["Steve Jobs founded Apple in 1976."],
"relation_labels": ["founded by", "located in", "born in"]
}'

Zero-Shot Classification#

Classify text into arbitrary categories:

curl -X POST "http://localhost:8080/ai/v1/classify" \
-H "Content-Type: application/json" \
-d '{
"model": "gliner2-base-v1",
"texts": ["Apple reported record quarterly revenue of $124 billion."],
"labels": ["finance", "technology", "sports", "politics"]
}'

JSON Extraction#

Extract structured data from text matching a schema:

curl -X POST "http://localhost:8080/ai/v1/extract" \
-H "Content-Type: application/json" \
-d '{
"model": "gliner2-base-v1",
"texts": ["John Smith is a 35-year-old engineer at Google in Mountain View."],
"schema": {
  "person": ["name::str", "age::str", "job_title::str", "company::str", "city::str"]
}
}'

Supported Tasks#

TaskEndpointDescription
NER (default)/recognize with labelsExtract entities with custom labels
Relations/recognize with relation_labelsExtract (subject, relation, object) triplets
Classification/classify with labelsZero-shot text classification
JSON Extraction/extract with schemaExtract structured fields from text

Antfly Configuration#

To use GLiNER2 as a recognizer in your Antfly configuration:

recognizer:
  provider: antfly
  model: gliner2-base-v1

For tables with entity extraction:

tables:
  documents:
    indexes:
      entities:
        type: ner
        recognizer:
          provider: antfly
          model: gliner2-base-v1
        labels:
          - person
          - organization
          - location
          - date

Versions

TagStatus
latestAvailable
v1.0.0Latest

Usage

Pull the model

antfly inference pull fastino/gliner2-base-v1

Start Antfly Inference

# With Antfly standalone (Antfly Inference enabled by default)
antfly standalone

# Or run Antfly Inference on its own
antfly inference

Use in configuration

# config.yaml
recognizer:
  provider: antfly
  model: fastino/gliner2-base-v1

Available variants (smaller/faster)

FP16:
# config.yaml
recognizer:
  provider: antfly
  model: fastino/gliner2-base-v1-f16