Abstract
Named Entity Recognition (NER) models frequently struggle with data imbalance, as entities typically constitute a small fraction of any given corpus. While traditional methods like sub-sentence resampling or specialized loss functions attempt to mitigate this, they often disrupt the linguistic context essential for modern deep learning architectures. This paper introduces sentence-level resampling, a model-agnostic technique that oversamples entity-rich sentences during training. By preserving sentence structure, this method allows models like BERT to maintain contextual understanding while focusing on rare "needle-in-a-haystack" entities. Our results across four diverse domains show consistent improvements, particularly in specialized tasks where data is scarce.
The Challenge of Data Imbalance in NER
In standard NER datasets, named entities (e.g., names, locations, medical terms) are significantly outnumbered by "Other" tokens, which often make up 83% to 96% of the text. This imbalance encourages models to become "lazy" optimizers, achieving high nominal accuracy by over-predicting the majority class.
Existing solutions have notable drawbacks. Sub-sentence resampling—dropping non-entity tokens—destroys the natural flow of language, which is detrimental to models like BERT that rely on bidirectional context. Model-side fixes, such as Focal or Dice loss, can be difficult to optimize and often conflict with Conditional Random Field (CRF) layers.
Proposed Methodology: Sentence-Level Resampling
The authors propose four model-agnostic resampling functions that assign importance scores to sentences, allowing "informative" sentences to be presented more frequently during training without altering their content:
- sC (Smoothed Count): Weights sentences based on the raw number of entity tokens.
- sCR (Count + Rareness): Incorporates the "self-information" of entities, prioritizing sentences with rare entity types.
- sCRD (Count + Rareness + Density): Adjusts for sentence length, favoring short, entity-dense sentences.
- nsCRD (Normalized sCRD): Introduces a diminishing marginal utility factor to prevent a single sentence with many identical entities from dominating the weights.
Experimental Setup
The methods were tested across four domains to ensure generalizability: AnEM (medical), WNUT (social media), GMB subset (general), and CoNLL-2003 (news). The evaluation included three model architectures: Shallow models, Bi-LSTMs, and BERT, both with and without CRF output layers.
Key Results and Analysis
Sentence-level resampling consistently outperformed both the original corpus baselines and traditional imbalance-fix techniques.
Precision-Recall Dynamics
A critical finding is that resampling does not merely improve recall at the expense of precision. As shown in Figure 1, the proposed methods often move the performance vector toward the upper-right quadrant, indicating simultaneous gains in both metrics for architectures like BERT.
Performance on Specialized Domains
The impact was most pronounced on small, specialized datasets. On the medical AnEM corpus, the sCR method significantly boosted BERT's performance, as detailed in Figure 6.
On the noisy WNUT dataset, BERT’s Macro-F1 score similarly jumped from 37.67 to 44.60 using the sCR method, demonstrating the robustness of the approach in difficult, low-resource environments.
Discussion
Context is Non-Negotiable
The study highlights that sub-sentence resampling is counterproductive for BERT. While simpler models might tolerate fragmented text, BERT requires full sentence structure to generate meaningful embeddings. Sentence-level resampling provides the necessary balance while keeping syntax intact.
Data-Side vs. Model-Side Fixes
The authors demonstrate that data-side resampling is generally more robust than model-side loss function modifications. Resampling is straightforward to implement, works well with CRF layers, and avoids the non-convex optimization challenges associated with Focal or Dice losses.
Limitations and Future Work
The primary trade-off for these gains is increased training time, as the "effective" training set size grows when sentences are repeated. Additionally, the benefits of resampling diminish on very large, well-balanced datasets like CoNLL-2003. Future research may explore combining importance-based resampling with semantic data augmentation techniques to further enhance model robustness in low-resource settings.
Summary updated