Mitigating Out-of-Entity Errors in Named Entity Recognition: A Sentence-Level Strategy

Guochao Jiang, Ziqin Luo, Chengwei Hu, Zepeng Ding, Deqing Yang

TL;DR

Named Entity Recognition (NER) models often stumble when they encounter "Out-of-Entity" (OOE) words—tokens never seen during training. The proposed S+NER framework overcomes this by leveraging sentence-level context refined through contrastive learning with LLM-generated templates, setting new state-of-the-art benchmarks for OOE-heavy datasets.

What Problem Does This Paper Address?

Named Entity Recognition is the bread and butter of many NLP pipelines, tasked with identifying spans of text (like "Aurora Couture") and classifying them (as a "Brand"). However, these models have a major Achilles' heel: the Out-of-Entity (OOE) problem.

When a test sentence contains an entity made of words the model didn't see during training, performance craters. As shown in Figure 1, standard span-based models see their F1 scores drop sharply as the OOE rate increases. Most existing solutions try to fix this by using external dictionaries or character-level embeddings, but they often ignore the most powerful signal available: the sentence-level context. Intuitively, even if you've never heard of "Aurora Couture," the surrounding phrase "...aims to illuminate the fashion industry..." strongly hints that it's a brand.

Figure 1: The span-based NER models’ F1 scores on TwitterNER dataset with different OOE rates. The OOE rate is defined as the ratio of the test entities whose men- tion spans have the words (tokens) not appearing in the training set, to all entities in the test set. The numbers here are the results of deduplication, and duplicate enti- ties are not considered.

Methods

The authors introduce S+NER, a framework that treats sentence context as a first-class citizen. Its architecture consists of two main innovations:

  1. Sentence-Level Feature Integration: Unlike standard models that rely primarily on local span representations (boundary tokens and span length), S+NER concatenates a global sentence representation (generated by a BERT-based encoder) to the span features.
  2. Template-Based Contrastive Learning: To make this sentence representation truly useful for NER, the authors refine it using a contrastive learning strategy. They use GPT-4 to generate a set of natural language templates (e.g., "[SPAN] is a [TYPE] entity").
  3. Positive Templates: Filled with the correct entity and type (e.g., "Milan is a location entity").
  4. Negative Templates: Filled with incorrect types or non-entity labels (e.g., "Milan is not an entity").

During training, the model is pushed to make the actual sentence representation similar to the positive template representations and dissimilar to the negative ones. A template pooling method is used to aggregate information from multiple diverse templates, ensuring the model isn't over-fitted to a single phrasing.

Figure 2: The overall architecture of our proposed S+NER (better viewed in color), which has two major parts: the encoding layer and the label classifier. In the encoding layer fed with the input sentence X, the target span’s representation zi is obtained. In addition, the sentence representation of X, denoted as c, is originally generated by the BERT-based encoder, and then refined through the contrastive learning with the positive and negative template representations. Then, zi is concatenated with c and then fed into the classifier to predict the span’s label.

Datasets

The researchers evaluated S+NER on five benchmark datasets specifically chosen for their high OOE rates:

  • WNUT2017: A notoriously difficult dataset with a 100% OOE rate.
  • TwitterNER: Social media text with a 79% OOE rate.
  • JNLPBA: Biomedical text (67% OOE).
  • CoNLL2003-Typos: A variant of the classic benchmark with synthetic typos (86% OOE).
  • CoNLL2003-OOE: A variant partitioned to maximize unseen entities (96% OOE).

Table 1: Dataset Statistics (Note: Figure 1 also contains the OOE rate context; Table 1 details are in the text).

Figure 1: The span-based NER models’ F1 scores on TwitterNER dataset with different OOE rates. The OOE rate is defined as the ratio of the test entities whose men- tion spans have the words (tokens) not appearing in the training set, to all entities in the test set. The numbers here are the results of deduplication, and duplicate enti- ties are not considered.

Key Insights and Ideas

  • Context as a Compensator: The core "aha" moment is that while span-level embeddings for OOE words are "cold" (untrained), the sentence-level context is often composed of common words that the model understands well. By aligning these, the model can "guess" the entity type from the surrounding syntax and semantics.
  • LLMs as Semantic Teachers: Instead of manually writing a few templates, using an LLM like GPT-4 to generate 100 diverse templates provides a much richer signal for contrastive learning.
  • Model Agnostic: The ablation studies show that S+NER's strategy works regardless of the underlying encoder (BERT, RoBERTa, or DeBERTa), proving it's a generalizable strategy for improving robustness.

Key Results

S+NER achieved significant performance gains over previous state-of-the-art (SOTA) models like MINER and DSpERT:

  • Superior Accuracy: S+NER outperformed all baselines on 4 out of 5 datasets. On the 100% OOE WNUT2017 dataset, it achieved an F1 of 58.27, a nearly 3-point jump over the previous best.
  • Average Performance: Across all five datasets, S+NER reached an average F1 of 78.69, compared to 74.78 for DSpERT and 74.39 for MINER.
  • Robustness: As the OOE rate climbs toward 100%, S+NER maintains a higher performance floor than its competitors, demonstrating its effectiveness in "zero-shot" entity recognition scenarios.
Table 2: Overall performance comparisons between our S+NER and the baselines on the five datasets.

Limitations and Future Work

The authors identify one primary limitation: Domain Sensitivity. The framework relies on the Pre-trained Language Model's (PLM) ability to understand the sentence context. If the model is applied to a highly specialized professional field (like advanced law or niche proteomics) that wasn't well-represented in its pre-training corpus, the sentence representations might not be descriptive enough.

Future Work involves exploring domain-specific fine-tuning or re-pre-training the encoder on specialized corpora to ensure the "sentence-level strategy" remains effective even in highly technical domains.

Summary updated

BibTeX
@inproceedings{jiang2025mitigating,
  author = {Guochao Jiang and Ziqin Luo and Chengwei Hu and Zepeng Ding and Deqing Yang},
  title = {{Mitigating Out-of-Entity Errors in Named Entity Recognition: A Sentence-Level Strategy}},
  booktitle = {International Conference on Computational Linguistics},
  year = {2025},
}
Figure