Recent studies have explored various approaches for treating candidate named entity spans as both source and target sequences in named entity recognition (NER) by leveraging large language models (LLMs). Although previous approaches have successfully generated candidate named entity spans with suitable labels, they rely solely on input context information when using LLMs, particularly, ChatGPT. However, NER inherently requires capturing detailed labeling requirements with input context information. To address this issue, we propose a novel method that leverages code-based prompting to improve the capabilities of LLMs in understanding and performing NER. By embedding code within prompts, we provide detailed BIO schema instructions for labeling, thereby exploiting the ability of LLMs to comprehend long-range scopes in programming languages. Experimental results demonstrate that the proposed code-based prompting method outperforms conventional text-based prompting on ten benchmarks across English, Arabic, Finnish, Danish, and German datasets, indicating the effectiveness of explicitly structuring NER instructions. We also verify that combining the proposed code-based prompting method with the chain-of-thought prompting further improves performance.
翻译:近期研究探索了多种方法,将候选命名实体跨度视为命名实体识别(NER)中的源序列和目标序列,并利用大语言模型(LLMs)进行处理。尽管先前方法已成功生成带有合适标签的候选命名实体跨度,但在使用LLMs(特别是ChatGPT)时,它们仅依赖于输入上下文信息。然而,NER本质上需要结合输入上下文信息来捕获详细的标注要求。为解决这一问题,我们提出了一种新颖的方法,利用基于代码的提示来增强LLMs在理解和执行NER任务中的能力。通过在提示中嵌入代码,我们为标注提供了详细的BIO模式指令,从而利用了LLMs在编程语言中理解长范围上下文的能力。实验结果表明,所提出的基于代码的提示方法在英语、阿拉伯语、芬兰语、丹麦语和德语数据集的十个基准测试中均优于传统的基于文本的提示方法,这表明显式结构化NER指令的有效性。我们还验证了将所提出的基于代码的提示方法与思维链提示相结合可进一步提升性能。