Multi-Head Self-Attention with Role-Guided Masks

Dongsheng Wang, Casper Hansen, Lucas Chaves Lima, Christian Hansen, Maria Maistro +2 more
12/22/2020
cs.CL
transformer-attention

Official code: dongshengwang-ai/guided-attention-transformer (0 stars, Python, last commit 2022-03-13).

Abstract

The state of the art in learning meaningful semantic representations of words is the Transformer model and its attention mechanisms. Simply put, the attention mechanisms learn to attend to specific parts of the input dispensing recurrence and convolutions.

Show full abstract

While some of the learned attention heads have been found to play linguistically interpretable roles, they can be redundant or prone to errors. We propose a method to guide the attention heads towards roles identified in prior work as important. We do this by defining role-specific masks to constrain the heads to attend to specific parts of the input, such that different heads are designed to play different roles. Experiments on text classification and machine translation using 7 different datasets show that our method outperforms competitive attention-based, CNN, and RNN baselines.

View on arXivView PDF

Code Implementations(1)

guided attention model for transformers

00PythonDec 21, 20204 years ago

Similar Papers

Cite this paper

@article{wang2020multihead,
  title  = {Multi-Head Self-Attention with Role-Guided Masks},
  author = {Dongsheng Wang and Casper Hansen and Lucas Chaves Lima and Christian Hansen and Maria Maistro and Jakob Grue Simonsen and Christina Lioma},
  year   = {2020},
  eprint = {2012.12366},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2012.12366}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2012.12366.svg)](https://codeofpaper.com/paper/2012.12366)

Discussion