Abstract
Nested Named Entity Recognition (NER) presents a significant challenge due to overlapping entity boundaries and the high cost of data annotation. This paper proposes a novel framework for few-shot nested NER using In-Context Learning (ICL) powered by the EnDe (Entity Demo) retriever. By leveraging contrastive learning to select demonstrations based on semantic, boundary, and label similarities, the framework significantly improves the performance of Large Language Models (LLMs) on complex NER tasks without requiring extensive fine-tuning.
Introduction
Named Entity Recognition (NER) is a fundamental task in natural language processing, traditionally focused on identifying "flat" entities like names, dates, and locations. However, real-world text often contains nested entities, where one entity exists inside another (e.g., "[the [Chinese] GPE embassy in [France] GPE] Facility").
Training effective models for nested NER typically requires massive amounts of annotated data. While Large Language Models (LLMs) can perform few-shot learning via In-Context Learning (ICL), their performance is highly sensitive to the choice of demonstration examples. Standard retrieval methods often focus solely on sentence-level semantic meaning, which fails to provide the structural and boundary-related guidance necessary for the intricate task of nested NER.
Methodology: The EnDe Retriever
The core contribution of this work is the EnDe retriever, a specialized mechanism designed to select the most effective examples for the LLM. Instead of random selection or simple semantic matching, the EnDe retriever employs contrastive learning to optimize for three distinct criteria:
- Semantic Similarity: Finding sentences that are topically similar to the test input.
- Boundary Similarity: This is a critical innovation for nested NER. The retriever uses linguistic features like Part-of-Speech (POS) tags and constituency trees (encoded via LSTMs and GCNs) to find examples with similar structural patterns. This helps the LLM understand where entities typically start, end, and overlap.
- Label Identification: A label-centric approach that ensures the retriever selects examples helping the model differentiate between entities that might have similar word representations but distinct labels.
The final prompt provided to the LLM (such as T5 or GPT-3.5) is structured to maximize clarity, consisting of a task instruction, the retrieved demonstrations (including explicit POS and constituency info), a label set, and the target testing sentence.
Experimental Setup
The researchers evaluated the framework across several nested and flat NER benchmarks:
- Nested NER: ACE2004, ACE2005, and GENIA.
- Flat NER: KBP2017, CoNLL, WNUT, and OntoNotes5.
- Settings: Performance was measured in 5-shot, 10-shot, and 20-shot scenarios to test the limits of low-data regimes.
Key Results and Insights
The framework consistently established a new State-of-the-Art (SOTA) across all three nested NER datasets. For instance, on the ACE2004 dataset in a 5-shot setting, the model achieved a 40.15 F1 score, significantly outperforming the previous best of 35.87.
Key Findings:
- Structure is Essential: Semantic similarity alone is insufficient for nested NER. Providing the model with examples that share similar syntactic structures (boundaries) is the "aha moment" that allows the LLM to resolve layered entities.
- Information Quality over Quantity: Simply increasing the number of examples (shots) yields diminishing returns. However, using the EnDe retriever to find the most informative examples provides a significant boost even with very few shots.
- LLM Scaling: The system showed a massive performance leap when moving from smaller models (T5-base) to larger ones (GPT-3.5), suggesting that a better retriever effectively unlocks the latent reasoning capabilities of massive LMs.
Conclusion and Future Work
This work demonstrates that specialized retrieval mechanisms can significantly enhance the few-shot capabilities of LLMs for complex structural tasks like nested NER. While the current method relies on external tools for POS tagging and constituency parsing, which may introduce preprocessing overhead, it provides a robust foundation for future research. Potential future directions include adapting this approach for discontinuous NER or relation extraction, where structural boundaries are equally critical.
Summary updated