Introduction
While BERT and its domain-specific variants like BioBERT and SciBERT have achieved state-of-the-art performance in Natural Language Processing, their robustness remains a significant concern. Most research into adversarial attacks—deliberate attempts to deceive a model—has focused on text classification. However, Named Entity Recognition (NER), a sequence labeling task requiring the identification and categorization of specific entities (e.g., names, locations, or medical terms), presents a more complex challenge. This paper investigates whether these models truly understand linguistic context or if they primarily rely on memorizing entity lists encountered during training.
Methodology: Black-Box Adversarial Attacks
The researchers developed two "black-box" adversarial attack methods that do not require access to the model's internal parameters:
- Entity Context Attack: This method identifies non-entity words that are most influential to the model's prediction and replaces them with synonyms. To ensure human readability and semantic consistency, the authors employed Part-of-Speech (POS) filtering and a semantic similarity threshold using the Universal Sentence Encoder.
- Entity Attack: This involves replacing a correctly identified entity with another entity of the same category (e.g., substituting a well-known city with an obscure village).
These attacks are adaptive; the algorithm specifically targets changes that most effectively reduce the model's confidence, rather than introducing random noise.
Datasets
The study evaluated model performance across four diverse datasets covering general and specialized domains:
- General Domain: CoNLL-2003 (standard benchmark) and W-NUT 2017 (social media entities).
- Biomedical Domain: BC5CDR (chemicals and diseases) and the NCBI disease corpus.
Key Insights: Fragility and Memorization
The experimental results reveal several critical vulnerabilities in BERT-based NER models:
- The Memorization Trap: The "Entity Attack" achieved staggering success rates (89.5% to 99.4%). When a common entity was replaced by a rare one, the models almost universally failed to recognize it. This suggests that BERT models act more like sophisticated list-matchers than contextual reasoners.
- Contextual Fragility: In over 75% of successful context attacks, changing just one word—often a verb immediately adjacent to the entity—was sufficient to trigger a failure.
- Importance of Proximity: Analysis of the "important" words shows a high concentration of influence in the immediate vicinity of the entity.
- Robustness Floor: Interestingly, SciBERT (trained from scratch on scientific text) was more vulnerable than BioBERT (initialized with general BERT weights). This suggests that massive, diverse pre-training provides a "robustness floor" that domain-specific training from scratch might sacrifice.
Experimental Results
The attacks proved highly effective across all tested models:
- Context Attack Success: Models were fooled into incorrect predictions 20.2% to 42.2% of the time.
- Entity Attack Success: Success rates reached up to 99.4%, demonstrating a near-total reliance on entity memorization.
- Semantic Integrity: Human evaluation by linguistics experts confirmed that the adversarial examples remained largely acceptable and understandable, indicating that the attacks were not merely producing gibberish.
Limitations and Future Directions
While effective, the current attack generation faces hurdles such as word sense ambiguity and occasional grammatical shifts.
To improve NER robustness, the authors recommend exploring entity masking during fine-tuning—forcing the model to rely more on context—and curriculum learning, which introduces rarer and more difficult entities gradually during the training process. These strategies could help move models beyond simple memorization toward true linguistic understanding.
Summary updated