Abstract
Recent advancements in both representation learning and function learning have demonstrated substantial promise across diverse domains of artificial intelligence. However, the effective integration of these paradigms poses a significant challenge, particularly in cases where users must manually decide whether to apply a representation learning or function learning model based on dataset characteristics. To address this issue, we introduce MLP-KAN, a unified method designed to eliminate the need for manual model selection. By integrating Multi-Layer Perceptrons (MLPs) for representation learning and Kolmogorov-Arnold Networks (KANs) for function learning within a Mixture-of-Experts (MoE) architecture, MLP-KAN dynamically adapts to the specific characteristics of the task at hand, ensuring optimal performance. Embedded within a transformer-based framework, our work achieves remarkable results on four widely-used datasets across diverse domains. Extensive experimental evaluation demonstrates its superior versatility, delivering competitive performance across both deep representation and function learning tasks. These findings highlight the potential of MLP-KAN to simplify the model selection process, offering a comprehensive, adaptable solution across various domains. Our code and weights are available at https://github.com/DLYuanGod/MLP-KAN.
Introduction
In the current deep learning landscape, researchers often face a binary choice: use Multi-Layer Perceptrons (MLPs) for high-dimensional representation learning (like identifying a cat in a photo) or use Kolmogorov-Arnold Networks (KANs) for precise function approximation (like fitting a complex physics equation). MLPs are versatile but often over-parameterize simple tasks and struggle with exact mathematical relationships. KANs, while mathematically elegant and powerful for univariate functions, can be computationally expensive and less versatile for general feature extraction. MLP-KAN aims to eliminate this manual selection by unifying both paradigms into a single, adaptive framework.
Methods
The authors propose the MLP-KAN module, designed to replace standard MLP layers within a Transformer architecture. The key components include a Mixture-of-Experts (MoE) framework and a Soft MoE routing mechanism.
Mixture-of-Experts (MoE) Framework
Instead of a single feed-forward path, the model contains a pool of experts. Half are MLP-based (optimized for representation) and half are KAN-based (optimized for functions). To overcome the slow training speeds of original KANs, the authors utilize "FasterKAN," which uses a grid-based mechanism and reflection switch functions to approximate smooth basis functions more efficiently.
Soft MoE Routing
A gating mechanism (router) calculates the similarity between input tokens and learnable "slot embeddings." It then "routes" tokens to the most relevant experts. This allows the model to process a token through an MLP expert if it requires feature extraction, or a KAN expert if it requires precise interpolation.
Experimental Evaluation
The model was evaluated on four diverse benchmarks: Computer Vision (CIFAR-10, CIFAR-100, mini-ImageNet), Natural Language Processing (SST2 sentiment analysis), and Symbolic Regression (the Feynman dataset).
Key Results
MLP-KAN demonstrates superior versatility by balancing the strengths of both expert types.
- Symbolic Physics: MLP-KAN dominated this category. For many Feynman equations, it achieved Root Mean Square Errors (RMSE) that were orders of magnitude lower than standalone MLPs. For example, on equation I.6.20a, MLP-KAN's error was $3.87 \times 10^{-4}$ compared to the MLP's $1.37 \times 10^{-1}$.
- Vision and Language: On CIFAR-10 and SST2, MLP-KAN outperformed pure KANs and matched or slightly exceeded the performance of standard MLPs. On SST2, it achieved a top accuracy of 0.935.
Discussion and Conclusion
MLP-KAN successfully bridges the gap between representation and function learning. By using an MoE approach, it provides a "best of both worlds" solution that scales efficiently and adapts to task characteristics. While the computational complexity of spline-based experts remains higher than simple dense layers, the gains in precision and versatility are significant. Future work is needed to see how this architecture behaves when scaled to massive Large Language Models (LLMs) or high-resolution vision transformers (ViTs).
Summary updated