《Similarity-based Memory Enhanced Joint Entity and Relation Extraction》论文阅读笔记
代码
原文
摘要
文档级联合实体和关系抽取是一项难度很大的信息抽取任务,它要求用一个神经网络同时完成四个子任务,分别是:提及检测、共指消解、实体分类和关系抽取。目前的方法大多采用顺序的多任务学习方式,这种方式将任务任意分解,使得每个任务只依赖于前一个任务的结果,而忽略了任务之间可能存在的更复杂的相互影响。为了解决这些问题,本文提出了一种新的多任务学习框架,设计了一个统一的模型来处理所有的子任务,该模型的工作流程如下:首先,识别出文本中的实体提及,并将它们聚合成共指簇;其次,为每个实体簇分配一个合适的实体类型;最后,在实体簇之间建立关系。图 1 给出了一个来自 DocRED 数据集的文档示例,以及模型期望输出的实体簇图。为了克服基于流水线的方法的局限性,在模型中引入了双向的记忆式依赖机制,使得各个子任务能够相互影响和提升,从而更有效地完成联合任务。

模型架构

该方法受到了 JEREX 的启发,由四个任务特定的组件组成:提及抽取(
)、共指消解(
)、实体抽取(
)和关系抽取(
)。与原来的流水线式架构不同,这里引入了图 2 所示的记忆模块,使得各个组件的输入表示能够通过基于记忆的扩展表示模块进行更新。该模块使用 Memory Read 操作从记忆矩阵
和
中读取信息,这两个矩阵分别由实体和关系分类器写入。这样,各个组件之间就形成了双向的信息交互,从而更有效地完成联合任务。






Memory reading
该方法与 TriMF 类似,都是利用注意力机制,将输入表示与从记忆中读取的信息相结合,得到扩展的表示。如图 2 所示,本文的架构对两种输入表示进行了扩展:一种是词嵌入
,另一种是提及候选的跨度表示
。对于每一种输入表示
(
),以及每一种记忆矩阵
(
),注意力机制将输入表示
作为键和值,其中
是表示向量的个数,
是嵌入的维度。









作为查询,注意力机制使用记忆矩阵
,其中
是记忆槽的个数,
是记忆槽的维度。为了计算注意力权重向量
,对记忆槽的维度求和,公式如下:





其中
是注意力机制的可学习参数矩阵,
是
的第
个记忆槽。然后,
向量用于对
进行加权,得到扩展的输入表示
:








对于每一种输入表示
,记忆读取操作基于两种记忆矩阵生成两种扩展表示
和
。最终的扩展表示是通过对
和
求逐元素平均值得到的。





Memory writing








给定实体对
的表示向量
,它的关系类型的存在概率如下:



定义
为实例表示
和记忆矩阵
之间的双线性相似度,形式如下:




其中
是一个可学习的参数矩阵。对于实体和关系分类器,分别使用了不同的双线性相似度权重矩阵:
和
,其中
和
是实体和实体对表示的维度。
和
是实体和关系记忆矩阵的记忆槽的维度。在这里,记忆矩阵的记忆槽的数量与分类器的类别的数量相同。







Training
最后,模型被训练优化关节损失
,该关节包含与JEREX中相同的四个子任务相关的损失
,并以固定的任务相关权值
加权:




本文还纳入了TriMF中提出的两阶段训练方法,在超参数搜索过程中调整记忆预热比例。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 实操Deepseek接入个人知识库
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· 易语言 —— 开山篇