Skip to main content
QUICK REVIEW

[论文解读] CodeIE: Large Code Generation Models are Better Few-Shot Information Extractors

Peng Li, Tianxiang Sun|arXiv (Cornell University)|May 9, 2023
Topic ModelingComputer Science被引用 9
一句话总结

CodeIE 将 NER 和 RE 重 formulated 成 代码生成 任务,并 使用 带 代码 风格 提示 的 Code-LLMs 实现 相较 于 UIE 和 NL-LLMs 的少量样本 IE 更优的性能;在测试配置中,带 代码 提示 的 Codex 取得最佳结果。

ABSTRACT

Large language models (LLMs) pre-trained on massive corpora have demonstrated impressive few-shot learning ability on many NLP tasks. A common practice is to recast the task into a text-to-text format such that generative LLMs of natural language (NL-LLMs) like GPT-3 can be prompted to solve it. However, it is nontrivial to perform information extraction (IE) tasks with NL-LLMs since the output of the IE task is usually structured and therefore is hard to be converted into plain text. In this paper, we propose to recast the structured output in the form of code instead of natural language and utilize generative LLMs of code (Code-LLMs) such as Codex to perform IE tasks, in particular, named entity recognition and relation extraction. In contrast to NL-LLMs, we show that Code-LLMs can be well-aligned with these IE tasks by designing code-style prompts and formulating these IE tasks as code generation tasks. Experiment results on seven benchmarks show that our method consistently outperforms fine-tuning moderate-size pre-trained models specially designed for IE tasks (e.g., UIE) and prompting NL-LLMs under few-shot settings. We further conduct a series of in-depth analyses to demonstrate the merits of leveraging Code-LLMs for IE tasks.

研究动机与目标

  • 通过利用代码输出和 Code-LLMs,推动大模型的少样本信息提取(IE)。
  • 提出一个 NER 和 RE 的代码生成功能化形式,使其与 Code-LLMs 的预训练相对齐。
  • 证明在少样本设置下,带代码风格提示的 Code-LLMs 超越微调 IE 模型和 NL-LLMs。
  • 提供关于格式一致性与模型保真度的分析,以解释性能提升。

提出的方法

  • 将 NER 输出形式化为包含键 'text' 与 'type' 的 Python 字典组成的列表。
  • 将 RE 输出形式化为包含键 'rel_type','ent1_type','ent1_text','ent2_type','ent2_text' 的 Python 字典组成的列表。
  • 将输入 x 包装为包含文档字符串的 Python 函数,并使用空列表来收集输出;提示 Code-LLMs 将字典追加到该列表中。
  • 通过将若干 (x^c, y^c) 对作为演示拼接在测试提示前,来进行上下文演示。
  • 在少样本设置中使用 Code-LLMs(Codex)和 NL-LLMs(GPT-3)对提示进行测试,提示形式既有代码风格也有自然语言。
  • 分析结构保真性、格式一致性和语义保真度,以理解性能提升。

实验结果

研究问题

  • RQ1Code-LLMs 是否能够在少样本设置下通过代码风格提示有效完成 NER 和 RE?
  • RQ2对于同一 LLM,代码格式输出是否比文本格式输出更符合其预训练,从而减少结构性错误?
  • RQ3在少样本 IE 任务中,Code-LLMs 是否优于 NL-LLMs 和微调 IE 模型?
  • RQ4哪些因素(格式一致性、保真度)对 CodeIE 的性能提升贡献最大?

主要发现

  • 在七个 IE 基准任务上,带代码提示的 Code-LLMs 相较于 UIE(微调 IE 模型)和 NL-LLMs,在少样本设置下表现更优。
  • 对同一 LLM,代码提示比文本提示带来更好的性能,表明格式(代码风格)推动了超出提示内容的提升。
  • 在相似提示情况下,Codex(Code-LLM)通常优于 GPT-3(NL-LLM),在 NER 与 RE 任务中均有优势。
  • 代码提示展现出更高的输出结构保真性,结构性错误接近为零,相较于文本提示。
  • CodeIE 结合 Codex 与 代码提示,在基准测试中取得最佳平均结果,在少样本设置下明显优于强基线。
  • 代码预训练对齐和更高保真度有助于提升少样本 IE 的性能。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。