File size: 22,049 Bytes
5f5124a
630a3db
 
5f5124a
630a3db
 
 
 
 
5f5124a
 
 
 
630a3db
 
 
 
 
 
 
 
 
 
 
5f5124a
630a3db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f5124a
 
630a3db
 
 
 
 
 
 
5f5124a
630a3db
5f5124a
630a3db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f5124a
630a3db
5f5124a
630a3db
5f5124a
630a3db
 
5f5124a
630a3db
5f5124a
630a3db
 
 
 
 
 
5f5124a
630a3db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f5124a
630a3db
 
 
 
 
 
 
 
5f5124a
 
 
 
7db6239
5f5124a
 
 
 
 
 
 
 
 
 
 
 
 
 
7db6239
 
 
 
5f5124a
 
 
 
 
 
 
 
630a3db
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
---
language: en
license: cc-by-sa-4.0
tags:
- token-classification
- ner
- named-entity-recognition
datasets:
- DFKI-SLT/few-nerd
metrics:
- precision
- recall
- f1
widget:
- text: Concern and scepticism surround Niger uranium mining waste storage plans. Towering mounds dot the desert landscape in northern Niger's Arlit region, but they are heaps of partially radioactive waste left from four decades of operations at one of the world's biggest uranium mines. An ambitious 10-year scheme costing $160 million is underway to secure the waste and avoid risks to health and the environment, but many local people are worried or sceptical. France's nuclear giant Areva, now called Orano, worked the area under a subsidiary, the Akouta Mining Company (Cominak). Cominak closed the site in 2021 after extracting 75,000 tonnes of uranium, much of which went to fuelling the scores of nuclear reactors that provide the backbone of France's electricity supply. Cominak's director general Mahaman Sani Abdoulaye showcased the rehabilitation project to the first French journalists to visit the site since 2010, when seven Areva employees were kidnapped by jihadists.
- text: SE Michigan counties allege insulin gouging; Localities file lawsuit against pharmaceutical makers. Four metro Detroit counties filed federal lawsuits Wednesday against some of the nation's biggest pharmaceutical manufacturers and pharmacy benefit managers alleging illegal price fixing for insulin products. Macomb, Monroe, Wayne and Washtenaw counties filed the lawsuits in U.S. District Court in New Jersey against more than a dozen companies, including Lilly, Sanofi Aventis, Novo Nordisk, Express Scripts, Optum Rx and CVS Caremark, per their attorneys. "These are the first such lawsuits that have been filed in the state of Michigan and probably more to come," said attorney Melvin Butch Hollowell of the Miller Law Firm. He described the allegations during a news conference, saying that nationally "the pharmacies and manufacturers get together. They control about 90% of the market each, of the insulin market. They talk to each other secretly. And they jack up the prices through anticompetitive means. And what we've seen is over the past 20 years, when we talk about jacking up the prices, they jack them up 1,500% in the last 20 years. 1,500%."
- 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.
- text: Tech giants ‘could severely disable UK spooks from stopping online harms’. Silicon Valley tech giants’ actions could “severely disable” UK spooks from preventing harm caused by online paedophiles and fraudsters, Suella Braverman  has suggested. The Conservative former home secretary named Facebook owner Meta , and Apple, and their use of technologies such as end-to-end encryption as a threat to attempts to tackle digital crimes. She claimed the choice to back these technologies without “safeguards” could “enable and indeed facilitate some of the worst atrocities that our brave men and women in law enforcement agencies deal with every day”, as MPs  began considering changes to investigatory powers laws. The Investigatory Powers (Amendment) Bill  includes measures to make it easier for agencies to examine and retain bulk datasets, such as publicly available online telephone records, and would allow intelligence agencies to use internet connection records to aid detection of their targets. We know that the terrorists, the serious organised criminals, and fraudsters, and the online paedophiles, all take advantage of the dark web and encrypted spaces
- text: Camargo Corrêa asks Toffoli to suspend the fine agreed with Lava Jato. The Camargo Corrêa group has asked Justice Dias Toffoli to suspend the R$1.4 billion fine it agreed to pay in its leniency agreement under Operation Car Wash. The company asked for an extension of the minister's decisions that benefited J&F and Odebrecht. Like the other companies, it claimed that it suffered undue pressure from members of the Federal Public Prosecutor's Office (MPF) to close the deal. Much of the request is based on messages exchanged between prosecutors from the Curitiba task force and former judge Sergio Moro - Camargo Corrêa requested full access to the material, seized in Operation Spoofing, which arrested the hackers who broke into cell phones. The dialogues, according to the group's defense, indicate that the executives did not freely agree to the deal, since they were the targets of lawsuits and pre-trial detentions.
pipeline_tag: token-classification
inference:
  parameters:
    aggregation_strategy: "simple"
base_model: numind/NuNER-v2.0
model-index:
- name: numind/NuNER-v2.0 fine-tuned on FewNERD-fine-supervised
  results:
  - task:
      type: token-classification
      name: Named Entity Recognition
    dataset:
      name: FewNERD
      type: DFKI-SLT/few-nerd
      split: eval
    metrics:
    - type: f1
      value: 0.691212893048585
      name: F1
    - type: precision
      value: 0.6733880835152357
      name: Precision
    - type: recall
      value: 0.7100070181232713
      name: Recall
---

# numind/NuNER-v2.0 fine-tuned on FewNERD-fine-supervised

This is a [NuNER](https://arxiv.org/abs/2402.15343) model fine-tuned on the [FewNERD](https://huggingface.co/datasets/DFKI-SLT/few-nerd) dataset that can be used for Named Entity Recognition. NuNER model uses [RoBERTa-base](https://huggingface.co/FacebookAI/roberta-base) as the backbone encoder and it was trained on the [NuNER dataset](https://huggingface.co/datasets/numind/NuNER), 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

| Label                                    | Examples                                                                                                 |
|:-----------------------------------------|:---------------------------------------------------------------------------------------------------------|
| art_broadcastprogram                     | "Corazones", "The Gale Storm Show : Oh , Susanna", "Street Cents"                                        |
| art_film                                 | "Shawshank Redemption", "L'Atlantide", "Bosch"                                                           |
| art_music                                | "Hollywood Studio Symphony", "Atkinson , Danko and Ford ( with Brockie and Hilton )", "Champion Lover"   |
| art_other                                | "The Today Show", "Venus de Milo", "Aphrodite of Milos"                                                  |
| art_painting                             | "Production/Reproduction", "Touit", "Cofiwch Dryweryn"                                                   |
| art_writtenart                           | "The Seven Year Itch", "Imelda de ' Lambertazzi", "Time"                                                 |
| building_airport                         | "Sheremetyevo International Airport", "Newark Liberty International Airport", "Luton Airport"            |
| building_hospital                        | "Yeungnam University Hospital", "Hokkaido University Hospital", "Memorial Sloan-Kettering Cancer Center" |
| building_hotel                           | "The Standard Hotel", "Flamingo Hotel", "Radisson Blu Sea Plaza Hotel"                                   |
| building_library                         | "British Library", "Bayerische Staatsbibliothek", "Berlin State Library"                                 |
| building_other                           | "Henry Ford Museum", "Alpha Recording Studios", "Communiplex"                                            |
| building_restaurant                      | "Carnegie Deli", "Fatburger", "Trumbull"                                                                 |
| building_sportsfacility                  | "Boston Garden", "Sports Center", "Glenn Warner Soccer Facility"                                         |
| building_theater                         | "Sanders Theatre", "National Paris Opera", "Pittsburgh Civic Light Opera"                                |
| event_attack/battle/war/militaryconflict | "Easter Offensive", "Jurist", "Vietnam War"                                                              |
| event_disaster                           | "the 1912 North Mount Lyell Disaster", "1990s North Korean famine", "1693 Sicily earthquake"             |
| event_election                           | "Elections to the European Parliament", "March 1898 elections", "1982 Mitcham and Morden by-election"    |
| event_other                              | "Union for a Popular Movement", "Masaryk Democratic Movement", "Eastwood Scoring Stage"                  |
| event_protest                            | "Iranian Constitutional Revolution", "French Revolution", "Russian Revolution"                           |
| event_sportsevent                        | "World Cup", "National Champions", "Stanley Cup"                                                         |
| location_GPE                             | "Croatian", "Mediterranean Basin", "the Republic of Croatia"                                             |
| location_bodiesofwater                   | "Arthur Kill", "Atatürk Dam Lake", "Norfolk coast"                                                       |
| location_island                          | "new Samsat district", "Laccadives", "Staten Island"                                                     |
| location_mountain                        | "Salamander Glacier", "Miteirya Ridge", "Ruweisat Ridge"                                                 |
| location_other                           | "Victoria line", "Northern City Line", "Cartuther"                                                       |
| location_park                            | "Painted Desert Community Complex Historic District", "Gramercy Park", "Shenandoah National Park"        |
| location_road/railway/highway/transit    | "NJT", "Newark-Elizabeth Rail Link", "Friern Barnet Road"                                                |
| organization_company                     | "Texas Chicken", "Dixy Chicken", "Church 's Chicken"                                                     |
| organization_education                   | "MIT", "Belfast Royal Academy and the Ulster College of Physical Education", "Barnard College"           |
| organization_government/governmentagency | "Congregazione dei Nobili", "Diet", "Supreme Court"                                                      |
| organization_media/newspaper             | "Clash", "Al Jazeera", "TimeOut Melbourne"                                                               |
| organization_other                       | "Defence Sector C", "IAEA", "4th Army"                                                                   |
| organization_politicalparty              | "Al Wafa ' Islamic", "Shimpotō", "Kenseitō"                                                              |
| organization_religion                    | "UPCUSA", "Christian", "Jewish"                                                                          |
| organization_showorganization            | "Lizzy", "Bochumer Symphoniker", "Mr. Mister"                                                            |
| organization_sportsleague                | "China League One", "NHL", "First Division"                                                              |
| organization_sportsteam                  | "Arsenal", "Luc Alphand Aventures", "Tottenham"                                                          |
| other_astronomything                     | "Algol", "`` Caput Larvae ''", "Zodiac"                                                                  |
| other_award                              | "Order of the Republic of Guinea and Nigeria", "Grand Commander of the Order of the Niger", "GCON"       |
| other_biologything                       | "N-terminal lipid", "Amphiphysin", "BAR"                                                                 |
| other_chemicalthing                      | "uranium", "carbon dioxide", "sulfur"                                                                    |
| other_currency                           | "$", "lac crore", "Travancore Rupee"                                                                     |
| other_disease                            | "bladder cancer", "French Dysentery Epidemic of 1779", "hypothyroidism"                                  |
| other_educationaldegree                  | "BSc ( Hons ) in physics", "Bachelor", "Master"                                                          |
| other_god                                | "Raijin", "Fujin", "El"                                                                                  |
| other_language                           | "Breton-speaking", "Latin", "English"                                                                    |
| other_law                                | "Leahy–Smith America Invents Act ( AIA", "United States Freedom Support Act", "Thirty Years ' Peace"     |
| other_livingthing                        | "monkeys", "patchouli", "insects"                                                                        |
| other_medical                            | "amitriptyline", "Pediatrics", "pediatrician"                                                            |
| person_actor                             | "Tchéky Karyo", "Edmund Payne", "Ellaline Terriss"                                                       |
| person_artist/author                     | "Hicks", "Gaetano Donizett", "George Axelrod"                                                            |
| person_athlete                           | "Tozawa", "Neville", "Jaguar"                                                                            |
| person_director                          | "Richard Quine", "Bob Swaim", "Frank Darabont"                                                           |
| person_other                             | "Campbell", "Holden", "Richard Benson"                                                                   |
| person_politician                        | "William", "Rivière", "Emeric"                                                                           |
| person_scholar                           | "Wurdack", "Stalmine", "Stedman"                                                                         |
| person_soldier                           | "Joachim Ziegler", "Helmuth Weidling", "Krukenberg"                                                      |
| product_airplane                         | "Spey-equipped FGR.2s", "EC135T2 CPDS", "Luton"                                                          |
| product_car                              | "Phantom", "100EX", "Corvettes - GT1 C6R"                                                                |
| product_food                             | "red grape", "yakiniku", "V. labrusca"                                                                   |
| product_game                             | "Hardcore RPG", "Splinter Cell", "Airforce Delta"                                                        |
| product_other                            | "X11", "PDP-1", "Fairbottom Bobs"                                                                        |
| product_ship                             | "Essex", "Congress", "HMS `` Chinkara ''"                                                                |
| product_software                         | "AmiPDF", "Wikipedia", "Apdf"                                                                            |
| product_train                            | "55022", "Royal Scots Grey", "High Speed Trains"                                                         |
| product_weapon                           | "AR-15 's", "ZU-23-2MR Wróbel II", "ZU-23-2M Wróbel"                                                     |

## Uses

### Direct Use for Inference

```python
>>> 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-v2_fewnerd_fine_super",
    aggregation_strategy="simple",
)
>>> classifier(text)

[{'entity_group': 'location_GPE',
  'score': 0.96503985,
  'word': ' Washington',
  'start': 82,
  'end': 92},
 {'entity_group': 'organization_media/newspaper',
  'score': 0.89006454,
  'word': 'CNN',
  'start': 94,
  'end': 97},
 {'entity_group': 'product_other',
  'score': 0.86745757,
  'word': ' iPhone',
  'start': 157,
  'end': 163},
 {'entity_group': 'product_other',
  'score': 0.6874236,
  'word': ' Android',
  'start': 168,
  'end': 175},
 {'entity_group': 'location_GPE',
  'score': 0.87520945,
  'word': ' US',
  'start': 263,
  'end': 265},
 {'entity_group': 'organization_company',
  'score': 0.96546257,
  'word': ' Apple',
  'start': 288,
  'end': 293},
 {'entity_group': 'organization_company',
  'score': 0.9558688,
  'word': ' Google',
  'start': 298,
  'end': 304},
 {'entity_group': 'location_GPE',
  'score': 0.97874,
  'word': ' US',
  'start': 348,
  'end': 350},
 {'entity_group': 'organization_company',
  'score': 0.963951,
  'word': ' Apple',
  'start': 449,
  'end': 454},
 {'entity_group': 'organization_company',
  'score': 0.9558847,
  'word': ' Google',
  'start': 459,
  'end': 465},
 {'entity_group': 'location_GPE',
  'score': 0.7581249,
  'word': ' Oregon',
  'start': 649,
  'end': 655},
 {'entity_group': 'organization_politicalparty',
  'score': 0.7324057,
  'word': ' Democratic',
  'start': 656,
  'end': 666},
 {'entity_group': 'person_politician',
  'score': 0.86246103,
  'word': ' Ron Wyden',
  'start': 672,
  'end': 681},
 {'entity_group': 'person_politician',
  'score': 0.7916358,
  'word': ' Wyden',
  'start': 704,
  'end': 709}]
```


## Training Details

### Training Set Metrics
| Training set          | Min | Median  | Max |
|:----------------------|:----|:--------|:----|
| Sentence length       | 1   | 24.4945 | 267 |
| Entities per sentence | 0   | 2.5832  | 88  |

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 3e-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.2602        | 1.0   | 2059 | 0.2486          | 0.6570    | 0.7031 | 0.6793 | 0.9270   |
| 0.2199        | 2.0   | 4118 | 0.2369          | 0.6791    | 0.7043 | 0.6915 | 0.9302   |
| 0.2052        | 3.0   | 6177 | 0.2349          | 0.6785    | 0.7143 | 0.6959 | 0.9312   |
| 0.1835        | 4.0   | 8236 | 0.2362          | 0.6810    | 0.7160 | 0.6981 | 0.9313   |


### Framework versions

- Transformers 4.39.3
- Pytorch 2.2.0+cu121
- 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}
}
```