HyperAIHyperAI

Command Palette

Search for a command to run...

3 months ago

Mask Attention Networks: Rethinking and Strengthen Transformer

Zhihao Fan Yeyun Gong Dayiheng Liu Zhongyu Wei Siyuan Wang Jian Jiao Nan Duan Ruofei Zhang Xuanjing Huang

Mask Attention Networks: Rethinking and Strengthen Transformer

Abstract

Transformer is an attention-based neural network, which consists of two sublayers, namely, Self-Attention Network (SAN) and Feed-Forward Network (FFN). Existing research explores to enhance the two sublayers separately to improve the capability of Transformer for text representation. In this paper, we present a novel understanding of SAN and FFN as Mask Attention Networks (MANs) and show that they are two special cases of MANs with static mask matrices. However, their static mask matrices limit the capability for localness modeling in text representation learning. We therefore introduce a new layer named dynamic mask attention network (DMAN) with a learnable mask matrix which is able to model localness adaptively. To incorporate advantages of DMAN, SAN, and FFN, we propose a sequential layered structure to combine the three types of layers. Extensive experiments on various tasks, including neural machine translation and text summarization demonstrate that our model outperforms the original Transformer.

Code Repositories

libertfan/man
pytorch
Mentioned in GitHub

Benchmarks

BenchmarkMethodologyMetrics
abstractive-text-summarization-on-cnn-dailyMask Attention Network
ROUGE-1: 40.98
ROUGE-2: 18.29
ROUGE-L: 37.88
machine-translation-on-iwslt2014-germanMask Attention Network (small)
BLEU score: 36.3
Number of Params: 37M
machine-translation-on-wmt2014-english-germanMask Attention Network (base)
BLEU score: 29.1
Hardware Burden:
Number of Params: 63M
Operations per network pass:
machine-translation-on-wmt2014-english-germanMask Attention Network (big)
BLEU score: 30.4
Hardware Burden:
Number of Params: 215M
Operations per network pass:
text-summarization-on-gigawordMask Attention Network
ROUGE-1: 38.28
ROUGE-2: 19.46
ROUGE-L: 35.46

Build AI with AI

From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.

AI Co-coding
Ready-to-use GPUs
Best Pricing
Get Started

Hyper Newsletters

Subscribe to our latest updates
We will deliver the latest updates of the week to your inbox at nine o'clock every Monday morning
Powered by MailChimp