journal article·2021-02-08Open access

Analyzing and Controlling Inter-Head Diversity in Multi-Head Attention

Hyeongu Yun, Taegwan Kang, Kyomin Jung

Applied Sciences· Volume 11· Issue 4

Abstract

Multi-head attention, a powerful strategy for Transformer, is assumed to utilize information from diverse representation subspaces. However, measuring diversity between heads’ representations or exploiting the diversity has been rarely studied. In this paper, we quantitatively analyze inter-head diversity of multi-head attention by applying recently developed similarity measures between two deep representations: Singular Vector Canonical Correlation Analysis (SVCCA) and Centered Kernel Alignment (CKA). By doing so, we empirically show that multi-head attention does diversify representation subspaces of each head as the number of heads increases. Based on our analysis, we hypothesize that there exists an optimal inter-head diversity with which a model can achieve better performance. To examine our hypothesis, we deeply inspect three techniques to control the inter-head diversity; (1) Hilbert-Schmidt Independence Criterion regularizer among representation subspaces, (2) Orthogonality regularizer, and (3) Drophead as zero-outing each head randomly in every training step. In our experiments on various machine translation and language modeling tasks, we show that controlling inter-head diversity leads to the best performance among baselines.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Domain Adaptation and Few-Shot Learning · Multimodal Machine Learning Applications · Topic Modeling

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

Department of Electrical and Computer Engineering, Seoul National University, Seoul 08826, Korea

References (33)

Show source-provided references
1. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A.N., Kaiser, Ł., and Polosukhin, I. (2017, January 4–9). Attention is All you Need. Proceedings of the Advances in Neural Information Processing Systems, Long Beach, CA, USA.
2. Devlin, J., Chang, M.W., Lee, K., and Toutanova, K. (2019, January 3–7). BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), Minneapolis, MN, USA.
3. Yang, Z., Dai, Z., Yang, Y., Carbonell, J., Salakhutdinov, R.R., and Le, Q.V. (2019, January 8–14). Xlnet: Generalized autoregressive pretraining for language understanding. Proceedings of the Advances in Neural Information Processing Systems, Vancouver, BC, Canada.
4. Zhang, X., Wei, F., and Zhou, M. (August, January 28). HIBERT: Document Level Pre-training of Hierarchical Bidirectional Transformers for Document Summarization. Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, Florence, Italy.
5. Clark, K., Khandelwal, U., Levy, O., and Manning, C.D. (August, January 29). What Does BERT Look at? An Analysis of BERT’s Attention. Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, Florence, Italy.10.18653/v1/W19-4828 ↗
6. Voita, E., Talbot, D., Moiseev, F., Sennrich, R., and Titov, I. (August, January 28). Analyzing Multi-Head Self-Attention: Specialized Heads Do the Heavy Lifting, the Rest Can Be Pruned. Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, Florence, Italy.
7. Li, J., Tu, Z., Yang, B., Lyu, M.R., and Zhang, T. (November, January 31). Multi-Head Attention with Disagreement Regularization. Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, Brussels, Belgium.10.18653/v1/D18-1317 ↗
8. Raghu, M., Gilmer, J., Yosinski, J., and Sohl-Dickstein, J. (2017, January 4–9). Svcca: Singular vector canonical correlation analysis for deep learning dynamics and interpretability. Proceedings of the Advances in Neural Information Processing Systems, Long Beach, CA, USA.
9. Kornblith, S., Norouzi, M., Lee, H., and Hinton, G. (2019, January 9–15). Similarity of Neural Network Representations Revisited. Proceedings of the International Conference on Machine Learning, Long Beach, CA, USA.
10. Abadi, M., Agarwal, A., Barham, P., Brevdo, E., Chen, Z., Citro, C., Corrado, G.S., Davis, A., Dean, J., and Devin, M. (2016). Tensorflow: Large-scale machine learning on heterogeneous distributed systems. arXiv.
11. Bau, A., Belinkov, Y., Sajjad, H., Durrani, N., Dalvi, F., and Glass, J. (2018). Identifying and controlling important neurons in neural machine translation. arXiv.
12. Zhou, W., Ge, T., Xu, K., Wei, F., and Zhou, M. (2020). Scheduled DropHead: A Regularization Method for Transformer Models. arXiv.10.18653/v1/2020.findings-emnlp.178 ↗
13. Dropout: A simple way to prevent neural networks from overfitting
14. Cettolo, M., Federico, M., Bentivogli, L., Jan, N., Sebastian, S., Katsuitho, S., Koichiro, Y., and Christian, F. (2017, January 14–15). Overview of the iwslt 2017 evaluation campaign. Proceedings of the International Workshop on Spoken Language Translation, Okyo, Japan.
15. Ziemski, M., Junczys-Dowmunt, M., and Pouliquen, B. (2016, January 23–28). The united nations parallel corpus v1.0. Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC’16), Portorož, Slovenia.
16. Tang, G., Sennrich, R., and Nivre, J. (2018). An Analysis of Attention Mechanisms: The Case of Word Sense Disambiguation in Neural Machine Translation. arXiv.10.18653/v1/W18-6304 ↗
17. Raganato, A., and Tiedemann, J. (November, January 31). An analysis of encoder representations in transformer-based machine translation. Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, Brussels, Belgium.10.18653/v1/W18-5431 ↗
18. Michel, P., Levy, O., and Neubig, G. (2019, January 8–14). Are Sixteen Heads Really Better than One?. Proceedings of the Advances in Neural Information Processing Systems, Vancouver, BC, Canada.
19. Li, Y., Yosinski, J., Clune, J., Lipson, H., and Hopcroft, J.E. (2015, January 7–12). Convergent learning: Do different neural networks learn the same representations?. Proceedings of the FE@ NIPS, Montreal, QC, Canada.
20. Morcos, A., Raghu, M., and Bengio, S. (2018, January 3–8). Insights on representational similarity in neural networks with canonical correlation. Proceedings of the Advances in Neural Information Processing Systems, Montreal, QC, Canada.
21. Universality and individuality in neural dynamics across large populations of recurrent networks
22. Kudugunta, S.R., Bapna, A., Caswell, I., Arivazhagan, N., and Firat, O. (2019). Investigating multilingual nmt representations at scale. arXiv.10.18653/v1/D19-1167 ↗
23. Rodríguez, P., Gonzalez, J., Cucurull, G., Gonfaus, J.M., and Roca, X. (2016). Regularizing cnns with locally constrained decorrelations. arXiv.
24. Xie, D., Xiong, J., and Pu, S. (2017, January 21–26). All you need is beyond a good init: Exploring better solution for training extremely deep convolutional neural networks with orthonormality and modulation. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA.10.1109/CVPR.2017.539 ↗
25. Bansal, N., Chen, X., and Wang, Z. (2018, January 3–8). Can we gain more from orthogonality regularizations in training deep CNNs?. Proceedings of the 32nd International Conference on Neural Information Processing Systems, Montreal, QC, Canada.
26. Gu, S., Hou, Y., Zhang, L., and Zhang, Y. (2018, January 13–19). Regularizing Deep Neural Networks with an Ensemble-based Decorrelation Method. Proceedings of the IJCAI, Stockholm, Swede.10.24963/ijcai.2018/301 ↗
27. Gretton, A., Bousquet, O., Smola, A., and Schölkopf, B. (2005). Measuring statistical dependence with Hilbert-Schmidt norms. International Conference on Algorithmic Learning Theory, Springer.10.1007/11564089_7 ↗
28. Algorithms for learning kernels based on centered alignment
29. On kernel-target alignment
30. Sennrich, R., Haddow, B., and Birch, A. (2016, January 7–12). Neural Machine Translation of Rare Words with Subword Units. Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Berlin, Germany.10.18653/v1/P16-1162 ↗
31. Ondrej, B., Chatterjee, R., Christian, F., Yvette, G., Barry, H., Matthias, H., Philipp, K., Qun, L., Varvara, L., and Christof, M. (2017, January 7–8). Findings of the 2017 conference on machine translation (wmt17). Proceedings of the Second Conference onMachine Translation, Copenhage, Denmark.
32. Marcus, M., Santorini, B., and Marcinkiewicz, M.A. (1993). Building a Large Annotated Corpus of English: The Penn Treebank, University of Pennsylvania.10.21236/ADA273556 ↗
33. Conneau, A., Khandelwal, K., Goyal, N., Chaudhary, V., Wenzek, G., Guzmán, F., Grave, E., Ott, M., Zettlemoyer, L., and Stoyanov, V. (2019). Unsupervised cross-lingual representation learning at scale. arXiv.10.18653/v1/2020.acl-main.747 ↗