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.
翻译:近期研究探索了多种利用大型语言模型将候选命名实体跨度同时作为源序列和目标序列进行命名实体识别的方法。尽管已有方法成功生成了带标签的候选命名实体跨度,但在使用大型语言模型(尤其是ChatGPT)时,这些方法仅依赖输入上下文信息。然而,命名实体识别本质上需要结合输入上下文信息来捕捉细粒度标签标注需求。为解决这一问题,我们提出了一种基于代码提示的新方法,以增强大型语言模型理解与执行命名实体识别任务的能力。通过在提示中嵌入代码,我们提供了用于标注的详细BIO模式指令,从而利用大型语言模型理解编程语言长距离作用域的能力。实验结果表明,本文提出的代码提示方法在涵盖英语、阿拉伯语、芬兰语、丹麦语和德语数据集的十个基准测试中均优于传统文本提示方法,证明了显式结构化命名实体识别指令的有效性。我们还验证了将所提代码提示方法与思维链提示相结合可进一步优化性能。