Edit model card

numind/NuNER-v1.0 fine-tuned on OntoNotes5

This is a NuNER model fine-tuned on the OntoNotes5 dataset that can be used for Named Entity Recognition. NuNER model uses RoBERTa-base as the backbone encoder and it was trained on the NuNER dataset, which is a large and diverse dataset synthetically labeled by gpt-3.5-turbo-0301 of 1M sentences. This further pre-training phase allowed the generation of high quality token embeddings, a good starting point for fine-tuning on more specialized datasets.

Model Details

The model was fine-tuned as a regular BERT-based model for NER task using HuggingFace Trainer class.

Model labels

Entity Types: CARDINAL, DATE, PERSON, NORP, GPE, LAW, PERCENT, ORDINAL, MONEY, WORK_OF_ART, FAC, TIME, QUANTITY, PRODUCT, LANGUAGE, ORG, LOC, EVENT

Uses

Direct Use for Inference

>>> from transformers import pipeline

>>> text = """Foreign governments may be spying on your smartphone notifications, senator says. Washington (CNN) — Foreign governments have reportedly attempted to spy on iPhone and Android users through the mobile app notifications they receive on their smartphones - and the US government has forced Apple and Google to keep quiet about it, according to a top US senator. Through legal demands sent to the tech giants, governments have allegedly tried to force Apple and Google to turn over sensitive information that could include the contents of a notification - such as previews of a text message displayed on a lock screen, or an update about app activity, Oregon Democratic Sen. Ron Wyden said in a new report. Wyden's report reflects the latest example of long-running tensions between tech companies and governments over law enforcement demands, which have stretched on for more than a decade. Governments around the world have particularly battled with tech companies over encryption, which provides critical protections to users and businesses while in some cases preventing law enforcement from pursuing investigations into messages sent over the internet."""

>>> classifier = pipeline(
    "ner",
    model="guishe/nuner-v1_ontonotes5",
    aggregation_strategy="simple",
)
>>> classifier(text)

[{'entity_group': 'GPE',
  'score': 0.99179757,
  'word': ' Washington',
  'start': 82,
  'end': 92},
 {'entity_group': 'ORG',
  'score': 0.9535868,
  'word': 'CNN',
  'start': 94,
  'end': 97},
 {'entity_group': 'PRODUCT',
  'score': 0.6833637,
  'word': ' iPhone',
  'start': 157,
  'end': 163},
 {'entity_group': 'PRODUCT',
  'score': 0.5540275,
  'word': ' Android',
  'start': 168,
  'end': 175},
 {'entity_group': 'GPE',
  'score': 0.98848885,
  'word': ' US',
  'start': 263,
  'end': 265},
 {'entity_group': 'ORG',
  'score': 0.9939406,
  'word': ' Apple',
  'start': 288,
  'end': 293},
 {'entity_group': 'ORG',
  'score': 0.9933014,
  'word': ' Google',
  'start': 298,
  'end': 304},
 {'entity_group': 'GPE',
  'score': 0.99083686,
  'word': ' US',
  'start': 348,
  'end': 350},
 {'entity_group': 'ORG',
  'score': 0.99349517,
  'word': ' Apple',
  'start': 449,
  'end': 454},
 {'entity_group': 'ORG',
  'score': 0.99239254,
  'word': ' Google',
  'start': 459,
  'end': 465},
 {'entity_group': 'GPE',
  'score': 0.99598336,
  'word': ' Oregon',
  'start': 649,
  'end': 655},
 {'entity_group': 'NORP',
  'score': 0.99030787,
  'word': ' Democratic',
  'start': 656,
  'end': 666},
 {'entity_group': 'PERSON',
  'score': 0.9957912,
  'word': ' Ron Wyden',
  'start': 672,
  'end': 681},
 {'entity_group': 'PERSON',
  'score': 0.83941424,
  'word': ' Wyden',
  'start': 704,
  'end': 709},
 {'entity_group': 'DATE',
  'score': 0.87746465,
  'word': ' more than a decade',
  'start': 869,
  'end': 887}]

Training Details

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 5e-05
  • train_batch_size: 32
  • eval_batch_size: 32
  • seed: 42
  • gradient_accumulation_steps: 2
  • total_train_batch_size: 64
  • optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • lr_scheduler_type: linear
  • lr_scheduler_warmup_ratio: 0.1
  • num_epochs: 4

Training results

Training Loss Epoch Step Validation Loss Precision Recall F1 Accuracy
0.0781 1.0 936 0.0754 0.8392 0.8843 0.8612 0.9778
0.049 2.0 1873 0.0685 0.8597 0.8935 0.8763 0.9794
0.0357 3.0 2809 0.0714 0.8608 0.9016 0.8807 0.9806
0.027 4.0 3744 0.0728 0.8712 0.9000 0.8853 0.9811

Framework versions

  • Transformers 4.36.0

  • Pytorch 2.0.0+cu117

  • Datasets 2.18.0

  • Tokenizers 0.15.2

  • Citation

BibTeX

@misc{bogdanov2024nuner,
      title={NuNER: Entity Recognition Encoder Pre-training via LLM-Annotated Data}, 
      author={Sergei Bogdanov and Alexandre Constantin and Timothée Bernard and Benoit Crabbé and Etienne Bernard},
      year={2024},
      eprint={2402.15343},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}
Downloads last month
14
Safetensors
Model size
124M params
Tensor type
F32
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for guishe/nuner-v1_ontonotes5

Base model

numind/NuNER-v1.0
Finetuned
(4)
this model

Dataset used to train guishe/nuner-v1_ontonotes5

Evaluation results