llmNER: (Zero|Few)-Shot Named Entity Recognition, Exploiting the Power of Large Language Models

Fabián Villena,Luis Miranda,Claudio Aracena
2024-06-07
Abstract:Large language models (LLMs) allow us to generate high-quality human-like text. One interesting task in natural language processing (NLP) is named entity recognition (NER), which seeks to detect mentions of relevant information in documents. This paper presents llmNER, a Python library for implementing zero-shot and few-shot NER with LLMs; by providing an easy-to-use interface, llmNER can compose prompts, query the model, and parse the completion returned by the LLM. Also, the library enables the user to perform prompt engineering efficiently by providing a simple interface to test multiple variables. We validated our software on two NER tasks to show the library's flexibility. llmNER aims to push the boundaries of in-context learning research by removing the barrier of the prompting and parsing steps.
Computation and Language
What problem does this paper attempt to address?
The main goal of this paper is to develop a Python library named `llmNER` for zero-shot and few-shot Named Entity Recognition (NER) based on large language models (LLMs). Specifically, the paper aims to address the following key issues: 1. **Simplifying the Prompting and Parsing Steps in Zero-Shot and Few-Shot Learning**: Designing effective prompts and correctly parsing the results returned by the model is often a very challenging task when utilizing large language models for in-context learning (ICL). The paper addresses this issue by proposing the `llmNER` library, which encapsulates these steps, making it easier for users to perform NER tasks. 2. **Improving the Flexibility and Efficiency of Named Entity Recognition Tasks**: The paper proposes a flexible interface that allows users to easily experiment with different prompting methods, answer shape parsers, and part-of-speech (POS) enhancement strategies. This helps to improve NER performance in zero-shot and few-shot learning scenarios. 3. **Validating the Effectiveness and Flexibility of the Library**: To demonstrate the functionality and effectiveness of the `llmNER` library, the authors conducted experiments on two public datasets—CoNLL 2003 for English and CoNLL 2002 for Spanish. These experiments not only showcase the library's applicability to different languages but also compare the effectiveness of various prompting methods and answer parsing strategies. 4. **Advancing Research in In-Context Learning**: By lowering the technical barriers of prompting and parsing steps, the `llmNER` library aims to promote the application of in-context learning in the field of natural language processing, especially in scenarios that require rapid prototyping or pre-annotation tasks. In summary, this paper focuses on how to leverage the in-context learning capabilities of large language models to simplify and accelerate named entity recognition tasks, and supports this goal by developing a practical tool.