Skip to main content
QUICK REVIEW

[论文解读] KnowCoder: Coding Structured Knowledge into LLMs for Universal Information Extraction

Zixuan Li, Yutao Zeng|arXiv (Cornell University)|Mar 12, 2024
Natural Language Processing Techniques被引用 5
一句话总结

KnowCoder 引入了一种代码风格的架构表示以及一个两阶段学习框架,用于与大语言模型进行通用信息提取,在少样本、零样本和有监督设置下,在命名实体识别(NER)、关系抽取(RE)和事件抽取(EE)任务上表现强劲。

ABSTRACT

In this paper, we propose KnowCoder, a Large Language Model (LLM) to conduct Universal Information Extraction (UIE) via code generation. KnowCoder aims to develop a kind of unified schema representation that LLMs can easily understand and an effective learning framework that encourages LLMs to follow schemas and extract structured knowledge accurately. To achieve these, KnowCoder introduces a code-style schema representation method to uniformly transform different schemas into Python classes, with which complex schema information, such as constraints among tasks in UIE, can be captured in an LLM-friendly manner. We further construct a code-style schema library covering over $ extbf{30,000}$ types of knowledge, which is the largest one for UIE, to the best of our knowledge. To ease the learning process of LLMs, KnowCoder contains a two-phase learning framework that enhances its schema understanding ability via code pretraining and its schema following ability via instruction tuning. After code pretraining on around $1.5$B automatically constructed data, KnowCoder already attains remarkable generalization ability and achieves relative improvements by $ extbf{49.8%}$ F1, compared to LLaMA2, under the few-shot setting. After instruction tuning, KnowCoder further exhibits strong generalization ability on unseen schemas and achieves up to $ extbf{12.5%}$ and $ extbf{21.9%}$, compared to sota baselines, under the zero-shot setting and the low resource setting, respectively. Additionally, based on our unified schema representations, various human-annotated datasets can simultaneously be utilized to refine KnowCoder, which achieves significant improvements up to $ extbf{7.5%}$ under the supervised setting.

研究动机与目标

  • 开发一个统一、面向LLM的架构表示,用以捕捉复杂的UIE知识(分类法、约束和后处理)。
  • 构建一个覆盖万余概念的大规模代码风格架构库,来自Wikidata。
  • 提出一个两阶段学习框架以提升架构理解(代码预训练)和架构跟随(指令微调)。
  • 在多种数据场景(少样本、零样本、低资源、有监督)下,展示在 NER、RE、EE 任务上的强泛化和性能提升。
  • 公开架构库、数据、代码和模型以促进进一步研究。

提出的方法

  • 引入一种代码风格的架构表示:Entity、Relation、Event 类,具有用于分类法的类继承、约束的类型提示、定义的类注释,以及用于后处理的类方法。
  • 从 Wikidata 构建一个大型代码风格架构库(包含超过 29k 实体类型、876 关系类型、519 事件类型)。
  • 两阶段学习框架:(i)通过对架构定义和实例代码的代码预训练来进行架构理解(大约 15 亿自动构建数据);(ii)通过对架构感知的提示和任务进行指令微调来实现架构跟随。
  • 通过人工标注的 IE 数据集进行精炼,以进一步提升各任务的性能。
  • 训练细节包括以 big-context LLaMA2-base-7B 作为骨干、架构导入策略,以及后阶段基于 LoRA 的参数高效微调。
  • 在 33 个 IE 数据集上对 NER、RE、EE 进行评估,比较多种基线和SOTA结果。

实验结果

研究问题

  • RQ1统一的代码风格架构表示能否使LLM理解并遵循多样化的UIE架构?
  • RQ2两阶段学习框架(代码预训练+指令微调)是否能提升对未见架构的泛化能力与UIE任务的表现?
  • RQ3在少样本、零样本、低资源和有监督设置下,KnowCoder 在 NER、RE、EE 的表现如何?
  • RQ4在使用统一架构库时,用人工标注的IE数据集对 KnowCoder 进行精炼的影响是什么?
  • RQ5大规模的代码风格架构库是否适用于同时使用多个IE数据集?

主要发现

模型电影休闲AI文学音乐政治科学平均
LLaMA2-7B31.019.630.824.128.038.744.130.9
LLaMA2-13B32.625.237.536.537.060.351.740.1
KnowCoder-7B (SU. only)37.236.441.842.653.860.651.646.3
  • KnowCoder 的代码风格架构表示支持对 29k+ 实体类型、876 种关系类型和 519 种事件类型的统一视图,并产生强大的 UIE 能力。
  • 在约 1.5B 自动标注数据用于代码预训练后,KnowCoder 在少样本 NER 中相对 F1 提升 49.8% 相对于 LLaMA2。
  • 经过指令微调,KnowCoder 在未见架构上的零样本和低资源泛化表现强劲,相对于基线的平均相对提升最高达 12.5%(零样本)和 21.9%(低资源)。
  • 经人工标注 IE 数据集的精炼,KnowCoder 在有监督设置下的IE任务中实现最多 7.5% 的绝对提升。
  • 在零样本结果中,KnowCoder-7B 以 SU-only 预训练在 NER 上达到 46.3 的平均 F1,显示出对 LLaMA2-7B 的显著提升,并在该设置下优于若干经过改进的基线。
  • 消融分析显示架构理解阶段和跟随阶段均有显著贡献;移除塑形阶段会降低性能,尤其是架构跟随步骤。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。