Abstract
Transformers have become the standard architecture for Natural Language Processing (NLP) and Computer Vision (CV), largely due to the success of the attention mechanism. However, these models are often heavily over-parameterized. This paper investigates whether the Multi-Layer Perceptron (MLP) components and complex attention matrices are strictly necessary. By systematically removing MLPs and simplifying the attention mechanism—including collapsing matrices and enforcing symmetry—we demonstrate that parameter counts can be reduced by up to 90% while maintaining comparable classification performance on MNIST and CIFAR-10 benchmarks.
Introduction: The Problem of Over-Parameterization
Since the introduction of the Transformer architecture, the trend has been toward increasingly massive models. A standard Transformer block pairs an attention mechanism with an MLP. The MLP is traditionally justified as providing the non-linearity required to model complex data. However, the attention mechanism itself is non-linear due to its internal similarity measures and softmax operations. This study tests the hypothesis that this inherent non-linearity is sufficient, allowing for the removal of parameter-heavy MLPs and the simplification of other components to create "Minimum Transformers."
Methodology: Deconstructing the Transformer
The researchers systematically simplified the Transformer architecture through four primary modifications:
- MLP Removal: The MLP blocks were omitted entirely, leaving only the attention layers to handle both context extraction and non-linear modeling.
- Matrix Collapsing: In single-head attention, the query ($W^Q$) and key ($W^K$) matrices can be mathematically collapsed into a single matrix ($W^{QK}$). Furthermore, the value ($W^V$) and projection ($W^O$) matrices can be omitted, treating the output as a simple convex combination of input embeddings.
- Symmetry Enforcement: By enforcing symmetry in the similarity measure, the number of parameters in the query/key relationship is halved.
- Overdetermination Ratio ($Q$): The authors introduced a metric $Q$ representing the ratio of data constraints to trainable parameters. Higher $Q$ values typically indicate better potential for generalization.
Key Results
The simplified architectures were evaluated on the MNIST and CIFAR-10 datasets. The results indicate that massive parameter savings do not necessarily lead to a significant loss in accuracy.
Performance on MNIST
On the MNIST dataset, the "minimum" variant—lacking an MLP and utilizing collapsed/omitted matrices—reduced the parameter count from approximately 279,000 to just 26,650. Despite this 90% reduction, validation accuracy remained high at 95.32%.
Performance on CIFAR-10
For the more complex CIFAR-10 dataset, the findings were even more striking. Variants without MLPs and with symmetric similarity measures often showed superior generalization compared to the standard architecture. This suggests that the extra parameters in full Transformers may lead to overfitting on medium-sized datasets.
Discussion and Insights
The experiments support the "Obsolete Parameter" hypothesis: many parameters in standard Transformers are redundant. By forcing the model to represent tokens as weighted averages of their neighbors (by omitting $W^V$ and $W^O$), the architecture may learn more robust and meaningful representations. Furthermore, the inherent non-linearity of the attention mechanism appears sufficient for these classification tasks.
Limitations and Future Work
While successful on MNIST and CIFAR-10, scaling these "Minimum Transformers" to larger datasets like ImageNet proved challenging, with baseline convergence issues. Future research should explore these architectures in the NLP domain and investigate the use of more robust second-order optimization algorithms to stabilize training for smaller, more constrained models.
Summary updated