[Paper Review] GLU Variants Improve Transformer
This paper proposes novel Gated Linear Unit (GLU) variants—ReGLU, GEGLU, SwiGLU, and Bilinear—replacing the standard ReLU or GELU activations in Transformer feed-forward networks. These variants improve model performance on pre-training and downstream NLP tasks, with GEGLU and SwiGLU achieving the best results in terms of lower perplexity and higher accuracy across GLUE, SuperGLUE, and SQuAD benchmarks.
Gated Linear Units (arXiv:1612.08083) consist of the component-wise product of two linear projections, one of which is first passed through a sigmoid function. Variations on GLU are possible, using different nonlinear (or even linear) functions in place of sigmoid. We test these variants in the feed-forward sublayers of the Transformer (arXiv:1706.03762) sequence-to-sequence model, and find that some of them yield quality improvements over the typically-used ReLU or GELU activations.
Motivation & Objective
- To improve the performance of Transformer models by replacing standard feed-forward network activations with novel GLU-based variants.
- To investigate whether alternative nonlinearities in GLU components can enhance representation learning in sequence-to-sequence models.
- To evaluate the impact of these GLU variants on both pre-training objectives and downstream transfer learning tasks.
- To maintain computational and parameter efficiency while improving model quality through architectural modifications.
- To provide empirical evidence that GLU variants yield consistent gains across diverse NLP benchmarks.
Proposed method
- Proposes a family of GLU variants where the first linear projection is gated by a nonlinear activation (e.g., sigmoid, ReLU, GELU, Swish), and the output is element-wise multiplied with a second linear projection.
- Defines new feed-forward network components: FFN_GLU, FFN_Bilinear, FFN_ReGLU, FFN_GEGLU, FFN_SwiGLU, each using different activation functions in the GLU mechanism.
- Maintains constant parameter and computation counts by reducing the hidden dimension from 3072 to 2048 in GLU-based models compared to the original two-weight FFN.
- Employs the T5 model architecture and training setup, including Adafactor optimization and inverse-square-root learning rate scheduling, with no dropout during pre-training for improved performance.
- Evaluates models on the C4 span-filling pre-training objective and fine-tunes on a mixture of GLUE, SuperGLUE, and SQuAD tasks.
- Uses held-out validation sets to measure log-perplexity during pre-training and reports accuracy scores on downstream benchmarks.
Experimental results
Research questions
- RQ1Do GLU variants with alternative activation functions (e.g., GELU, Swish) improve performance over standard ReLU or GELU in Transformer feed-forward networks?
- RQ2Can replacing the standard two-weights FFN with a three-weights GLU-based architecture yield better results without increasing computational cost?
- RQ3How do different GLU variants—such as ReGLU, GEGLU, SwiGLU, and Bilinear—compare in terms of pre-training loss and downstream transfer learning performance?
- RQ4Does the use of GLU variants lead to consistent improvements across diverse NLP benchmarks like GLUE, SuperGLUE, and SQuAD?
- RQ5Why do certain GLU variants, such as GEGLU and SwiGLU, achieve superior performance despite no theoretical explanation provided?
Key findings
- GEGLU and SwiGLU variants achieved the lowest held-out log-perplexity of 1.633 and 1.636, respectively, at 524,288 training steps, outperforming the ReLU baseline (1.677).
- On the GLUE benchmark, GEGLU achieved an average score of 86.17, surpassing the ReLU baseline (85.83) and the original T5 model (84.24).
- On the SuperGLUE benchmark, SwiGLU achieved the highest average score of 86.54, exceeding the original T5 model's 78.56 and the ReLU baseline's 77.88.
- On SQuAD v1.1, ReGLU achieved the highest EM score of 83.53 and F1 of 91.18, outperforming the ReLU baseline (83.18 EM, 90.87 F1).
- The Bilinear variant achieved the second-lowest perplexity (1.648) and strong performance on SuperGLUE (83.65 average), indicating its effectiveness despite lacking nonlinearity.
- All GLU variants showed consistent improvements across multiple benchmarks, suggesting that the architectural change enhances generalization and representation learning.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.