long-ner-eval
Regularization for Long Named Entity Recognition — Minbyul Jeong, Jaewoo Kang (2021) (arXiv:2104.07249, 2021)
What this evaluates
Evaluates named entity recognition capabilities, specifically probing a model's ability to handle class imbalance, out-of-vocabulary terms, and long or complex entity names across biomedical and general domain texts.
Datasets
- NCBI-disease — total ?; splits: train (-1), val (-1), test (-1)
- BC5CDR-disease — total ?; splits: train (-1), val (-1), test (-1)
- BC5CDR-chemical — total ?; splits: train (-1), val (-1), test (-1)
- BC4CHEMD — total ?; splits: train (-1), val (-1), test (-1)
- BC2GM — total ?; splits: train (-1), val (-1), test (-1)
- JNLPBA — total ?; splits: train (-1), val (-1), test (-1)
- LINNAEUS — total ?; splits: train (-1), val (-1), test (-1)
- Species-800 — total ?; splits: train (-1), val (-1), test (-1)
- CoNLL-2003 — total ?; splits: train (-1), val (-1), test (-1)
- WNUT-2017 — total ?; splits: train (-1), val (-1), test (-1)
Metrics
F1 (primary) — range: [0, 1]
- Harmonic mean of precision and recall calculated over all predicted entity mentions. Precision is the fraction of predicted entities that are correct, and recall is the fraction of gold entities that are correctly predicted.
Recall — range: [0, 1]
- Fraction of gold standard entity mentions correctly identified by the model. The paper partitions recall into Memorization (Mem), Synonym (Syn), Concept (Con), and Unseen categories to evaluate generalization.
Input / output format
Input: Tokenized text sentences with corresponding token-level entity labels.
Output: Token-level BIO/IOB entity labels predicting the entity type and boundary for each token in the input sequence.
Scoring recipe
def calculate_ner_f1(preds, gold):
pred_set = set(extract_mentions(preds))
gold_set = set(extract_mentions(gold))
tp = len(pred_set & gold_set)
fp = len(pred_set - gold_set)
fn = len(gold_set - pred_set)
prec = tp / (tp + fp) if (tp + fp) > 0 else 0.0
rec = tp / (tp + fn) if (tp + fn) > 0 else 0.0
return 2 * prec * rec / (prec + rec) if (prec + rec) > 0 else 0.0
def extract_mentions(labels):
mentions = set()
curr_type, start = None, None
for i, lbl in enumerate(labels):
if lbl.startswith('B-'):
if curr_type: mentions.add((curr_type, start, i-1))
curr_type, start = lbl[2:], i
elif lbl.startswith('I-') and curr_type:
pass
else:
if curr_type: mentions.add((curr_type, start, i-1))
curr_type, start = None, None
if curr_type: mentions.add((curr_type, start, len(labels)-1))
return mentions
Common pitfalls
- The paper partitions datasets into Memorization (Mem), Synonym (Syn), Concept (Con), and Unseen categories; reporting only aggregate F1 masks performance differences across these generalization splits.
- Entity length heavily influences results; models often perform well on short entities but drop significantly on long entities (≥8 tokens), requiring length-stratified evaluation.
- Out-of-vocabulary (OOV) handling relies on subword tokenization rather than word-level frequency, so evaluating at the word level without considering subword debiasing will misrepresent OOV performance.
Evidence (verbatim from paper)
Using three components, namely Subword, Class, and Temp, showed significant improvements in recall on Syn and Con, as well as overall improvements to in-domain performance (F1).
Citation
@misc{jeong2021regularization,
title={Regularization for Long Named Entity Recognition},
author={Minbyul Jeong, Jaewoo Kang (2021)},
year={2021},
note={arXiv:2104.07249}
}
1---2name: long-ner-eval3description: Evaluates named entity recognition capabilities, specifically probing a model's ability to handle class imbalance, out-of-vocabulary terms, and long or complex entity names across biomedical and general domain texts. Use when the user wants to benchmark on NCBI-disease, BC5CDR-disease, BC5CDR-chemical, BC4CHEMD, BC2GM, JNLPBA, LINNAEUS, Species-800, CoNLL-2003, WNUT-2017, or asks about evaluating this task. Reports F1.4---56# long-ner-eval78> Regularization for Long Named Entity Recognition — Minbyul Jeong, Jaewoo Kang (2021) (arXiv:2104.07249, 2021)910## What this evaluates1112Evaluates named entity recognition capabilities, specifically probing a model's ability to handle class imbalance, out-of-vocabulary terms, and long or complex entity names across biomedical and general domain texts.1314## Datasets1516- **NCBI-disease** — total ?; splits: train (-1), val (-1), test (-1)17- **BC5CDR-disease** — total ?; splits: train (-1), val (-1), test (-1)18- **BC5CDR-chemical** — total ?; splits: train (-1), val (-1), test (-1)19- **BC4CHEMD** — total ?; splits: train (-1), val (-1), test (-1)20- **BC2GM** — total ?; splits: train (-1), val (-1), test (-1)21- **JNLPBA** — total ?; splits: train (-1), val (-1), test (-1)22- **LINNAEUS** — total ?; splits: train (-1), val (-1), test (-1)23- **Species-800** — total ?; splits: train (-1), val (-1), test (-1)24- **CoNLL-2003** — total ?; splits: train (-1), val (-1), test (-1)25- **WNUT-2017** — total ?; splits: train (-1), val (-1), test (-1)2627## Metrics2829- `F1` **(primary)** — range: [0, 1]30 - Harmonic mean of precision and recall calculated over all predicted entity mentions. Precision is the fraction of predicted entities that are correct, and recall is the fraction of gold entities that are correctly predicted.31- `Recall` — range: [0, 1]32 - Fraction of gold standard entity mentions correctly identified by the model. The paper partitions recall into Memorization (Mem), Synonym (Syn), Concept (Con), and Unseen categories to evaluate generalization.3334## Input / output format3536**Input**: Tokenized text sentences with corresponding token-level entity labels.3738**Output**: Token-level BIO/IOB entity labels predicting the entity type and boundary for each token in the input sequence.3940## Scoring recipe4142```python43def calculate_ner_f1(preds, gold):44 pred_set = set(extract_mentions(preds))45 gold_set = set(extract_mentions(gold))46 tp = len(pred_set & gold_set)47 fp = len(pred_set - gold_set)48 fn = len(gold_set - pred_set)49 prec = tp / (tp + fp) if (tp + fp) > 0 else 0.050 rec = tp / (tp + fn) if (tp + fn) > 0 else 0.051 return 2 * prec * rec / (prec + rec) if (prec + rec) > 0 else 0.05253def extract_mentions(labels):54 mentions = set()55 curr_type, start = None, None56 for i, lbl in enumerate(labels):57 if lbl.startswith('B-'):58 if curr_type: mentions.add((curr_type, start, i-1))59 curr_type, start = lbl[2:], i60 elif lbl.startswith('I-') and curr_type:61 pass62 else:63 if curr_type: mentions.add((curr_type, start, i-1))64 curr_type, start = None, None65 if curr_type: mentions.add((curr_type, start, len(labels)-1))66 return mentions67```6869## Common pitfalls7071- The paper partitions datasets into Memorization (Mem), Synonym (Syn), Concept (Con), and Unseen categories; reporting only aggregate F1 masks performance differences across these generalization splits.72- Entity length heavily influences results; models often perform well on short entities but drop significantly on long entities (≥8 tokens), requiring length-stratified evaluation.73- Out-of-vocabulary (OOV) handling relies on subword tokenization rather than word-level frequency, so evaluating at the word level without considering subword debiasing will misrepresent OOV performance.7475## Evidence (verbatim from paper)7677> Using three components, namely Subword, Class, and Temp, showed significant improvements in recall on Syn and Con, as well as overall improvements to in-domain performance (F1).7879## Citation8081```bibtex82@misc{jeong2021regularization,83 title={Regularization for Long Named Entity Recognition},84 author={Minbyul Jeong, Jaewoo Kang (2021)},85 year={2021},86 note={arXiv:2104.07249}87}88```8990- arXiv: 2104.07249