Abstract
Standard Transformer-based models for Named Entity Recognition (NER), such as BERT, are often limited by a fixed context window (typically 512 tokens), which can truncate vital information in long documents. This paper investigates whether retrieving "global" context—relevant sentences from anywhere in a document—is more effective for entity disambiguation than relying solely on the immediate "local" neighborhood. By evaluating several retrieval heuristics and an "Oracle" upper bound on a literary NER dataset, we demonstrate that global context consistently outperforms local context. Furthermore, we find that performance often peaks with the retrieval of a single, highly relevant sentence, as additional context can introduce confounding noise.
Introduction
Named Entity Recognition (NER) is a fundamental task in natural language processing, involving the identification and categorization of entities such as people, locations, and organizations. Modern models leverage self-attention mechanisms to understand an entity's type based on its surrounding text. However, the quadratic complexity of self-attention necessitates processing text in small chunks, creating a "context bottleneck" for long-form narratives like novels.
In such texts, an entity's category may be established far from its subsequent mentions. For instance, a character's introduction as a resident of a specific city might occur chapters before a brief mention of that city. Without access to that distant global context, a model may fail to correctly label the entity. This study explores whether models should prioritize better local context or leverage global retrieval strategies.
Methodology
The authors compared several heuristics for retrieving context sentences to augment a BERT-based NER model:
Local Heuristics
- Before/After: Retrieves the $k$ closest sentences to the left or right of the target.
- Surrounding: Retrieves the closest $k/2$ sentences on both sides.
Global Heuristics
- Random: Selects a random sentence from the document.
- Samenoun: Selects sentences sharing at least one common noun with the target sentence, increasing the likelihood of capturing the same entity.
- BM25: Utilizes a classic information retrieval algorithm to find linguistically similar sentences across the entire document.
The Oracle Approach
To determine the theoretical performance ceiling, the authors implemented an Oracle. This approach evaluates a pool of potential context sentences and selects only those that empirically improve the model's prediction, simulating a perfect re-ranking mechanism.
Experimental Setup and Datasets
The study utilized an enhanced version of the literary NER dataset by Dekker et al. (2019), comprising the first chapters of 40 English novels. While the original dataset focused solely on People (PER), the authors added annotations for Locations (LOC) and Organizations (ORG), resulting in a benchmark containing 4,476 PER, 886 LOC, and 201 ORG entities.
Key Insights and Results
Global Superiority
The experimental results indicate that global context is generally more valuable than local context for NER in long documents. The samenoun heuristic consistently outperformed the surrounding heuristic, suggesting that finding a sentence where an entity is clearly defined is more critical than proximity.
The Power of One and the Noise of Many
One of the most striking findings from the Oracle experiments is that performance peaks when retrieving just a single highly relevant sentence. As shown in the Oracle analysis, adding more sentences often introduces "noise" that confuses the model, leading to a decline in F1 scores as the number of retrieved sentences increases.
Distance and Relevance
Analysis of the Oracle's selections revealed that distance is a poor proxy for relevance. Only 8-16% of the most helpful context sentences were located within a 6-sentence radius of the target. Furthermore, restricting the BM25 search to exclude the local neighborhood resulted in negligible performance drops, implying that high-quality global information can effectively substitute for local context.
Conclusion
This research highlights the significant potential of global context retrieval for improving NER in long-form text. While simple heuristics like samenoun provide measurable gains over standard BERT baselines, the massive gap between these heuristics and the Oracle suggests a need for more sophisticated re-ranking models. Future work should explore dense retrieval methods and investigate how multiple context sentences might interact to provide even richer disambiguation signals.
Summary updated