Run this model with HF Jobs

Run idoschw3/FlertDate on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/idoschw3/FlertDate. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/idoschw3/FlertDate on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
FlertDate / README.md
idoschw3's picture
Update README.md
2db9094 verified
|
Raw History Blame Contribute Delete
6.62 kB
metadata
license: apache-2.0
language:
  - en
base_model:
  - flair/ner-english-large
pipeline_tag: token-classification
library_name: flair
tags:
  - flair
  - flert
  - named-entity-recognition
  - date-extraction

FlertDate: FLERT-Based Named Entity Recognition with DATE Support

FlertDate is an English Named Entity Recognition (NER) model based on the FLERT architecture, fine-tuned to support five entity categories, including DATE, which is not supported by the original four-label model. It was developed through additional fine-tuning and manual annotation refinement, using a corpus primarily focused on the Russia–Ukraine conflict. Although the model was fine-tuned and evaluated on Russia–Ukraine-related text, it is intended for general English NER applications. Its performance on other domains has not yet been systematically evaluated.

The model is based on FLERT (Document-Level Features for Named Entity Recognition), developed by Stefan Schweter and Alan Akbik (2020), and implemented using the Flair NLP framework.

FlertDate was developed through domain-specific fine-tuning of the pretrained flair/ner-english-large model, followed by additional training using manually reviewed and corrected entity annotations.

Unlike the original four-category FLERT NER model, FlertDate recognizes five entity categories:

Label Description
PER Persons
ORG Organizations and institutions
LOC Geographic locations
MISC Other named entities, including events and nationalities
DATE Dates and temporal expressions

Acknowledgments

This work builds upon the original FLERT model and the Flair framework. We gratefully acknowledge their developers and researchers.

  • Schweter, S., & Akbik, A. (2020). FLERT: Document-Level Features for Named Entity Recognition. Paper.
  • Akbik, A., et al. (2019). FLAIR: An Easy-to-Use Framework for State-of-the-Art NLP. Paper.

FlertDate is an independently fine-tuned derivative model and is not an official release by the original FLERT or Flair developers.

Training Methodology

FlertDate was developed through two stages of domain-specific fine-tuning using the Flair framework.

Stage 1 — DATE extension: The original pretrained FLERT model (flair/ner-english-large) was fine-tuned to recognize five entity categories (PER, ORG, LOC, MISC, DATE), extending its original four-label classification.

Stage 2 — Annotation refinement: The five-label model underwent additional fine-tuning using manually reviewed entity annotations, with particular attention to entity boundaries, classification consistency, and flat (non-overlapping) annotation.

The second training stage used:

  • 1,022 training paragraphs
  • 272 validation paragraphs
  • Article-level separation between training and validation
  • Learning rate: 5 × 10⁻⁶
  • Batch size: 4
  • Maximum epochs: 20
  • Early stopping after 15 epochs

The published checkpoint is final-model.pt from the second training stage, renamed to pytorch_model.bin for distribution.

The model was developed primarily for English-language texts concerning the Russia–Ukraine conflict.

Evaluation Results

FlertDate was evaluated using two complementary approaches.

1. Validation Evaluation

The model was evaluated on 272 validation paragraphs containing 2,018 annotated entities, using exact entity boundaries and labels.

Metric Previous FlertDate FlertDate
Micro-F1 (5 labels) 83.00% 84.14%

2. Held-Out Manual Evaluation

A separate evaluation was conducted on 100 manually adjudicated paragraphs containing 675 ground-truth entities.

Metric Original FLERT FlertDate
Precision (4 labels) 86.88% 92.23%
Recall (4 labels) 91.88% 90.36%
Micro-F1 (4 labels) 89.31% 91.28%
Micro-F1 (5 labels) N/A 90.84%
DATE F1 N/A 87.65%

The four-label comparison includes PER, ORG, LOC, and MISC. DATE is evaluated separately because the original FLERT model does not support this category.

All scores use strict exact-span-and-label matching.

These results demonstrate improved performance on the evaluated corpus. Generalization to other domains has not yet been systematically assessed.

How to Use FlertDate

FlertDate is compatible with the Flair NLP framework and supports inference on both CPU and GPU.

Installation

Install Flair using Python:

pip install flair

Loading and Running the Model

import torch
import flair
from flair.data import Sentence
from flair.models import SequenceTagger

# Use CPU (remove this line to allow automatic device selection)
flair.device = torch.device("cpu")

# Download and load FlertDate from Hugging Face
model = SequenceTagger.load("idoschw3/FlertDate")

# Example sentence
sentence = Sentence(
"Russian forces entered Ukraine on 24 February 2022."
)

# Predict named entities
model.predict(sentence)

# Display predictions
for entity in sentence.get_spans("ner"):
print(entity.text, entity.get_label("ner").value)

The model is downloaded automatically from Hugging Face when first loaded.

GPU users: Flair can automatically select a compatible GPU. The same checkpoint works on both CPU and GPU; no separate model is required.

For document-level processing, users should follow Flair's document-context conventions to preserve context between related sentences.

Limitations

FlertDate is intended for English named entity recognition. Users should consider the following limitations:

  • Domain generalization: The model was fine-tuned and evaluated primarily on Russia–Ukraine-related texts. Its performance on other domains has not yet been systematically assessed.
  • Entity recall: Manual evaluation identified occasional missed entities, particularly nationality adjectives classified as MISC.
  • Entity boundaries: The model may occasionally identify incomplete entity names or split longer organizational names.
  • Temporal expressions: DATE recognition is supported, but some dates and complex temporal expressions may be missed or incorrectly identified.
  • Annotation conventions: The model follows a flat NER scheme with no overlapping or nested entities.

Predictions should be independently verified when used in research requiring high annotation accuracy.