HunFlair2 in a cross-corpus evaluation of biomedical named entity recognition and normalization tools

Mario Sänger, Samuele Garda, Xing David Wang, Leon Weber-Genzel, Pia Droop, Benedikt Fuchs, Alan Akbik, Ulf LeserarXiv 2024 · DOI

TL;DR

HunFlair2 is a new state-of-the-art tool for biomedical entity extraction that outperforms existing systems in "in the wild" scenarios. By conducting a rigorous cross-corpus evaluation, the authors reveal that standard biomedical text mining tools suffer significant performance drops when applied to datasets outside their training distribution, highlighting a critical robustness gap in the field.

What Problem Does This Paper Address?

The explosion of biomedical literature makes automated text mining (BTM) essential for researchers. The core of BTM is entity extraction, which consists of two steps:

  1. Named Entity Recognition (NER): Identifying mentions of entities like genes, diseases, or chemicals in raw text.
  2. Named Entity Normalization (NEN): Linking those mentions to a unique ID in a reference knowledge base (e.g., mapping "tumor protein p53" to NCBI Gene: 7157).

The problem is that most BTM tools are evaluated "in-corpus"—trained and tested on different parts of the same dataset. In practice, these tools are used "in the wild" on new text types (e.g., figure captions vs. abstracts) or sub-domains (e.g., plant biology vs. cancer research) they haven't seen before. This paper quantifies how much performance degrades in these cross-corpus settings and introduces a more robust solution.

The end-to-end entity extraction process: NER identifies mentions, and NEN maps them to standard identifiers in knowledge bases.

Methods

The authors introduce HunFlair2, an evolution of the original HunFlair tool. Its key technical improvements include:

  • Transformer-based Architecture: It replaces older RNN-based models with BioLink-BERT, a language model pre-trained specifically on biomedical document links.
  • Multi-task Learning: Instead of separate models for each entity type, HunFlair2 uses a single model trained on eight diverse corpora simultaneously to improve generalization.
  • Integrated Normalization: It incorporates state-of-the-art linking modules like BioSyn (for genes, diseases, and chemicals) and SapBERT (for species).

The study compares HunFlair2 against four other mature, publicly available tools: BERN2, PubTator, SciSpacy, and bent. The evaluation uses a strict cross-corpus protocol: no tool is tested on any data it was exposed to during training.

Overview of the five tools selected for the evaluation based on criteria like feature richness and availability.

Datasets

The evaluation focused on three publicly available corpora that represent different text types and entity distributions:

  • BioID: Figure captions, primarily used here for species (NCBI Taxonomy).
  • MedMentions: PubMed abstracts, used for chemicals and diseases (mapped to CTD).
  • tmVar (v3): PubMed abstracts, used for genes (NCBI Gene).
Table 2. Overview of basic information and statistics of the used evaluation corpora. For each data set we highlight the total number of entity mentions, the number of unique entities (Uniq.) and the knowledge base used to normalize the entities (in parenthesis). Note, we only highlight entity type from each data set that we leverage during our evaluation. † MedMentions originally uses UMLS for entity normalization, however, for compatibility with the evaluated tools we map the identifiers to CTD chemicals and CTD chemicals leveraging cross-reference tables and MESH identifiers.

Key Insights and Ideas

  • The "In the Wild" Performance Gap: The most striking finding is the massive drop in performance when moving from in-corpus to cross-corpus settings. For example, BERN2's F1 score for chemical extraction plummeted from a reported ~96% to just ~42% in this study.
  • Normalization is the Real Challenge: While NER performance is relatively stable, NEN (linking) is highly sensitive to context and entity distribution. The complexity of handling synonyms and homonyms across different sub-domains is the primary driver of performance loss.
  • The "Long Tail" Problem: Most tools perform well on frequently mentioned entities (like "mice" or "human") but struggle significantly with rare entities. Macro-F1 scores (which weigh every unique entity equally) were consistently much lower than micro-F1 scores.
  • Specialization vs. Generalization: PubTator remains the king of gene normalization due to its highly specialized GNormPlus component, but HunFlair2 provides better all-around performance across diverse entity types.

Key Results

  • HunFlair2 achieved the highest average F1 score (58.79%) across all tested entity types and corpora.
  • PubTator followed closely at 54.33%, showing particular strength in genes and species.
  • Ablation studies (Figure 2 in the paper) showed that using a "lenient" NER evaluation (allowing a 1-character boundary mismatch) significantly improves scores, suggesting that strict boundary matching might be an overly harsh metric for some real-world applications.
Table 3. Mention-level cross-corpus micro F1 for named entity extraction, i.e. end-to-end entity recognition and normalization. Note that, SciSpacy does not support the normalization of gene, so we can’t report result scores for this scenario. † Results including ChEBI annotations.
Table 4. We show the differences between in- and cross-corpus performances of biomedical entity extraction tools on the basis of the results reported by PubTator [116] and BERN2 [78]. Note that the in-corpus results examine the NEN components exclusively and not (as in our study) the end-to-end task of NER and NEN combined. For each tool and entity type we also provide the used evaluation corpus in parenthesis. Since the tools leverage different corpora for evaluation the results are not directly comparable, but they indicate the magnitude of the in-corpus, cross-corpus performance deviations. † Result represents accuracy scores.

Limitations and Future Work

  • Gene Normalization Scope: HunFlair2's gene normalization is currently limited to human genes, which hampered its performance on the gene-heavy tmVar dataset compared to PubTator.
  • Annotation Inconsistency: The authors noted that different corpora often have conflicting annotation guidelines (e.g., whether to include the word "gene" in a mention like "p53 gene"), which creates artificial "errors" during evaluation.
  • Future Directions: The field needs more research into making NEN modules robust to rare entities and better at handling cross-species ambiguity. The authors also suggest that ensembling different tools could potentially leverage their complementary strengths.

Summary updated

BibTeX
@misc{sanger2024hunflair,
  author = {Mario Sänger and Samuele Garda and Xing David Wang and Leon Weber-Genzel and Pia Droop and Benedikt Fuchs and Alan Akbik and Ulf Leser},
  title = {{HunFlair2 in a cross-corpus evaluation of biomedical named entity recognition and normalization tools}},
  year = {2024},
  eprint = {2402.12372},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.12372},
}
Figure