arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2008.05828cs.CLcs.LG
收藏

局部信息在基于Transformer模型中的重要性

On the Importance of Local Information in Transformer Based Models

Indian Institute of Technology Madras(印度马德拉斯理工学院);Robert Bosch Centre for Data Science and AI(罗伯特·博世数据科学与人工智能中心)

Madhura Pande, Aakriti Budhraja, Preksha Nema, Pratyush Kumar, Mitesh M. Khapra

摘要:

自我关注模块是基于transformer的模型的关键组件,其中每个token关注每个其他token。最近的研究表明,这些头表现出句法,语义,或本地的行为。一些研究还确定了将这种注意力限制在局部的希望,即,一个标记只关注它周围一个小邻域内的其他标记。然而,没有确凿的证据表明,这种局部注意力足以在多个NLP任务中实现高精度。在这项工作中,我们系统地分析了学习模型中的局部信息的作用,并将其与句法信息的作用进行了对比。更具体地说,我们首先做了一个敏感性分析,并表明,在每一层,一个令牌的表示是更敏感的令牌在一个小的邻居,它比令牌的语法相关it. Then,我们定义了一个注意力偏置度量,以确定是否一个头支付更多的注意本地令牌或语法相关的令牌。我们发现,一个更大的分数头有一个地方性的偏见相比,句法偏见。在建立了本地注意力头的重要性,我们训练和评估模型的注意力头的不同比例被限制为本地。这样的模型将更有效,因为它们在注意力层中的计算更少。我们在4个GLUE数据集(QQP,SST-2,MRPC,QNLI)和2个MT数据集(En-De,En-Ru)上对这些模型进行了评估,并清楚地证明了这些约束模型与无约束模型具有相当的性能。通过这种系统的评估,我们建立了基于transformer的模型中的注意力可以被限制在局部而不影响性能。

英文摘要:

The self-attention module is a key component of Transformer-based models, wherein each token pays attention to every other token. Recent studies have shown that these heads exhibit syntactic, semantic, or local behaviour. Some studies have also identified promise in restricting this attention to be local, i.e., a token attending to other tokens only in a small neighbourhood around it. However, no conclusive evidence exists that such local attention alone is sufficient to achieve high accuracy on multiple NLP tasks. In this work, we systematically analyse the role of locality information in learnt models and contrast it with the role of syntactic information. More specifically, we first do a sensitivity analysis and show that, at every layer, the representation of a token is much more sensitive to tokens in a small neighborhood around it than to tokens which are syntactically related to it. We then define an attention bias metric to determine whether a head pays more attention to local tokens or to syntactically related tokens. We show that a larger fraction of heads have a locality bias as compared to a syntactic bias. Having established the importance of local attention heads, we train and evaluate models where varying fractions of the attention heads are constrained to be local. Such models would be more efficient as they would have fewer computations in the attention layer. We evaluate these models on 4 GLUE datasets (QQP, SST-2, MRPC, QNLI) and 2 MT datasets (En-De, En-Ru) and clearly demonstrate that such constrained models have comparable performance to the unconstrained models. Through this systematic evaluation we establish that attention in Transformer-based models can be constrained to be local without affecting performance.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑