CrossNER: Evaluating Cross-Domain Named Entity Recognition

Zihan Liu, Yan Xu, Tiezheng Yu, Wenliang Dai, Ziwei Ji, Samuel Cahyawijaya, Andrea Madotto, Pascale Fung

Abstract

Named Entity Recognition (NER) models often struggle when transitioning from a data-rich source domain to a data-scarce target domain. This paper introduces CrossNER, a multi-domain dataset with specialized entity types across five fields: Politics, Natural Science, Music, Literature, and Artificial Intelligence. We propose a Domain-Adaptive Pre-training (DAPT) strategy using span-level masking on curated, entity-focused corpora. Our results demonstrate that this approach significantly enhances performance in low-resource cross-domain scenarios, outperforming existing baselines and showing robustness even with minimal target-domain samples.

Introduction

Named Entity Recognition (NER) is a fundamental task in Natural Language Processing, yet models are notoriously brittle when applied outside their training distribution. A model trained on news articles (e.g., Reuters) often fails to generalize to niche domains like literature or AI research, where entities are more specialized and training data is scarce.

Existing benchmarks for cross-domain NER typically suffer from two main flaws: a lack of domain specificity (e.g., news vs. tech news) and a reliance on generic entity types (Person, Location, Organization). In specialized fields, distinguishing a "Scientist" from a "Politician" or an "Algorithm" from a "Product" is crucial. CrossNER addresses these gaps by providing a diverse, human-annotated dataset with domain-specific entity categories.

Methodology

The core of our approach is Domain-Adaptive Pre-training (DAPT). Rather than simple fine-tuning, we continue the pre-training of a model (like BERT) on unlabeled domain-specific text.

Span-level Masking

While standard BERT uses random token-level masking, we employ span-level masking. By masking contiguous sequences of words, the model is forced to predict entire phrases, which improves its grasp of entity boundaries and domain-specific terminology.

Corpus Filtering and Training Strategies

We evaluated four levels of corpus filtering for DAPT, finding that an "Integrated" corpus—weighted toward sentences containing specialized entities—yielded the best results. We also compared three training setups: directly fine-tuning on the target, pre-training on the source then fine-tuning on the target, and joint training on both.

Comparison of training strategies and masking levels across varying percentages of unlabeled corpus size.

The CrossNER Dataset

The CrossNER dataset uses CoNLL-2003 (Reuters News) as the source domain and introduces five target domains collected from Wikipedia: Politics, Natural Science, Music, Literature, and Artificial Intelligence. To simulate real-world constraints, the target training sets are intentionally small (100–200 samples), focusing the evaluation on low-resource performance.

Results and Analysis

Our proposed method (Span-level DAPT + Integrated Corpus) consistently established a new state-of-the-art across all five domains. Adding DAPT to existing high-performing models resulted in an average F1 score improvement of 2.16%.

Impact of Masking and Corpus Size

As shown in the experimental results, span-level masking consistently outperforms token-level masking across all training strategies. Furthermore, performance scales with the size of the unlabeled corpus used for DAPT, though the quality of the corpus (entity-richness) is a critical factor.

Robustness to Data Scarcity

A key finding is the effectiveness of DAPT in "few-shot" settings. Even with as few as 10 to 25 target-domain samples, the DAPT-enhanced models maintain significantly higher performance than those without adaptive pre-training.

F1-score performance across different numbers of target domain samples, comparing training strategies and masking levels.

Challenges in Domain Adaptation

Despite these gains, cross-domain NER remains challenging. We observed a "subcategory trap" where models misclassify specific entities as their general counterparts (e.g., labeling a "musical artist" as a generic "person"). In the music domain, 84.81% of "person" entities were misclassified as "artist" by our best model, highlighting the difficulty of hierarchical entity recognition.

Conclusion

CrossNER provides a rigorous benchmark for evaluating the transferability of NER models. Our findings suggest that what a model reads during adaptive pre-training is as important as how much it reads. Future work will explore more sophisticated masking strategies and automated corpus selection to further bridge the gap in cross-domain performance.

Summary updated

BibTeX
@inproceedings{liu2021crossner,
  author = {Zihan Liu and Yan Xu and Tiezheng Yu and Wenliang Dai and Ziwei Ji and Samuel Cahyawijaya and Andrea Madotto and Pascale Fung},
  title = {{CrossNER: Evaluating Cross-Domain Named Entity Recognition}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.1609/aaai.v35i15.17587},
}
Figure