Attention Analysis and Calibration for Transformer in Natural Language Generation

被引:3
作者
Lu, Yu [1 ,2 ]
Zhang, Jiajun [1 ,2 ]
Zeng, Jiali [3 ]
Wu, Shuangzhi [3 ]
Zong, Chengqing [1 ,2 ]
机构
[1] Chinese Acad Sci, Inst Automat, Natl Lab Pattern Recognit, Beijing 100190, Peoples R China
[2] Univ Chinese Acad Sci, Sch Artificial Intelligence, Beijing 100049, Peoples R China
[3] Dept Tencent Cloud Xiaowei, Beijing 100089, Peoples R China
关键词
Graphics; Magnetization; Symbols; Magnetostatics; Speech processing; Permeability; Image color analysis; Attention mechanism; interpretability; Transformer; attention calibration;
D O I
10.1109/TASLP.2022.3180678
中图分类号
O42 [声学];
学科分类号
070206 ; 082403 ;
摘要
Attention mechanism has been ubiquitous in neural machine translation by dynamically selecting relevant contexts for different translations. Apart from performance gains, attention weights assigned to input tokens are often utilized to explain that high-attention tokens contribute more to the prediction. However, many works question whether this assumption holds in text classification by manually manipulating attention weights and observing decision flips. This article extends this question to Transformer-based neural machine translation, which heavily relies on cross-lingual attention to produce accurate translations but is relatively understudied in this context. We first design a mask perturbation model which automatically assesses each input's contribution to model outputs. We then test whether the token contributing most to the current translation receives the highest attention weight. We find that it sometimes does not, which closely depends on the entropy of attention weights, the syntactic role of the current generation, and language pairs. We also rethink the discrepancy between attention weights and word alignments from the view of unreliable attention weights. Our observations further motivate us to calibrate the cross-lingual multi-head attention by attaching more attention to indispensable tokens, whose removal leads to a dramatic performance drop. Empirical experiments on different-scale translation tasks and text summarization tasks demonstrate that our calibration methods significantly outperform strong baselines.
引用
收藏
页码:1927 / 1938
页数:12
相关论文
共 56 条
[1]  
[Anonymous], 2007, P 45 ANN M ASS COMPU
[2]  
[Anonymous], 2015, P EMNLP, DOI [DOI 10.18653/V1/D15-1166, 10.18653/v1/d15-1166]
[3]  
[Anonymous], 2016, P 25 INT JOINT C ART
[4]  
[Anonymous], 2016, Google's neural machine translation system: bridging the gap between human and machine translation
[5]  
[Anonymous], 2015, Advances in Neural Information Processing Systems
[6]  
[Anonymous], 2016, PROC C EMPIRICAL MET
[7]  
Bahdanau D, 2016, Arxiv, DOI [arXiv:1409.0473, DOI 10.48550/ARXIV.1409.0473]
[8]  
Belinkov Yonatan, 2019, C N AM CHAPTER ASS C, V7, P49
[9]  
Chen W., 2016, P AMTA, P121
[10]  
Chen Y, 2020, PROCEEDINGS OF THE 2020 CONFERENCE ON EMPIRICAL METHODS IN NATURAL LANGUAGE PROCESSING (EMNLP), P566