Jump to content

Gated linear unit (GLU)

From Wikibase

Languages: English · français · Esperanto

Scalar view with $w_1=0.8$, $w_2=1.7$: the linear branch $z\,w_1$, the sigmoid gate $f(z\,w_2)$, and their product $\mathrm{GLU}(z)$
Image: Rong Martin-Siebler ZHOU and Veramiko AI · CC BY-SA 4.0
· Open in a new tab

A gated linear unit (GLU) is a trainable activation function.

$$ \operatorname{GLU}(\mathbf{X}) =\left(\mathbf{X}\mathbf{W}_1+\mathbf{1}\vec b_1^{\top}\right) \odot f\left(\mathbf{X}\mathbf{W}_2+\mathbf{1}\vec b_2^{\top}\right). $$

The gating function $f$ is commonly any of


GLUs are found to improve feed-forward sub-layers in Transformers at matched parameter count.[1]