《利用大语言模型多方位改进知识图谱补全》
Derong Xu1,3, Ziheng Zhang2, Zhenxi Lin2, Xian Wu2*, Zhihong Zhu4, Tong Xu1*, Xiangyu Zhao3*, Yefeng Zheng2, Enhong Chen1 2024
- 通过改进实体、关系和结构数据来增强知识图谱补全.

从实体、关系和结构的角度改进知识图谱的框架。蓝色代表实体名、红色代表关系名。
原始知识图谱 ==》增强后的知识图谱
1.实体增强:
- "Ian Bryce" 的描述更详细。
- "Michael Bay" 的描述增加了职业、成就和个人信息,并附带了合理性说明。
如何实现的实体合理扩写?
——CoT "Chain of Thought"(思维链)提示方法
举例:
2.关系理解增强:
- Produced by(由……制作):
- 将关系转换为动词形式,如“生产”,并用被动语态表示:“电影由……制作。”
- Release region(发行地区):
- 关系解释为电影发行的区域或国家,“关系表示电影发行的地区或国家……”
- Place of birth(出生地):
- 关系解释为表示某人出生的地理位置,可以提供关于其个人特征、文化背景和社会关系的宝贵背景信息。

3.结构增强:
-
关键词提取(Keyword Extraction):
- 使用LLMs的能力从实体描述中提取关键词。这些关键词能够捕捉实体的主要特征和相关信息。
-
计算实体间的相似度(Calculating Similarity Between Entities):
- 利用提取的关键词来计算不同实体之间的相似度。这通常涉及到比较不同实体关键词的交集,并据此分配一个相似度分数。
-
生成新的三元组(Generating New Triples):
- 根据计算出的相似度分数,选择分数最高的实体对,生成新的三元组。这些三元组通常采用
(head, Same As, tail)的格式,表示两个实体是相似或相同的。
- 根据计算出的相似度分数,选择分数最高的实体对,生成新的三元组。这些三元组通常采用
-
添加自环三元组(Adding Self-loop Triples):
- 为了增强模型对特定关系的学习,例如“SameAs”,在每个实体上添加自环三元组,即
(head, Same As, head)。
- 为了增强模型对特定关系的学习,例如“SameAs”,在每个实体上添加自环三元组,即
-
整合到知识图谱(Integration into Knowledge Graph):
- 将生成的新三元组整合到知识图谱的训练集中,这样模型在训练时就可以学习到这些额外的结构信息。
- 基于描述的预训练知识图谱补全模型:
- KG-BERT
- SimKGC(2022)
- CSProm-KG(2023)
- LMKE(2022)
这些模型利用改进后的知识图谱进行链接预测和三元组分类任务 ==》评估增强后的知识图谱在实际应用中的效果。
查询策略的模板:
(翻译过后):

使用的开源数据集:

三种大语言模型Prompt举例:
-
LLAMA2:
- 在
querying_llm_fb15k237.py文件中,针对实体描述的生成,使用的提示句子是:template = f"\u003cs\u003e[INST] \u003c\u003cSYS\u003e\u003e \n You are a helpful, respectful and honest assistant. If you don't know the answer to a question, just replay: I don't know. \u003c\u003c/SYS\u003e\u003e \n" + \ f"Please provide all informations about " + name + ". Give the rationale before answering:[/INST] " - 关系描述的生成,使用的提示句子是:
template = f"\u003cs\u003e[INST] \u003c\u003cSYS\u003e\u003e \n You are a helpful, respectful and honest assistant. \u003c\u003c/SYS\u003e\u003e \n" + \ f"Please provide an explanation of the significance of the relation {text} in a knowledge graph with one sentence. [/INST]" - 关系句子和逆向表述的生成,使用的提示句子分别是:
template = f"\u003cs\u003e[INST] \u003c\u003cSYS\u003e\u003e \n You are a helpful, respectful and honest assistant. \u003c\u003c/SYS\u003e\u003e \n" + \ f"Please provide an explanation of the meaning of the triplet (head entity, {text}, tail entity) and rephrase it into a sentence. [/INST]"template = f"\u003cs\u003e[INST] \u003c\u003cSYS\u003e\u003e \n You are a helpful, respectful and honest assistant. \u003c\u003c/SYS\u003e\u003e \n" + \ f"Please convert the relation {text} into a verb form and provide a statement in the passive voice. [/INST]"
- 在
-
ChatGLM2:
- 实体描述、关系描述、关系句子和逆向表述的生成,使用的提示句子分别是:
template = "Please provide all informations you know about " + nametemplate = "Please provide an explanation of the significance of the relation {text} in a knowledge graph with one sentence."template = "Please provide an explanation of the meaning of the triplet (head entity, {text}, tail entity) and rephrase it into a sentence."template = "Please convert the relation {text} into a verb form and provide a statement in the passive voice."
- 实体描述、关系描述、关系句子和逆向表述的生成,使用的提示句子分别是:
-
GPT:
- GPT 类的
qa方法中直接使用了用户传入的prompt,没有在代码中直接定义特定的提示句子。但是,它通过 OpenAI 的 API 将prompt发送给 GPT 模型,并获取回答。
- GPT 类的
204

被折叠的 条评论
为什么被折叠?



