Reusing Softmax Hardware Unit for GELU Computation in Transformers

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Peltekis, Christodoulos, Alexandridis, Kosmas, Dimitrakopoulos, Giorgos
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866911778121711616
author Peltekis, Christodoulos
Alexandridis, Kosmas
Dimitrakopoulos, Giorgos
author_facet Peltekis, Christodoulos
Alexandridis, Kosmas
Dimitrakopoulos, Giorgos
contents Transformers have improved drastically the performance of natural language processing (NLP) and computer vision applications. The computation of transformers involves matrix multiplications and non-linear activation functions such as softmax and GELU (Gaussion Error Linear Unit) that are accelerated directly in hardware. Currently, function evaluation is done separately for each function and rarely allows for hardware reuse. To mitigate this problem, in this work, we map the computation of GELU to a softmax operator. In this way, the efficient hardware units designed already for softmax can be reused for computing GELU as well. Computation of GELU can enjoy the inherent vectorized nature of softmax and produce in parallel multiple GELU outcomes. Experimental results show that computing GELU via a pre-existing and incrementally modified softmax hardware unit (a) does not reduce the accuracy of representative NLP applications and (b) allows the reduction of the overall hardware area and power by 6.1% and 11.9%, respectively, on average.
format Preprint
id arxiv_https___arxiv_org_abs_2402_10118
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Reusing Softmax Hardware Unit for GELU Computation in Transformers
Peltekis, Christodoulos
Alexandridis, Kosmas
Dimitrakopoulos, Giorgos
Hardware Architecture
Machine Learning
Transformers have improved drastically the performance of natural language processing (NLP) and computer vision applications. The computation of transformers involves matrix multiplications and non-linear activation functions such as softmax and GELU (Gaussion Error Linear Unit) that are accelerated directly in hardware. Currently, function evaluation is done separately for each function and rarely allows for hardware reuse. To mitigate this problem, in this work, we map the computation of GELU to a softmax operator. In this way, the efficient hardware units designed already for softmax can be reused for computing GELU as well. Computation of GELU can enjoy the inherent vectorized nature of softmax and produce in parallel multiple GELU outcomes. Experimental results show that computing GELU via a pre-existing and incrementally modified softmax hardware unit (a) does not reduce the accuracy of representative NLP applications and (b) allows the reduction of the overall hardware area and power by 6.1% and 11.9%, respectively, on average.
title Reusing Softmax Hardware Unit for GELU Computation in Transformers
topic Hardware Architecture
Machine Learning
url https://arxiv.org/abs/2402.10118