Multi-perspective Improvement of Knowledge Graph Completionwith Large Language Models

《利用大语言模型多方位改进知识图谱补全》

Derong Xu1,3, Ziheng Zhang2, Zhenxi Lin2, Xian Wu2*, Zhihong Zhu4, Tong Xu1*, Xiangyu Zhao3*, Yefeng Zheng2, Enhong Chen1 2024

  1. 通过改进实体、关系和结构数据来增强知识图谱补全.

实体关系结构的角度改进知识图谱的框架。蓝色代表实体名、红色代表关系名。


原始知识图谱 ==》增强后的知识图谱

1.实体增强:

  • "Ian Bryce" 的描述更详细。
  • "Michael Bay" 的描述增加了职业、成就和个人信息,并附带了合理性说明。

如何实现的实体合理扩写?

——CoT "Chain of Thought"(思维链)提示方法

举例:

2.关系理解增强:

  • Produced by(由……制作):
    • 将关系转换为动词形式,如“生产”,并用被动语态表示:“电影由……制作。”
  • Release region(发行地区):
    • 关系解释为电影发行的区域或国家,“关系表示电影发行的地区或国家……”
  • Place of birth(出生地):
    • 关系解释为表示某人出生的地理位置,可以提供关于其个人特征、文化背景和社会关系的宝贵背景信息。

3.结构增强:

  1. 关键词提取(Keyword Extraction):

    • 使用LLMs的能力从实体描述中提取关键词。这些关键词能够捕捉实体的主要特征和相关信息。
  2. 计算实体间的相似度(Calculating Similarity Between Entities):

    • 利用提取的关键词来计算不同实体之间的相似度。这通常涉及到比较不同实体关键词的交集,并据此分配一个相似度分数。
  3. 生成新的三元组(Generating New Triples):

    • 根据计算出的相似度分数,选择分数最高的实体对,生成新的三元组。这些三元组通常采用(head, Same As, tail)的格式,表示两个实体是相似或相同的。
  4. 添加自环三元组(Adding Self-loop Triples):

    • 为了增强模型对特定关系的学习,例如“SameAs”,在每个实体上添加自环三元组,即(head, Same As, head)
  5. 整合到知识图谱(Integration into Knowledge Graph):

    • 将生成的新三元组整合到知识图谱的训练集中,这样模型在训练时就可以学习到这些额外的结构信息。

  • 基于描述的预训练知识图谱补全模型:
  • KG-BERT
  • SimKGC(2022)
  • CSProm-KG(2023)
  • LMKE(2022)

这些模型利用改进后的知识图谱进行链接预测和三元组分类任务 ==》评估增强后的知识图谱在实际应用中的效果。


查询策略的模板:

(翻译过后):

使用的开源数据集:

三种大语言模型Prompt举例:

  1. 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]"

  2. ChatGLM2:

    • 实体描述、关系描述、关系句子和逆向表述的生成,使用的提示句子分别是:
       

      template = "Please provide all informations you know about " + name

       

      template = "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."

  3. GPT:

    • GPT 类的 qa 方法中直接使用了用户传入的 prompt,没有在代码中直接定义特定的提示句子。但是,它通过 OpenAI 的 API 将 prompt 发送给 GPT 模型,并获取回答。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值