美文网首页
Simple and Effective Text Matchi

Simple and Effective Text Matchi

作者: prolic | 来源:发表于2020-01-09 17:17 被阅读0次

    阿里小蜜提出的高效预测Text Matching模型,模型图如下:

    An overview of RE2.

    核心是有三种向量,Embedding,Residual和Encoded,分别对应图中的白,灰,黑

    Encoder层用的是普通多层CNN

    Augmented Residual Connections

    残差网络做了特殊处理

    x^{(n)} = [x_1^{(n)},x_2^{(n)},...,x_l^{(n)}]

    o^{(n)} = [o_1^{(n)},o_2^{(n)},...,o_l^{(n)}]

    x_i^{(n)} = [x_i^{(1)};o_i^{(n-1)} + o_i^{(n-2)}]

    Alignment Layer

    两句做Attention,相似度取e_{ij} = F(a_i)^TF(b_j)

    函数F为恒等函数或者单层前馈网络

    a'_i = \sum\limits_{j=1}^{l_b} \frac{exp(e_{ij})}{\sum_{k=1}^{l_b}exp(e_{ik})}b_j

    b'_j = \sum\limits_{i=1}^{l_a} \frac{exp(e_{ij})}{\sum_{k=1}^{l_a}exp(e_{kj})}a_i

    Fusion Layer

    \bar {a}_i^1 = G_1([a_i;a'_i])

    \bar {a}_i^2 = G_2([a_i;a_i - a'_i])

    \bar{a}_i^3 = G_3([a_i;a_i \circ a'_i])

    \bar {a}_i = G([\bar{a}_i^1;\bar{a}_i^2;\bar{a}_i^3])

    G是单层前馈网络,融合层将直接拼接,减后拼接和乘后拼接做拼接,减法表明两句的diff,乘法表明两句相似的部分

    Prediction Layer

    \hat{\mathbf{y}} = H([v_1;v_2;v_1 - v_2;v_1 \circ v_2])

    v_1,v_2是两个句子经过pooling的输出,H是多层前馈网络

    这里作者分别对多种任务提出了不同的计算方式,有兴趣可以去原文看下

    参考资料

    [1] Text Matching with Richer Alignment Features 论文解读

    [2] Text Matching with Richer Alignment Features原文

    [3] 阿里提供的github代码

    相关文章

      网友评论

          本文标题:Simple and Effective Text Matchi

          本文链接:https://www.haomeiwen.com/subject/fozyactx.html