ML Systems Lab Open interactive version →
Advanced 60 min read MAEmasked autoencoderBERTmasked predictionViT

Masked Autoencoders and Masked Prediction

MAE, BERT masking, high masking ratio, asymmetric encoder-decoder, data2vec

A 224×224 image divides into 196 patches of 16×16 pixels each. MAE masks 75% of them—147 patches—and asks the encoder to see only the remaining 49. The decoder, given the encoded visible patches plus learnable mask tokens, reconstructs the original pixel values of all 147 hidden patches. The question is: why does this work at 75% masking but fail to learn semantics at 25% masking?

At 25% masking, there are enough adjacent unmasked patches that a model can solve the reconstruction task by bicubic interpolation. It copies pixel values from neighboring patches, produces low reconstruction error, and learns nothing about global image structure. The training objective is satisfied without semantic encoding. This is the fundamental failure mode of naive generative SSL applied to images: spatial redundancy gives the model a shortcut that bypasses the intended learning signal.

At 75% masking, local interpolation becomes geometrically impossible. There are no adjacent unmasked patches to copy from. Reconstruction now requires understanding that this region of sky is above this horizon, that this arm extends from this torso, that this wheel is underneath this car. The encoder must encode global semantic relationships because local statistics cannot solve the task. MAE's ablations show linear probe accuracy rising monotonically from 25% to 75% masking—the shortcut disappears gradually as masking increases.

The architectural asymmetry matters for the same reason. MAE's encoder processes only 49 visible patches. A shallow decoder (8 Transformer blocks versus the encoder's 24) receives the encoded patches plus mask tokens and reconstructs pixel values. If the decoder were deep and powerful, it could absorb the reconstruction burden through internal inpainting—doing the semantic work that should force the encoder to learn. The weak decoder ensures reconstruction quality depends primarily on what the encoder encoded. Both the masking ratio and the asymmetric architecture are constraints that close the same shortcut from different directions.

NOT this. "MAE is just image compression" is wrong. Compression aims for compact, lossless or near-lossless representation of pixel values. MAE's goal is not compression—it is producing representations that transfer to downstream tasks. The pixel reconstruction loss is low-level, but the representations that make reconstruction possible at 75% masking are not. A high-quality compressor trained to minimize MAE's pixel loss would not produce useful classification representations; a model forced to solve MAE's reconstruction task builds semantic understanding because there is no other way to solve it.

Key points

Takeaway

MAE's 75% masking ratio is not arbitrary—it is the threshold where local interpolation from adjacent patches becomes geometrically impossible, forcing the encoder to capture global semantic structure. The weak decoder closes the same shortcut from the architecture side: a strong decoder would do the semantic work internally and allow the encoder to be shallow. Together, the masking ratio and architectural asymmetry ensure reconstruction quality can only come from genuine semantic encoding.

Recap

Check your understanding

Q1. Select the two true statements about what happens when MAE's masking ratio is reduced from 75% to 25%.

Q2. Why is the MAE decoder deliberately made shallow and weak, even though a stronger decoder would produce better reconstruction?

Q3. Compare MAE and data2vec on the same ViT backbone. For which downstream task would you prefer MAE, and for which would you prefer data2vec?

Try it interactively

ML Systems Lab is a free interview-prep platform for ML engineers — work through the full interactive module, quizzes, and drills.

Open ML Systems Lab →