CodeNER: Code Prompting for Named Entity Recognition

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Han, Sungwoo, Kim, Hyeyeon, Kwon, Jingun, Kamigaito, Hidetaka, Okumura, Manabu
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866914423607656448
author Han, Sungwoo
Kim, Hyeyeon
Kwon, Jingun
Kamigaito, Hidetaka
Okumura, Manabu
author_facet Han, Sungwoo
Kim, Hyeyeon
Kwon, Jingun
Kamigaito, Hidetaka
Okumura, Manabu
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2507_20423
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle CodeNER: Code Prompting for Named Entity Recognition
Han, Sungwoo
Kim, Hyeyeon
Kwon, Jingun
Kamigaito, Hidetaka
Okumura, Manabu
Computation and Language
Artificial Intelligence
I.2.7
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.
title CodeNER: Code Prompting for Named Entity Recognition
topic Computation and Language
Artificial Intelligence
I.2.7
url https://arxiv.org/abs/2507.20423