Does Self-Attention Need Separate Weights in Transformers?

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Kowsher, Md, Prottasha, Nusrat Jahan, Yu, Chun-Nam, Garibay, Ozlem Ozmen, Yousefi, Niloofar
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866912357385502720
author Kowsher, Md
Prottasha, Nusrat Jahan
Yu, Chun-Nam
Garibay, Ozlem Ozmen
Yousefi, Niloofar
author_facet Kowsher, Md
Prottasha, Nusrat Jahan
Yu, Chun-Nam
Garibay, Ozlem Ozmen
Yousefi, Niloofar
contents The success of self-attention lies in its ability to capture long-range dependencies and enhance context understanding, but it is limited by its computational complexity and challenges in handling sequential data with inherent directionality. This work introduces a shared weight self-attention-based BERT model that only learns one weight matrix for (Key, Value, and Query) representations instead of three individual matrices for each of them. Our shared weight attention reduces the training parameter size by more than half and training time by around one-tenth. Furthermore, we demonstrate higher prediction accuracy on small tasks of GLUE over the BERT baseline and in particular a generalization power on noisy and out-of-domain data. Experimental results indicate that our shared self-attention method achieves a parameter size reduction of 66.53% in the attention block. In the GLUE dataset, the shared weight self-attention-based BERT model demonstrates accuracy improvements of 0.38%, 5.81%, and 1.06% over the standard, symmetric, and pairwise attention-based BERT models, respectively. The model and source code are available at Anonymous.
format Preprint
id arxiv_https___arxiv_org_abs_2412_00359
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Does Self-Attention Need Separate Weights in Transformers?
Kowsher, Md
Prottasha, Nusrat Jahan
Yu, Chun-Nam
Garibay, Ozlem Ozmen
Yousefi, Niloofar
Computation and Language
The success of self-attention lies in its ability to capture long-range dependencies and enhance context understanding, but it is limited by its computational complexity and challenges in handling sequential data with inherent directionality. This work introduces a shared weight self-attention-based BERT model that only learns one weight matrix for (Key, Value, and Query) representations instead of three individual matrices for each of them. Our shared weight attention reduces the training parameter size by more than half and training time by around one-tenth. Furthermore, we demonstrate higher prediction accuracy on small tasks of GLUE over the BERT baseline and in particular a generalization power on noisy and out-of-domain data. Experimental results indicate that our shared self-attention method achieves a parameter size reduction of 66.53% in the attention block. In the GLUE dataset, the shared weight self-attention-based BERT model demonstrates accuracy improvements of 0.38%, 5.81%, and 1.06% over the standard, symmetric, and pairwise attention-based BERT models, respectively. The model and source code are available at Anonymous.
title Does Self-Attention Need Separate Weights in Transformers?
topic Computation and Language
url https://arxiv.org/abs/2412.00359