
摘要
本文提出了一种名为KnowCoder的大规模语言模型(LLM),通过代码生成实现通用信息抽取(UIE)。KnowCoder旨在开发一种统一的模式表示方法,使大规模语言模型能够轻松理解,并构建一个有效的学习框架,鼓励这些模型遵循模式并准确提取结构化知识。为了实现这一目标,KnowCoder引入了一种代码风格的模式表示方法,将不同的模式统一转换为Python类,从而以大规模语言模型友好的方式捕捉复杂的模式信息,例如UIE中任务之间的约束关系。我们进一步构建了一个涵盖超过30,000种知识类型的代码风格模式库,据我们所知,这是目前最大的UIE模式库。为了简化大规模语言模型的学习过程,KnowCoder包含了一个两阶段学习框架。该框架通过代码预训练增强其对模式的理解能力,并通过指令微调提高其遵循模式的能力。在约15亿条自动构建的数据上进行代码预训练后,KnowCoder已经展现出显著的泛化能力,在少样本设置下相比LLaMA2实现了49.8%的F1相对提升。经过指令微调后,KnowCoder在未见过的模式上表现出更强的泛化能力,在零样本设置和低资源设置下分别比现有最佳基线模型提升了12.5%和21.9%。此外,基于我们的统一模式表示方法,多种人工标注的数据集可以同时用于改进KnowCoder,在监督设置下实现了高达7.5%的显著提升。
代码仓库
ICT-GoKnow/KnowCoder
GitHub 中提及
基准测试
| 基准 | 方法 | 指标 |
|---|---|---|
| uie-on-ace-2004 | KnowCoder-7b-IE | F1 score: 86.2 |
| uie-on-ace-2005-eae | KnowCoder-7b-IE | F1 score: 70.3 |
| uie-on-ace-2005-ed | KnowCoder-7b-IE | F1 score: 74.2 |
| uie-on-ace-2005-ner | KnowCoder-7b-IE | F1 score: 86.1 |
| uie-on-ace-2005-re | KnowCoder-7b-IE | F1 score: 64.5 |
| uie-on-ade-corpus | KnowCoder-7b-IE | F1 score: 84.3 |
| uie-on-anatem | KnowCoder-7b-IE | F1 score: 86.4 |
| uie-on-bc2gm | KnowCoder-7b-IE | F1 score: 82.0 |
| uie-on-bc5cdr | KnowCoder-7b-IE | F1 score: 89.3 |
| uie-on-broad-twitter | KnowCoder-7b-IE | F1 score: 78.3 |
| uie-on-conll-2003 | KnowCoder-7b-IE | F1 score: 95.1 |
| uie-on-conll-2004 | KnowCoder-7b-IE | F1 score: 73.3 |
| uie-on-diann | KnowCoder-7b-IE | F1 score: 94.7 |
| uie-on-fabner | KnowCoder-7b-IE | F1 score: 82.9 |
| uie-on-findvehicle | KnowCoder-7b-IE | F1 score: 99.4 |
| uie-on-genia | KnowCoder-7b-IE | F1 score: 76.7 |
| uie-on-gids | KnowCoder-7b-IE | F1 score: 78.0 |
| uie-on-kbp37 | KnowCoder-7b-IE | F1 score: 73.2 |
| uie-on-mit-movie | KnowCoder-7b-IE | F1 score: 90.6 |
| uie-on-mit-restaurant | KnowCoder-7b-IE | F1 score: 81.3 |
| uie-on-multinerd | KnowCoder-7b-IE | F1 score: 96.1 |
| uie-on-ncbi-disease | KnowCoder-7b-IE | F1 score: 83.8 |
| uie-on-nyt | KnowCoder-7b-IE | F1 score: 93.7 |
| uie-on-ontonotes-5-0 | KnowCoder-7b-IE | F1 score: 88.2 |
| uie-on-scierc | KnowCoder-7b-IE | F1 score: 40.0 |
| uie-on-semeval-re | KnowCoder-7b-IE | F1 score: 66.3 |
| uie-on-wikiann | KnowCoder-7b-IE | F1 score: 87.0 |
| uie-on-wnut-2017 | KnowCoder-7b-IE | F1 score: 66.4 |