paper: Deep Joint Entity Disambiguation with Local Neural Attention
https://github.com/dalab/deep-ed
文章目录:
Contributions and Related Work
Local Model with Neural Attention
Abstract
-
创新点:提出了一个基于深度学习的文档级别的实体消歧模型。
- Entity embedding
- 考虑上下文的attention机制
- 用于消除歧义的联合推理(就是使用联合概率模型)
-
实验表现:在适当的算力代价下,取得了最好的表现
Introduction
- 什么是实体链接? 所谓实体链接就是将文本的mention指向现有知识库中已存在实体的过程。如为匹配到实体,标记为NIL。
- 实体连接三个模块(该论文主要介绍候选实体排序):
- 候选实体生成
- 候选实体排序
- 无法链接预测
- 候选实体如何排序?
- 局部实体消歧:关注上下文窗口范围内的文本信息
- 全局实体消歧:关注整个文档中实体间的一致性
Contributions and Related Work
这里简单提及模型用到的相关技术
- Entity Embedding
- 参考word2vec的word嵌入和某某的entity嵌入,但有所区别
- 区别:不用知道实体间的共现次数,通过实体页面和超链接标注的上下文内容
- 使用的是预训练的word和entity嵌入
- Context Attention(局部模型)
- 重点关注上下文中,对消歧决策提供信息的words
- Collective Disambiguation(全局模型)
- 使用条件随机场(CRF),由于是NP-hard问题,优化为循环信念传播(LBP)【这块说实话较为难懂】
Learning Entity Embeddings
这部分是介绍如何进行嵌入
-
这部分我先不写;由于自己也没太搞明白这里的公式
Local Model with Neural Attention
这里就是局部模型的讲解
- 橙色框表示:可学习的嵌入矩阵A,B
- 红色框从左至右分别表示:word embedding和entity embedding
大致流程(可以结合图看):
- Mention-entity 先验 : p ^ ( e ∣ m ) \hat{p}(e \mid m) p^(e∣m)
- 每个mention生成的候选实体集合: Γ ( m ) \Gamma(m) Γ(m), 每个mention对应上下文词的集合: c c c
- 计算上下文中每个词的得分: u ( w ) = max e ∈ Γ ( m ) x e ⊤ A x w u(w)=\max _{e \in \Gamma(m)} \mathbf{x}_{e}^{\top} \mathbf{A} \mathbf{x}_{w} u(w)=maxe∈Γ(m)xe⊤Axw
- 计算完后裁剪,得到 t o p R topR topR得分最高的词: c ˉ = { w ∈ c ∣ u ( w ) ∈ to p R ( u ) } \bar{c}=\{w \in c \mid u(w) \in \operatorname{to} p R(\mathbf{u})\} cˉ={w∈c∣u(w)∈topR(u)}
- 使用softmax attention 权重: β ( w ) = { exp [ u ( w ) ] ∑ v ∈ c ˉ exp [ u ( v ) ] if w ∈ c ˉ 0 otherwise \beta(w)=\left\{\begin{array}{ll}\frac{\exp [u(w)]}{\sum_{v \in \bar{c}} \exp [u(v)]} & \text { if } w \in \bar{c} \\ 0 & \text { otherwise }\end{array}\right. β(w)={∑v∈cˉexp[u(v)]exp[u(w)]0 if w∈cˉ otherwise
- 计算实体和mention上下文的得分: Ψ ( e , c ) = ∑ w ∈ c ˉ β ( w ) x e ⊤ B x w \Psi(e, c)=\sum_{w \in \bar{c}} \beta(w) \mathbf{x}_{e}^{\top} \mathbf{B} \mathbf{x}_{w} Ψ(e,c)=∑w∈cˉβ(w)xe⊤Bxw
- 最终拼接先验的得分: Ψ ( e , m , c ) = f ( Ψ ( e , c ) , log p ^ ( e ∣ m ) ) \Psi(e, m, c)=f(\Psi(e, c), \log \hat{p}(e \mid m)) Ψ(e,m,c)=f(Ψ(e,c),logp^(e∣m))
损失函数构造:
- 使得正确的得分尽可能高,错误的得分尽可能低
θ
∗
=
arg
min
θ
∑
D
∈
D
∑
m
∈
D
∑
e
∈
Γ
(
m
)
g
(
e
,
m
)
\theta^{*}=\arg \min _{\theta} \sum_{D \in \mathcal{D}} \sum_{m \in D} \sum_{e \in \Gamma(m)} g(e, m)
θ∗=argminθ∑D∈D∑m∈D∑e∈Γ(m)g(e,m)
g
(
e
,
m
)
:
=
[
γ
−
Ψ
(
e
∗
,
m
,
c
)
+
Ψ
(
e
,
m
,
c
)
]
+
g(e, m):=\left[\gamma-\Psi\left(e^{*}, m, c\right)+\Psi(e, m, c)\right]_+
g(e,m):=[γ−Ψ(e∗,m,c)+Ψ(e,m,c)]+
Document-Level Deep Model
-
每个文档包含的mention : m = m 1 , m 2 , . . . m n m = m_1,m_2,...m_n m=m1,m2,...mn,每个mention对应的上下文词 : c = c 1 , c 2 , . . . c n c=c_1, c_2,...c_n c=c1,c2,...cn
-
定义联合概率分布,通过计算边缘概率为文档中的每个mention选择一个entity Γ ( m 1 ) × … × Γ ( m n ) ∋ e \Gamma\left(m_{1}\right) \times \ldots \times \Gamma\left(m_{n}\right) \ni \mathbf{e} Γ(m1)×…×Γ(mn)∋e
- 边缘概率:对无关变量求和或者积分
使用CRF模型
-
定义: g ( e , m , c ) = ∑ i = 1 n Ψ i ( e i ) + ∑ i < j Φ ( e i , e j ) g(\mathbf{e}, \mathbf{m}, \mathbf{c})=\sum_{i=1}^{n} \Psi_{i}\left(e_{i}\right)+\sum_{i<j} \Phi\left(e_{i}, e_{j}\right) g(e,m,c)=∑i=1nΨi(ei)+∑i<jΦ(ei,ej), 目的是最大化 g ( e , m , c ) g(\mathbf{e}, \mathbf{m}, \mathbf{c}) g(e,m,c),所谓的找到得分最高的实体。
- 其中: Φ ( e , e ′ ) = 2 n − 1 x e ⊤ C x e ′ \Phi\left(e, e^{\prime}\right)=\frac{2}{n-1} \mathbf{x}_{e}^{\top} \mathbf{C} \mathbf{x}_{e^{\prime}} Φ(e,e′)=n−12xe⊤Cxe′
-
由于训练和预测CRF模型是一个NP-hard问题(复杂度呈指数增长),使用循环信念神经网络【LBP】(在较低的复杂度下获得原问题的近似解)。
-
针对论文中所提到的信念网络以及消息传递(message passing),结点间具体如何进行消息传递,可以参考以下文章,个人觉得说的还可以了
橙色框表示:局部得分
红色框表示:全局得分
消息更新规则
-
m
i
→
j
t
+
1
(
e
)
=
max
e
′
∈
Γ
(
m
i
)
{
Ψ
i
(
e
′
)
+
Φ
(
e
,
e
′
)
+
∑
k
≠
j
m
ˉ
k
→
i
t
(
e
′
)
}
\begin{aligned} m_{i \rightarrow j}^{t+1}(e)=\max _{e^{\prime} \in \Gamma\left(m_{i}\right)} &\left\{\Psi_{i}\left(e^{\prime}\right)+\Phi\left(e, e^{\prime}\right)\right.\\ &\left.+\sum_{k \neq j} \bar{m}_{k \rightarrow i}^{t}\left(e^{\prime}\right)\right\} \end{aligned}
mi→jt+1(e)=e′∈Γ(mi)max{Ψi(e′)+Φ(e,e′)+k=j∑mˉk→it(e′)⎭⎬⎫
- mention i i i 对mention j j j 的投票 : m ˉ i → j t ( e ) = log [ δ ⋅ softmax ( m i → j t ( e ) ) + ( 1 − δ ) ⋅ exp ( m ˉ i → j t − 1 ( e ) ) \begin{aligned} \bar{m}_{i \rightarrow j}^{t}(e)=& \log \left[\delta \cdot \operatorname{softmax}\left(m_{i \rightarrow j}^{t}(e)\right)\right.\\ &+(1-\delta) \cdot \exp \left(\bar{m}_{i \rightarrow j}^{t-1}(e)\right) \end{aligned} mˉi→jt(e)=log[δ⋅softmax(mi→jt(e))+(1−δ)⋅exp(mˉi→jt−1(e))
大致流程(与局部方法类似)
- 经过T次迭代后的信念(边缘): μ i ( e ) = Ψ i ( e ) + ∑ k ≠ i m ˉ k → i T ( e ) \mu_{i}(e)=\Psi_{i}(e)+\sum_{k \neq i} \bar{m}_{k \rightarrow i}^{T}(e) μi(e)=Ψi(e)+∑k=imˉk→iT(e)
- 归一化: μ ˉ i ( e ) = exp [ μ i ( e ) ] ∑ e ′ ∈ Γ ( m i ) exp [ μ i ( e ′ ) ] \bar{\mu}_{i}(e)=\frac{\exp \left[\mu_{i}(e)\right]}{\sum_{e^{\prime} \in \Gamma\left(m_{i}\right)} \exp \left[\mu_{i}\left(e^{\prime}\right)\right]} μˉi(e)=∑e′∈Γ(mi)exp[μi(e′)]exp[μi(e)]
- 拼接先验计算全局得分: ρ i ( e ) : = f ( μ ˉ i ( e ) , log p ^ ( e ∣ m i ) ) \rho_{i}(e):=f\left(\bar{\mu}_{i}(e), \log \hat{p}\left(e \mid m_{i}\right)\right) ρi(e):=f(μˉi(e),logp^(e∣mi))
损失函数构造(与局部方法类似)
- 使得正确的得分尽可能高,错误的得分尽可能低
L ( θ ) = ∑ D ∈ D ∑ m i ∈ D ∑ e ∈ Γ ( m i ) h ( m i , e ) h ( m i , e ) = [ γ − ρ i ( e i ∗ ) + ρ i ( e ) ] + \begin{aligned} L(\theta) &=\sum_{D \in \mathcal{D}} \sum_{m_{i} \in D} \sum_{e \in \Gamma\left(m_{i}\right)} h\left(m_{i}, e\right) \\ h\left(m_{i}, e\right) &=\left[\gamma-\rho_{i}\left(e_{i}^{*}\right)+\rho_{i}(e)\right]_{+} \end{aligned} L(θ)h(mi,e)=D∈D∑mi∈D∑e∈Γ(mi)∑h(mi,e)=[γ−ρi(ei∗)+ρi(e)]+
Experiments
-
数据集
-
实验SOTA效果