MLP-Mixer PyTorch is a clean PyTorch implementation of Google’s MLP-Mixer architecture — the provocative result that a vision model built only from multi-layer perceptrons, with no convolutions and no attention, can compete with far more complex designs. Maintained by prolific open-source author lucidrains, the repository has earned over 1,000 stars on GitHub and remains a reference implementation for the architecture.
MLP-Mixer processes an image as a sequence of patches, then alternates two kinds of MLP blocks: token-mixing MLPs that let information flow across patches, and channel-mixing MLPs that mix features within each patch. This implementation wraps that idea in a small, readable package you can install from PyPI and configure through plain constructor arguments — image size, channels, patch size, hidden dimension, depth, and number of classes. Variants for rectangular images are supported as well. The repository includes usage examples that take you from a random tensor to model predictions in a few lines, and the implementation has been kept compatible with modern PyTorch, with repository activity continuing into 2025. Because the code stays close to the paper, it doubles as teaching material for how far simple architectures can go.
The package has become a standard reference in discussions about architectural minimalism: if an all-MLP model can reach respectable accuracy on image classification, then much of what transformers and convolutions add is about inductive bias and training dynamics rather than raw necessity. Researchers use implementations like this one as controlled baselines when proposing new architectures, and educators use it to show that influential ideas can often be expressed in a small amount of readable code rather than a sprawling framework.
MLP-Mixer PyTorch is free and open source under the MIT license.
It suits researchers, students, and engineers exploring minimalist vision architectures, prototyping image classifiers, or teaching how modern vision models work under the hood.