Scaling language models have revolutionized widespread NLP tasks, yet little comprehensively explored few-shot relation extraction with large language models. In this paper, we investigate principal methodologies, in-context learning and data generation, for few-shot relation extraction via GPT-3.5 through exhaustive experiments. To enhance few-shot performance, we further propose task-related instructions and schema-constrained data generation. We observe that in-context learning can achieve performance on par with previous prompt learning approaches, and data generation with the large language model can boost previous solutions to obtain new state-of-the-art few-shot results on four widely-studied relation extraction datasets. We hope our work can inspire future research for the capabilities of large language models in few-shot relation extraction. Code is available in https://github.com/zjunlp/DeepKE/tree/main/example/llm.
翻译:扩展语言模型已革新了广泛的自然语言处理任务,然而利用大语言模型进行少样本关系抽取仍缺乏全面探索。本文通过系统性实验,研究基于GPT-3.5的少样本关系抽取的两种主要方法——上下文学习与数据生成。为提升少样本性能,我们进一步提出任务相关指令与模式约束数据生成。实验表明,上下文学习可达到与先前提示学习方法相当的性能,而基于大语言模型的数据生成方法能驱动先前方案在四个广泛使用的关系抽取数据集上取得新的最优少样本结果。我们期望本研究能启发未来关于大语言模型在少样本关系抽取中能力的研究。代码见https://github.com/zjunlp/DeepKE/tree/main/example/llm。