MAE: Masked Autoencoders Are Scalable Vision Learners
Hide 75% of an image, train a network to redraw the missing pixels, and keep its encoder as a vision model.
The encoder only ever sees the visible quarter of each image. A small second network puts placeholders in the holes and does the redrawing, then gets thrown away. Pre-trained this way without labels and then fine-tuned, a standard Vision Transformer beats the same model trained on labeled ImageNet from scratch.
Explaining the paperMasked Autoencoders Are Scalable Vision LearnersA ViT-Huge pre-trained this way on the 1.28 million unlabeled images of ImageNet-1K, then fine-tuned with labels, reaches 87.8% top-1, past the previous best of 87.1% for any method trained on ImageNet-1K alone. Pre-training a ViT-Large takes 31 hours on 128 TPU-v3 cores.
Language models learn from unlabeled text by filling in blanks. BERT hides some of the words in a sentence and trains a Transformer to predict them from the rest; the internal features it learns transfer to almost any language task. GPT predicts the next word, which is the same idea with the blank always at the end. By 2021 this recipe had made large self-supervised models the default in language, while vision pre-training still mostly meant supervised training on large labeled datasets.
The paper gives two reasons vision lagged. Convolutional networks, the dominant architecture for the previous decade, operate on a regular pixel grid and have no natural way to accept a “this patch is missing” token or a position embedding. The Vision Transformer removed that obstacle by treating an image as a sequence of patch tokens. The second reason is a difference in the data: images carry far less information per patch than text carries per word, so a blank that is hard in a sentence is easy in a picture.
MAE, by Kaiming He and colleagues at FAIR, made fill-in-the-blank pre-training work for images at scale. A few decisions explain all of it: how much of the image to hide, what the encoder is allowed to see, where the placeholders for the missing patches enter the network, what the reconstruction is scored against, and how the trained encoder is evaluated. The sections below take them in that order, then cover the compute savings and the results.
What a masked autoencoder is
An autoencoder is a network in two halves. The encoder maps an input to an internal representation, and the decoder maps that representation back to the input. The pair is trained to reproduce its own input, so the representation has to retain whatever the decoder needs to rebuild it. After training, the encoder is kept as a feature extractor: a function from raw data to vectors that are useful for other tasks.
A plain autoencoder with a wide enough internal representation can learn the identity function: the encoder passes the input through and the decoder copies it back out, with zero reconstruction error and no useful features. The classical fix is a narrow bottleneck that makes copying impossible, which also caps how much the representation can hold. The denoising autoencoder of Vincent and colleagues (2008) removes the copy route differently: it damages the input and asks for the clean original. Input and target now differ, so the network has to learn how the parts of an input relate to repair it. One kind of damage sets a random fraction of the input entries to zero; the 2010 follow-up paper calls it masking noise, alongside additive Gaussian noise and salt-and-pepper noise.
MAE describes itself as “a form of denoising autoencoding.” Its damage is masking applied to whole image patches, its encoder and decoder are Transformers, and it is self-supervised: the hidden pixels are the training targets, so no human labels are needed and any collection of images is a training set. The paper pre-trains on the ImageNet-1K training images with their labels discarded.
Why images need a different mask
BERT selects 15% of the tokens in a sentence and trains a Transformer to predict them from the remaining 85%, computing the loss only at the selected positions. Of the selected 15%, 80% are replaced by a [MASK] token, 10% by a random word, and 10% are left unchanged, so about 12% of all tokens become the literal [MASK]. The split exists because [MASK] never appears when the model is later used on real text; that mismatch between pre-training input and deployment input comes back below as the reason MAE's encoder never sees a mask token.
A sentence is dense: each word carries meaning, so predicting one blanked word requires using the others. An image is recorded light with heavy spatial redundancy. A missing 16×16 patch of sky, grass or wall can usually be reconstructed by continuing the colors and edges of the patches around it, with no knowledge of what object it belongs to. With 15% of the patches hidden, nearly every hole is surrounded by visible neighbors, and the reconstruction task can be solved by interpolation.
The figure below uses no neural network. It masks the patches of a small synthetic scene and fills each hole with the smoothest surface that matches the visible pixels at its border, which is what “continuing colors and edges inward” means mathematically. Watch the fill error as the ratio rises, and compare the three sampling rules the paper tests at 75%.
At 15% random masking the interpolated scene is close to the original. At 75% most of the house, the tree trunk and the fence are hidden, and the fill is a smear. Grid sampling, which keeps one patch in every 2×2 block, also hides 75%, but every hole still borders a visible patch, so the fill error stays low. The paper reports what each rule does to the learned features (ViT-L, 800 epochs of pre-training): random 75% gives 84.9% after fine-tuning (the whole network trained further on labels) and 73.5% on a linear probe (a single linear classifier trained on the frozen encoder's features; both protocols are compared below); grid 75% gives 84.0% and 66.0%, and the paper notes its reconstructions are sharper and its training loss lower; block-wise sampling, which removes large rectangles, gives 83.9% and 72.3% at 50% and degrades to 82.8% and 63.9% at 75%, with a higher training loss and blurrier reconstructions.
A task that interpolation can solve (low ratio, grid) produces weaker features, and so does a task with too little left to infer from (block at 75%); random sampling at a high ratio sits between. In the paper's words, the model has to make sense of “the gestalt of objects and scenes, which cannot be simply completed by extending lines or textures.” So MAE's first change to BERT's recipe is to mask about 75% of the patches, five times BERT's rate. Its second change, keeping mask tokens out of the encoder, comes from the architecture.
How MAE works, patch by patch
Follow one 224×224 RGB image through a ViT-Large MAE. The image is cut into 16×16-pixel patches, a 14×14 grid of 196 patches, and each patch is flattened to 16 × 16 × 3 = 768 numbers. One shared linear layer maps every patch to a 1024-dimensional token, and a position embedding is added to each token, so each token carries the grid position its patch came from.
Masking needs no special sparse operations. Draw one random number per patch, sort the patches by it, and keep the first 49 (25% of 196, from int(196 * 0.25)). This samples patches uniformly without replacement. The other 147 tokens are dropped. The encoder, the full 24-block ViT-Large, runs on the 49 visible tokens only. It does about a quarter of the work it would do on the full image, and it never sees a placeholder.
The decoder rebuilds the full set. A linear layer projects the 49 encoded tokens from width 1024 down to the decoder's width of 512. Then 147 copies of a single learned 512-dimensional vector, the mask token [M], are appended, one per missing patch. The 196 tokens are unshuffled back into grid order with the inverse of the sort, and the decoder adds its own position embeddings. Those embeddings are the only thing that distinguishes one copy of [M] from another; without them all 147 copies would enter the decoder as identical inputs and produce identical outputs. Eight Transformer blocks of width 512 run on all 196 tokens, and a final linear layer maps each token to 768 numbers, the predicted pixels for that patch. Predictions come out at all 196 positions; the loss compares them to the true pixels at the 147 masked positions and ignores the other 49.
[M] token repeated); the loss covers the masked patches only. At 75% the encoder handles 4× fewer tokens than a full-image ViT, and its self-attention map, which grows with the square of the token count, shrinks to about 6%.# one MAE forward pass for ViT-L (simplified from the official models_mae.py;
# the class token is dropped here for clarity)
def forward(imgs, mask_ratio=0.75): # imgs: [B, 3, 224, 224]
x = patch_embed(imgs) # [B, 196, 1024]: 768 -> 1024
x = x + pos_embed # fixed 2D sin-cos, not trained
# random subset without replacement: shuffle, keep the first 25%
noise = rand(B, 196)
ids_shuffle = argsort(noise, dim=1) # a random order per image
ids_restore = argsort(ids_shuffle, dim=1) # its inverse permutation
keep = int(196 * (1 - mask_ratio)) # 49
x = gather(x, ids_shuffle[:, :keep]) # [B, 49, 1024], visible only
x = encoder(x) # 24 blocks on 49 tokens, no [M]
# decoder: project, append mask tokens, undo the shuffle
x = decoder_embed(x) # [B, 49, 512]
m = mask_token.repeat(B, 196 - keep, 1) # 147 copies of one vector
x = cat([x, m], dim=1) # [B, 196, 512], shuffled order
x = gather(x, ids_restore) # back to grid order
x = x + decoder_pos_embed # how copies of [M] differ
x = decoder(x) # 8 blocks on all 196 tokens
return decoder_pred(x) # [B, 196, 768] pixels/patchThe two argsort calls carry the bookkeeping. The first produces a random permutation; taking its first 49 entries selects the visible patches. The second is the inverse permutation, which puts the appended mask tokens back at the grid positions of the patches they stand for. Shuffling and unshuffling are cheap, and the paper measures their overhead as negligible.
The position embeddings in both encoder and decoder are fixed 2D sine-cosine patterns computed from each patch's row and column; the code stores them with requires_grad=False. The original ViT learns its position embeddings as 1D parameters, so MAE does not inherit them. The official code also prepends a class token to the encoder input so the trained encoder matches the standard ViT interface; the paper notes MAE works about as well without it, using the average of the output tokens.
The loss and the pixel target
The loss is mean squared error in pixel space, averaged over the masked patches. Write for the set of masked patch indices, for the 768 true pixel values of patch , and for the decoder's prediction:
The paper states the loss in words; equation (1) is this page's notation for it, and the matches the code, which averages over a patch's pixels before averaging over patches. At 75% masking, holds 147 patches, so each image contributes 147 × 768 = 112,896 squared errors and the 49 visible patches contribute nothing. Scoring the visible patches too would add a term the network can minimize by passing those patches through; the paper measured that variant at about 0.5% lower accuracy.
The target can also be normalized per patch. Compute the mean and variance of patch 's 768 values and replace the target by
Normalization rescales every patch to unit variance. A patch of clear sky with pixel standard deviation 0.02 has its small variations multiplied by 50, while a patch of picket fence with standard deviation 0.3 is multiplied by about 3.3. Without it the loss is dominated by high-contrast patches and a blurry guess is cheap on flat ones; with it, every patch's local structure counts equally. The paper describes this as enhancing local contrast, and it helps: ViT-L goes from 84.9% to 85.4% fine-tuned and 73.5% to 73.9% on the linear probe (Table 1d). The ablation tables use unnormalized pixels; the released 1600-epoch models use normalized ones. Replacing the target with its top 96 PCA coefficients, which discards high frequencies, lowers accuracy to 84.6% and 72.3%.
# loss: squared error in pixel space, averaged over masked patches only
def forward_loss(imgs, pred, mask): # mask: [B, 196], 1 = masked
target = patchify(imgs) # [B, 196, 768] true pixels
if norm_pix_loss: # normalize each target patch
mean = target.mean(dim=-1, keepdim=True)
var = target.var(dim=-1, keepdim=True)
target = (target - mean) / (var + 1e-6) ** 0.5
loss = ((pred - target) ** 2).mean(dim=-1) # [B, 196] per-patch MSE
return (loss * mask).sum() / mask.sum() # mean over masked patchesMAE's target is raw pixels. BEiT, the main prior masked-image method for ViTs, predicts discrete tokens from a separately trained dVAE tokenizer (a discrete variational autoencoder that maps each patch to one of 8,192 codebook entries): an extra pre-training stage, using DALL-E's tokenizer trained on 250 million extra images, and a convolutional network with 40% of ViT-L's FLOPs. In the paper's comparison, an MAE that predicts those tokens fine-tunes 0.4 points better than unnormalized pixels and no better than normalized pixels (85.3% vs 85.4%), with a lower linear probe.
Why 75 percent
Two evaluation protocols appear in every result from here on. Fine-tuning takes the pre-trained encoder, adds a classifier, and trains the whole network on labeled ImageNet; it measures how good a starting point pre-training provides. Linear probing freezes the encoder and trains only a single linear layer on its output features; it measures whether the classes are already linearly separable in the frozen features. The paper trains every ablation model for 800 epochs and reports both numbers for ViT-L, against a from-scratch supervised ViT-L at 82.5% (the original ViT recipe got 76.5%; the authors' stronger regularization raised it). The figure below plots the paper's masking-ratio sweep; step through the ratios and compare how the two panels move.
Fine-tuning has two levels: 83.2 to 83.4% for ratios of 10 to 30%, then 84.5 to 85.0% from 40 to 80%, dropping to 83.0% at 90%. Every point beats training from scratch. Linear probing climbs steadily from 54.6% at 10% to 73.5% at 75%, a range of about 20 points, then falls to 71.8% at 80% and 66.1% at 90%. The 75% setting is the linear-probe peak and within 0.1 point of the fine-tuning peak (85.0% at 60%), which is why the paper uses it. It also means the encoder processes a quarter of the patches, a combination the paper calls a “win-win”: higher accuracy and less compute from the same choice.
The two curves also respond differently. Fine-tuning is forgiving across a wide band because the whole network can adjust to the labeled task; the linear probe reports only what the frozen features already contain. That gap comes back three more times on this page: with the mask token, with decoder depth, and in the comparison with contrastive learning.
Keeping mask tokens out of the encoder
In BERT the [MASK] tokens flow through every layer of the Transformer. The direct port to images would do the same: give the encoder all 196 positions, with the 147 masked ones replaced by [M]. MAE instead introduces [M] only in the decoder, and the paper trains both designs.
In the BERT-style variant, the encoder's pre-training input is 49 real patches and 147 copies of the placeholder, so 75% of its input positions hold a token that means “something was here.” At deployment the encoder receives an uncorrupted image: 196 real patches and no placeholders. Its weights were fit to one input distribution and are then used on another. In MAE the encoder sees only real patches in both settings; only the number of them changes, from 49 to 196.
The measured cost of the gap falls on the linear probe: 73.5% without mask tokens in the encoder, 59.6% with them, a drop of 13.9 points. Fine-tuning moves only from 84.9% to 84.2%. Full fine-tuning retrains the encoder on complete images and can adapt to the new input distribution, which would explain why it barely moves, while a frozen probe has to use the features as they are. The BERT-style variant also runs the encoder on all 196 tokens, which multiplies the overall pre-training FLOPs by 3.3.
Where the 3× speedup comes from
The abstract says MAE accelerates training “by 3× or more.” The number can be reproduced by counting multiply-adds. A Transformer block of width processing tokens spends on matrix multiplies whose cost is proportional to the token count (the query, key, value and output projections, , plus the MLP that widens to and back, ), and on the attention map itself ( and the weighted sum of values), which grows with the square of the token count:
ViT-L has width 1024 and 24 blocks. On all 196 tokens, one block costs 2.466 billion multiply-adds in the linear terms and 0.079 billion in the attention map, so attention is about 3% of the encoder and the full encoder costs 61.1 billion. On 49 visible tokens the linear terms drop by exactly 4 and the attention map by 16, giving 14.9 billion: a 4.09× saving. The saving is always at least 4× at 75% masking, and how far it exceeds 4 depends on the attention share, which grows with the number of tokens. The paper puts it as: the speedup “can be >4× for a masking ratio of 75%, partially because the self-attention complexity is quadratic.”
The decoder runs on all 196 tokens in either design. Its 8 blocks at width 512 cost 5.25 billion, 8.6% of the encoder per token (the paper rounds to 9%). A BERT-style pre-training step costs 61.1 + 5.25 = 66.3 billion; MAE's costs 14.9 + 5.25 = 20.2 billion. The ratio is 3.29, the paper's 3.3×. The measured wall-clock gain is smaller, 2.8× (15.4 hours against 42.4 for the same schedule), and larger with a smaller decoder or a bigger encoder: 3.7× for ViT-L with a 1-block decoder, 3.5× for ViT-H, 4.1× for ViT-H with a 1-block decoder. Memory use also drops sharply, which allows larger batches or larger models.
At 224 px the encoder bars shrink almost exactly in proportion to the visible tokens, because the amber attention slice is thin. At 896 px (3,136 tokens) attention is about a third of the full encoder, and 75% masking saves 5.36× in the encoder. At 0% masking every ratio reads 1.00; at 90%, with 19 visible tokens out of 196, the encoder is 10.6× cheaper and the decoder becomes nearly half of the step.
The decoder that gets discarded
The decoder is used only during pre-training. Afterwards it is deleted, and the encoder alone is applied to uncorrupted images, all 196 patches with no masking, for recognition tasks, so its architecture can be chosen independently of the encoder's, and the default is small: 8 blocks of width 512 with 16 attention heads, the same decoder for ViT-B, ViT-L and ViT-H. Keeping it small matters because it is the one component that processes all 196 tokens.
Its size still affects the encoder it leaves behind. Reconstructing exact pixels is a low-level task, and the last layers of an autoencoder tend to specialize in it. With a 1-block decoder, those reconstruction-specific layers have to be the encoder's own top layers, pulling its output toward pixel detail. With a deeper decoder, the decoder absorbs that specialization and the encoder's output can stay at a more abstract level, which is what a linear classifier needs. A single block is the minimum needed to pass information from the visible tokens to the mask tokens, since attention is the only operation that mixes tokens.
With depth, linear probing goes 65.5, 70.0, 71.9, 73.5% at 1, 2, 4, 8 blocks, an 8-point gain, and 73.3% at 12. Fine-tuning reads 84.8% with a single block and 84.9% from 2 to 8, because fine-tuning can retrain the encoder's top layers for classification whatever the decoder did. With width, the probe rises from 69.1% at 128 channels to 73.5% at 512 and stays near 73.1% above it, while fine-tuning dips to 84.3% at 1024. A 1-block decoder is the fastest option for a model that will be fine-tuned anyway: 84.8% fine-tuned, and 3.7× wall-clock speedup instead of 2.8×.
Linear probing versus fine-tuning
Linear probing had been the standard yardstick for self-supervised vision for several years before MAE. It measures one property: whether a single linear cut through the frozen features separates the classes. The paper argues that this misses features that are strong but non-linear, and tests the claim with partial fine-tuning: unfreeze the last of the encoder's 24 blocks and fine-tune them with the classifier, leaving the rest frozen. Zero blocks is linear probing and all 24 is full fine-tuning.
The comparison is MoCo v3, a contrastive method by overlapping authors. Contrastive learning trains the encoder so that two differently augmented crops of the same image get similar embeddings and crops of different images get dissimilar ones. That objective acts directly on the geometry of the embedding space, pulling each image's views together and other images apart, which is a likely reason contrastive methods lead linear-probe tables.
With no blocks tuned, MoCo v3 leads, 77.6% to 73.5%. Tuning the last block's MLP alone lifts MAE to 79.1%, and tuning one full block lifts it to 81.0%, 7.5 points above its linear probe and 1.1 above MoCo v3 at one block (79.9%). MAE leads at every measured point from there: 83.1 vs 80.8 at two blocks, 84.2 vs 81.6 at four (the 2.6-point gap the paper quotes), 84.9 vs 84.1 at full fine-tuning. Four to six tuned blocks get MAE within a point of full fine-tuning.
MAE's features are less linearly separable and more useful once even a small non-linear head is trained on top. The paper concludes that linear separability should not be the only measure of representation quality, and notes that linear probing also correlates poorly with transfer to detection. Both curves here use the 800-epoch ablation model; the released 1600-epoch ViT-L reaches 75.8% on the linear probe, still below MoCo v3's 77.6%.
Results: scaling and transfer
The title's “scalable” refers to how the gain behaves as models grow. The final models are pre-trained for 1600 epochs with normalized-pixel targets and fine-tuned at 224 px: ViT-B reaches 83.6%, ViT-L 85.9%, ViT-H 86.9%. Fine-tuned at 448 px, ViT-H reaches 87.8%; the previous best using only ImageNet-1K data was 87.1%, at 512 px, from a more elaborate architecture. MAE's encoder is a standard ViT. On the same hardware the 1600-epoch ViT-L run takes 31 hours, against 36 hours for MoCo v3's 300 epochs: per epoch, MAE's encoder sees 25% of the patches, while a two-crop contrastive encoder sees 200%.
Supervised training from scratch saturates: 82.3%, 82.6% and 83.1% for ViT-B, ViT-L and ViT-H, because the larger models overfit ImageNet-1K. With MAE pre-training the gain grows with capacity, from 1.3 points for ViT-B to 3.3 for ViT-L and 3.8 for ViT-H. MAE reaches this trend using no data beyond ImageNet-1K; the paper compares it to the one the original ViT paper got from supervised pre-training on the 300-million-image JFT dataset. (The ablations use 82.5% for the ViT-L from-scratch baseline; Table 3 lists 82.6%.)
The encoder also transfers to detection and segmentation. Box AP (average precision of predicted bounding boxes, in points, higher is better) is the standard COCO detection score. As the backbone of a Mask R-CNN detector fine-tuned on COCO, MAE pre-training gives ViT-L 53.3 box AP against 49.3 for supervised pre-training, a gain of 4.0, and ViT-B 50.3 against 47.9. MoCo v3 matches supervised pre-training there (47.9 for ViT-B). On ADE20K semantic segmentation with a UperNet head, ViT-L improves from 49.9 to 53.6 mIoU (+3.7), where mIoU is the overlap between predicted and true regions per class, averaged over classes. Pixel-predicting MAE matches or beats token-predicting BEiT on both.
MAE also needs little data augmentation, unlike contrastive methods, whose training signal comes from comparing two augmented views of each image. Cropping-only augmentation costs BYOL 13 points and SimCLR 28. MAE's default is cropping only (random-size crops with horizontal flips), and adding color jitter makes it worse (84.3% / 71.9%). With no augmentation (center crop, no flip), fine-tuning stays close at 84.0% against 84.9%, but the linear probe drops to 65.7% from 73.5%. The paper credits the masking: each epoch draws a new random mask for every image, so the model sees a different training example each time.
Later work kept the masking and the visible-only encoder and changed the target. I-JEPA predicts learned embeddings of the hidden regions instead of their pixels. MAE weights also became a common initialization for other systems: Segment Anything starts its ViT-H image encoder from them.
Training recipe
The pre-training configuration is the paper's Table 8. The optimizer is AdamW with set to 0.95 instead of the usual 0.999, a choice the paper takes from iGPT and makes for training stability. The learning rate follows the linear scaling rule, so a batch of 4096 gives 1.5e-4 * 4096 / 256 = 2.4e-3.
# pre-training defaults (paper Table 8, ViT-L)
optimizer = AdamW(betas=(0.9, 0.95), weight_decay=0.05)
base_lr = 1.5e-4
batch_size = 4096
lr = base_lr * batch_size / 256 # = 2.4e-3, linear scaling rule
schedule = cosine decay, 40 warmup epochs
epochs = 800 # ablations; 1600 for the released models
augmentation = RandomResizedCrop + horizontal flip # no color jitter
mask_ratio = 0.75
norm_pix_loss = True # used by the released models; off in the ablation tablesFine-tuning runs 50 epochs for ViT-L and ViT-H (100 for ViT-B) with layer-wise learning-rate decay of 0.75, so each block trains at 0.75 times the learning rate of the block above it, and with the regularizers mixup, cutmix and drop path. Linear probing uses the opposite: the large-batch LARS optimizer for 90 epochs with no mixup, cutmix, drop path or weight decay, a batch of 16,384, and a BatchNorm layer without learned scale or shift in front of the linear classifier. That layer normalizes the frozen features so different ablation models can share one learning rate, and after training it can be folded into the linear layer, so the probe stays linear.
Questions you might still have
If the decoder is thrown away, why does its design matter?
During pre-training the decoder sets how much of the pixel-level work the encoder has to do itself. With a 1-block decoder the encoder's last layers specialize in reconstruction; with 8 blocks the decoder takes that job and the encoder's output stays more abstract. In the paper this moves the frozen linear-probe accuracy from 65.5% to 73.5% for ViT-L, while fine-tuning stays at 84.8 to 84.9%.
Why does hiding 75% of the image not destroy the signal?
Natural images are spatially redundant: neighboring patches are strongly correlated, so 49 random patches still outline the objects in the scene. The task stays solvable but can no longer be solved by smoothing colors in from adjacent patches, because most adjacent patches are gone too. At 90% masking both accuracy measures fall (fine-tuning 83.0%, linear probe 66.1%), so there is a limit.
Is MAE just BERT for images?
The objective is the same: hide part of the input, predict it, keep the encoder. Two choices differ, and the paper tests each separately. A low masking ratio gives weak features: at 10% and 20% masking the linear probe reaches 54.6% and 58.9%, against 73.5% at 75%. Feeding mask tokens through the encoder, at 75% masking, drops the linear probe from 73.5% to 59.6% and costs 3.3 times the training FLOPs. The paper never runs both choices together.
Why reconstruct pixels instead of a learned representation?
MAE predicts pixels because that needs no tokenizer and no second network, and in the paper normalized pixels match BEiT-style dVAE tokens within 0.2 points on every benchmark it tried. The joint-embedding line takes the other side. I-JEPA (see the I-JEPA explainer) keeps the masking but predicts the embedding of each hidden region, computed by a slowly updated copy of the encoder, on the argument that a pixel loss spends capacity on texture a classifier does not need.
Why compute the loss only on the masked patches?
The visible patches are part of the input, so reproducing them only requires passing them through. Scoring only the hidden patches puts all of the gradient on the prediction task. The paper measures the alternative: computing the loss on all pixels lowers accuracy by about 0.5%.
Can an MAE be used to generate images?
It reconstructs plausible content for hidden patches, and the paper shows such reconstructions, but the outputs are blurry and it is not trained as a sampler of new images. The broader-impacts note warns that because it predicts from training-set statistics, it can produce content that does not exist and will reflect biases in the data.
Where is MAE pre-training used today?
MAE-pretrained ViTs became a standard starting point for dense vision tasks. Segment Anything, for example, starts its ViT-H image encoder from MAE weights (covered in the SAM explainer). In this paper MAE pre-training gives ViT-L +4.0 box AP on COCO and +3.7 mIoU on ADE20K over supervised pre-training.
Footnotes & further reading
- The paper: He, Chen, Xie, Li, Dollár, Girshick, Masked Autoencoders Are Scalable Vision Learners (arXiv 2021; CVPR 2022). Official code; the model is in
models_mae.pyand the training flags in PRETRAIN.md. - The masked-prediction ancestor in language: BERT (Devlin et al., 2018), explained at /bert/.
- The backbone: An Image is Worth 16x16 Words (Dosovitskiy et al., 2020), explained at /vit/; the Transformer it is built from is at /attention-is-all-you-need/.
- The denoising-autoencoder line: Vincent, Larochelle, Bengio, Manzagol, Extracting and Composing Robust Features with Denoising Autoencoders (ICML 2008), and the Stacked Denoising Autoencoders paper (JMLR 2010) that names “masking noise.”
- Earlier masked image modeling: iGPT (Chen et al., 2020), which trains with an autoregressive or a BERT-style objective over pixels, and BEiT (Bao et al., 2021).
- The contrastive baseline: An Empirical Study of Training Self-Supervised Vision Transformers (MoCo v3, Chen et al., 2021). Another self-supervised ViT method in the paper's Table 3 is DINO, explained at /emerging-properties-in-self-supervised-vision/.
- Successors and users: I-JEPA (Assran et al., 2023), which predicts representations of masked blocks instead of pixels, and Segment Anything, whose image encoder starts from an MAE-pretrained ViT-H.
How could this explainer be improved? Found an error, or something unclear? I read every message.