![585dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p01.5ceimg.com/content/585dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
代码已经实现了开源:
ratishsp/data2text-entity-pygithub.com![5a5dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p03.5ceimg.com/content/5a5dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
论文地址:
Data-to-text Generation with Entity Modelingarxiv.org欢迎随时私信或评论探讨~我会尽量做到秒回的。
导语:
前面我们讲了一些基于VAE或者GAN的生成模型用以文本生成,今天想要讲一篇data to text的paper。paper来自19年的ACL,而且代码也已经实现了开源。
摘要:
大多数的文本生成工作都要感谢大数据和end-to-end的NN架构。这些模型都依靠学习一个良好的表示使得文本生成能够选择合适的context、将文本逻辑清晰的组合、以及合乎语法的表述出来。
在这项工作中,我们提出了一个以实体为中心的神经结构的数据到文本生成。这里的实体表示是dynamically updated.文本生成是在每个时间戳中,利用了hierarchical attention根据data input 和实体表示entity memory representations得到的。
最后是实验部分:
We present experiments on the ROTOWIRE benchmark and a (five times larger) new dataset on the baseball domain which we create. Our results show that the proposed model outperforms competitive baselines in automatic and human evaluation.
1 介绍:
本文最大的特点是提出了一个以实体为中心的神经结构的数据到文本生成。例如下图,一个baseball的比赛会产生很多数据,右边的text是描述
![5d5dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p01.5ceimg.com/content/5d5dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
3 Background: Encoder-Decoder with Conditional Copy
这个seq2seq模型的输入是figure1的那些数据记录表格,每条记录都被表示为
![645dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p01.5ceimg.com/content/645dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
其中,
这个就是encoder的model。输入table r,输出record的向量表示。
现在看看decoder的构造。
这里多嘴一句,在作者的第二个任务MLB中(也就是图一的比赛数据文本生成),考虑到比赛的主要事件都是按时间顺序记录,所以作者用了bi-LSTM作为编码器。
让我们再看看decoder是如何利用过去的hidden state和
![665dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p01.5ceimg.com/content/665dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
什么意思呢?我们计算在time step t,先计算encoder的每个输出
context vector) ,最后再和hidden state
![685dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p04.5ceimg.com/content/685dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
![695dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p03.5ceimg.com/content/695dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
此外,模型还采用了copy mechanism。他可以让某些时候t,某些记录r,直接copy到output(
4 Entity Memory and Hierarchical Attention
作者用上面这2个方法改进我们前面提到的model。首先是实体记忆(Entity Memory),为每个唯一的实体k计算记录表示(record representation,例如下式为
![6e5dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p02.5ceimg.com/content/6e5dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
这里我个人的理解是
更进一步的,为了让这些实体在decoder的时候有更好的表示(直接用
![6f5dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p04.5ceimg.com/content/6f5dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
那么为什么是存在
搞清楚这个变量以后我们结合下面的Entity Memory model讲解。这个model的目的就是在timestep t的时候,不断的更新
![715dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p02.5ceimg.com/content/715dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
上面说了在每个timestep t都会尝试更新
![745dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p05.5ceimg.com/content/745dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
我们还可以计算
![765dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p01.5ceimg.com/content/765dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
如果需要更新实体k,则gate
![795dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p03.5ceimg.com/content/795dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
说完了Entity Memory ,再看看Hierarchical Attention,简单来说就是我们有一个假设,确定实体分布是有助于提高文本生成的精度的,因为实体分布(the entity distribution)确定下来以后是能够约束每个实体相关联的记录分布的似然的(the probability distribution of records)。所以作者用多层的概念构建attention。那么他是如何实现?模型如B块所示:
![7b5dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p04.5ceimg.com/content/7b5dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
为了方便说明我们把encoder output
![7d5dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p04.5ceimg.com/content/7d5dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
得到了
![805dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p01.5ceimg.com/content/805dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
![825dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p05.5ceimg.com/content/825dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
最终得到
![685dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p04.5ceimg.com/content/685dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
第四节整个model如图:
![865dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p04.5ceimg.com/content/865dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
5 Training and Inference
很常见的训练方法最大似然,inference的时候就选取概率最大的作为output game summarizes。
![875dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p04.5ceimg.com/content/875dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
6 Experimental Setup
data:
采用了 ROTOWIRE(Wiseman et al., 2017),包含了NBA篮球比赛数据和人工的比赛报道;以及MLB(a new dataset which contains baseball statistics and corresponding human-authored summaries obtained from the ESPN website.[1])
更具体的实验可以参考一下原文。
参考文献:
Sam Wiseman, Stuart Shieber, and Alexander Rush. 2017. Challenges in data-to-document generation. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2253–2263. Association for Computational Linguistics.aclweb.org Ratish Puduppully, Li Dong, and Mirella Lapata. 2019. Data-to-text generation with content selection and planning. In Proceedings of the 33rd AAAI Conference on Artificial Intelligence, Honolulu, Hawaii.arxiv.org关于copy mechanism、pointernet可以看看下面
阮智昊:NLP硬核入门-PointerNet和CopyNetzhuanlan.zhihu.com![885dbb8b-2e22-eb11-8da9-e4434bdf6706.png](http://p05.5ceimg.com/content/885dbb8b-2e22-eb11-8da9-e4434bdf6706.png)
本文作者采用的方法是参考下面这个paper:
Caglar Gulcehre, Sungjin Ahn, Ramesh Nallapati, Bowen Zhou, and Yoshua Bengio. 2016. Pointing the unknown words. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 140–149.doi.org参考
- ^http://www.espn.com/mlb/recap?gameId={gameid}