Abstract
Named Entity Recognition (NER) is traditionally framed as a sequence labeling task, which often struggles in low-data, few-shot scenarios due to the discrepancy between pre-training objectives and fine-tuning requirements. We present InstructionNER, a generative framework that reformulates NER as a multi-task instruction-following problem. By utilizing natural language instructions and candidate entity options within a T5-based architecture, InstructionNER bridges the gap between pre-training and downstream tasks. Our approach incorporates auxiliary tasks—entity extraction and entity typing—to enhance boundary detection and semantic understanding. Experimental results across multiple benchmarks demonstrate that InstructionNER significantly outperforms state-of-the-art baselines in few-shot settings, achieving up to a 22.7% F1 improvement on the MIT Movie dataset.
Introduction
Named Entity Recognition (NER) involves identifying and categorizing entities such as persons, locations, or organizations within text. Traditionally, this is treated as a sequence labeling problem where models like BERT assign a specific tag (e.g., B-PER, I-LOC) to every token. While effective with abundant labeled data, this paradigm faces significant hurdles in "few-shot" settings.
A primary issue is the "objective gap": modern language models are pre-trained on natural language text (e.g., predicting the next word), but fine-tuned on abstract, non-linguistic tags. This misalignment prevents models from fully leveraging their latent knowledge when data is scarce. InstructionNER addresses this by reframing NER as a natural language generation task guided by explicit instructions, allowing the model to "speak" its answers in a format closer to its pre-training.
Methodology
The Instruction-Based Prompt
InstructionNER transforms the input into a structured prompt consisting of three components:
- Sentence: The raw input text (e.g., "Dante was born in Florence").
- Instruction: A natural language command (e.g., "please extract entities and their types...").
- Options: A list of candidate entity types (e.g., "person, location, institution").
Including the "Options" field is critical as it acts as a constraint, reminding the model of the relevant categories and preventing the hallucination of non-existent types.
Generative Architecture
Unlike traditional encoders that output tag probabilities, InstructionNER utilizes a generative T5 (Text-to-Text Transfer Transformer) model. The model is trained to generate a natural language response, such as: "Dante is a person, Florence is a location." This generative approach aligns the task with the model's pre-training objective of span prediction and text generation.
Multi-Task Auxiliary Learning
To improve robustness, the authors introduce two auxiliary tasks that decouple the complexities of NER:
- Entity Extraction (EE): The model identifies entity boundaries without assigning types, focusing purely on span detection.
- Entity Typing (ET): Given specific entity names, the model predicts their categories, focusing on semantic classification.
By training on these tasks alongside the main NER objective, the model learns to better distinguish between finding an entity's boundaries and understanding its semantic type.
Experimental Results
The framework was evaluated on several standard benchmarks, including CoNLL-2003, MIT Movie, MIT Restaurant, and ATIS, with a focus on 10, 20, and 50-shot scenarios.
Key Findings
- Significant Few-Shot Gains: InstructionNER consistently outperformed baselines. On the MIT Movie dataset with only 10 examples, it achieved a 64.4% F1 score, a 22.7% improvement over the previous state-of-the-art, LightNER.
- Bridging the Pre-training Gap: The generative formulation allows the model to utilize latent knowledge more effectively than abstract tagging, especially when data is limited.
- Transferability: In cross-domain experiments, InstructionNER showed superior zero-shot and few-shot transfer capabilities compared to traditional sequence labeling methods.
- Model Selection: T5 was found to be more effective than BART for this specific task, likely due to its pre-training objective being more naturally aligned with text extraction.
Discussion and Limitations
Despite its performance, InstructionNER has limitations. Because it generates text token-by-token using beam search, inference is significantly slower than traditional sequence labeling models. Additionally, for datasets with a high number of entity types (e.g., ATIS with 79 types), the "Options" list can become excessively long, potentially diluting model focus or exceeding input limits. Finally, the balance between main and auxiliary tasks requires careful tuning, as over-weighting auxiliary tasks can degrade main task performance.
Conclusion
InstructionNER demonstrates that reframing NER as an instruction-following generative task significantly enhances performance in data-scarce environments. By bridging the gap between pre-training and fine-tuning and leveraging multi-task learning, it provides a powerful new direction for few-shot information extraction.
Summary updated