{"notes":[{"id":"vision-transformers/mae","category":"vision-transformers","legacyPath":"vision-transformers/2111-mae","legacySlug":"2111-mae","legacyPaths":[],"title":"MAE","subtitle":"A Quarter of the Clue","author":"Z. Yuan","paperDate":"2021-11-11","publishedOn":"2024-08-27","paperTitle":"Masked Autoencoders Are Scalable Vision Learners","paperUrl":"https://arxiv.org/abs/2111.06377","bibliography":{"title":"Masked Autoencoders Are Scalable Vision Learners","authors":["Kaiming He","Xinlei Chen","Saining Xie","Yanghao Li","Piotr Dollár","Ross Girshick"],"url":"https://arxiv.org/abs/2111.06377","pdfUrl":"https://arxiv.org/pdf/2111.06377","codeUrl":"https://github.com/facebookresearch/mae","preprint":{"id":"2111.06377","submittedOn":"2021-11-11","url":"https://arxiv.org/abs/2111.06377"},"publication":{"venue":"CVPR","year":2022,"kind":"conference","url":"https://openaccess.thecvf.com/content/CVPR2022/html/He_Masked_Autoencoders_Are_Scalable_Vision_Learners_CVPR_2022_paper.html"},"citation":"@misc{visiontransformersmae2021,\n  title = {{Masked Autoencoders Are Scalable Vision Learners}},\n  author = {Kaiming He and Xinlei Chen and Saining Xie and Yanghao Li and Piotr Dollár and Ross Girshick},\n  year = {2021},\n  eprint = {2111.06377},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/2111.06377}\n}\n","citationPath":"/content/papers/citations/vision-transformers/mae.762f979b1c32.bib"},"thumbnail":{"src":"/content/papers/assets/f6a24c00fab9f102a2680899072c0e9de2ff2ae0cd7197666455a34c566f6542.jpg","width":1224,"height":716},"locale":"en","path":"/content/papers/en/vision-transformers/mae.b12d186b7307.md","headings":[{"id":"define-the-problem","text":"Define the problem","depth":2},{"id":"solve-the-problem","text":"Solve the problem","depth":2},{"id":"give-the-encoder-only-visible-patches","text":"Give the encoder only visible patches","depth":3},{"id":"reconstruction-target-and-loss","text":"Reconstruction target and loss","depth":3},{"id":"experimental-results-and-discussion","text":"Experimental results and discussion","depth":2},{"id":"establish-the-baseline-first","text":"Establish the baseline first","depth":3},{"id":"why-75-masking","text":"Why 75% masking?","depth":3},{"id":"the-decoder-need-not-match-the-encoders-weight","text":"The decoder need not match the encoder's weight","depth":3},{"id":"pixels-or-tokens-as-targets","text":"Pixels or tokens as targets?","depth":3},{"id":"the-retained-augmentations","text":"The retained augmentations","depth":3},{"id":"mask-shape-changes-the-task","text":"Mask shape changes the task","depth":3},{"id":"read-accuracy-with-training-time","text":"Read accuracy with training time","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{"defining-the-problem":"define-the-problem","solving-the-problem":"solve-the-problem","model-architecture":"give-the-encoder-only-visible-patches","training-method":"reconstruction-target-and-loss","discussion":"experimental-results-and-discussion","how-much-masking-is-optimal":"why-75-masking","decoder-parameters":"the-decoder-need-not-match-the-encoders-weight","learning-targets":"pixels-or-tokens-as-targets","data-augmentation":"the-retained-augmentations","masking-strategy":"mask-shape-changes-the-task","performance-on-imagenet":"read-accuracy-with-training-time","less-augmentation-does-not-mean-none":"the-retained-augmentations"},"guide":null,"relatedReading":[{"id":"vision-transformers/beit","relation":"comparison","topic":"Reconstructing pixels or visual tokens"},{"id":"image-generation/mar","relation":"comparison","topic":"Reconstructing pixels or visual tokens"}]},{"id":"vision-transformers/beit","category":"vision-transformers","legacyPath":"vision-transformers/2106-beit","legacySlug":"2106-beit","legacyPaths":[],"title":"BEiT","subtitle":"Discrete Encoding Pre-Training","author":"Z. Yuan","paperDate":"2021-06-15","publishedOn":"2024-07-24","paperTitle":"BEiT: BERT Pre-Training of Image Transformers","paperUrl":"https://arxiv.org/abs/2106.08254","bibliography":{"title":"BEiT: BERT Pre-Training of Image Transformers","authors":["Hangbo Bao","Li Dong","Songhao Piao","Furu Wei"],"url":"https://arxiv.org/abs/2106.08254","pdfUrl":"https://arxiv.org/pdf/2106.08254","codeUrl":null,"preprint":{"id":"2106.08254","submittedOn":"2021-06-15","url":"https://arxiv.org/abs/2106.08254"},"publication":{"venue":"ICLR","year":2022,"kind":"conference","url":"https://openreview.net/pdf?id=p-BhZSz59o4"},"citation":"@misc{visiontransformersbeit2021,\n  title = {{BEiT: BERT Pre-Training of Image Transformers}},\n  author = {Hangbo Bao and Li Dong and Songhao Piao and Furu Wei},\n  year = {2021},\n  eprint = {2106.08254},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/2106.08254}\n}\n","citationPath":"/content/papers/citations/vision-transformers/beit.57788bd3bad1.bib"},"thumbnail":{"src":"/content/papers/assets/b63230200cc9c8058f03ba8afc2fac203e6f48519ad44e4a300fa7cbbc9093b1.jpg","width":1578,"height":862},"locale":"en","path":"/content/papers/en/vision-transformers/beit.30b2eb828777.md","headings":[{"id":"problem-definition","text":"Problem Definition","depth":2},{"id":"problem-solving","text":"Problem Solving","depth":2},{"id":"model-architecture","text":"Model Architecture","depth":3},{"id":"training-method","text":"Training Method","depth":3},{"id":"fine-tuning-for-downstream-tasks","text":"Fine-tuning for Downstream Tasks","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"performance-on-imagenet","text":"Performance on ImageNet","depth":3},{"id":"ablation-studies","text":"Ablation Studies","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[{"id":"vision-transformers/beit-v2","relation":"next","topic":"Masked visual pretraining"},{"id":"vision-transformers/mae","relation":"comparison","topic":"Reconstructing pixels or visual tokens"},{"id":"image-generation/mar","relation":"comparison","topic":"Reconstructing pixels or visual tokens"}]},{"id":"image-generation/mar","category":"image-generation","legacyPath":"image-generation/2406-mar","legacySlug":"2406-mar","legacyPaths":[],"title":"MAR","subtitle":"Reforging the Order of Generation","author":"nbswords","paperDate":"2024-06-17","publishedOn":"2025-05-17","paperTitle":"Autoregressive Image Generation without Vector Quantization","paperUrl":"https://arxiv.org/abs/2406.11838","bibliography":{"title":"Autoregressive Image Generation without Vector Quantization","authors":["Tianhong Li","Yonglong Tian","He Li","Mingyang Deng","Kaiming He"],"url":"https://arxiv.org/abs/2406.11838","pdfUrl":"https://arxiv.org/pdf/2406.11838","codeUrl":"https://github.com/LTH14/mar","preprint":{"id":"2406.11838","submittedOn":"2024-06-17","url":"https://arxiv.org/abs/2406.11838"},"publication":{"venue":"NeurIPS","year":2024,"kind":"conference","url":"https://arxiv.org/abs/2406.11838"},"citation":"@misc{imagegenerationmar2024,\n  title = {{Autoregressive Image Generation without Vector Quantization}},\n  author = {Tianhong Li and Yonglong Tian and He Li and Mingyang Deng and Kaiming He},\n  year = {2024},\n  eprint = {2406.11838},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/2406.11838}\n}\n","citationPath":"/content/papers/citations/image-generation/mar.a10059725836.bib"},"thumbnail":{"src":"/content/papers/assets/7d9e2036ebab3a5f2196e771c1ff55ca92c6910f1bd5b54f43735e8ca433f3cb.jpg","width":816,"height":570},"locale":"en","path":"/content/papers/en/image-generation/mar.dd318109ef24.md","headings":[{"id":"background-knowledge","text":"Background Knowledge","depth":2},{"id":"vector-quantization-vq","text":"Vector Quantization (VQ)","depth":3},{"id":"auto-regressive-image-generation","text":"Auto-regressive Image Generation","depth":3},{"id":"method","text":"Method","depth":2},{"id":"abandoning-vq-embracing-diffusion","text":"Abandoning VQ, Embracing Diffusion","depth":3},{"id":"integrating-concepts-from-autoregressive-and-masked-generative-models","text":"Integrating Concepts from Autoregressive and Masked Generative Models","depth":3},{"id":"implementation","text":"Implementation","depth":2},{"id":"experiments","text":"Experiments","depth":2},{"id":"diffusion-loss-vs-cross-entropy-loss","text":"Diffusion Loss vs. Cross-Entropy Loss","depth":3},{"id":"tokenizers","text":"Tokenizers","depth":3},{"id":"denoising-mlp","text":"Denoising MLP","depth":3},{"id":"sampling-steps-of-diffusion-loss","text":"Sampling Steps of Diffusion Loss","depth":3},{"id":"temperature-of-diffusion-loss","text":"Temperature of Diffusion Loss","depth":3},{"id":"speedaccuracy-trade-off","text":"Speed/Accuracy Trade-off","depth":3},{"id":"system-level-comparison","text":"System-Level Comparison","depth":3},{"id":"conclusion","text":"Conclusion","depth":2},{"id":"reference","text":"Reference","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[{"id":"vision-transformers/mae","relation":"comparison","topic":"Reconstructing pixels or visual tokens"},{"id":"vision-transformers/beit","relation":"comparison","topic":"Reconstructing pixels or visual tokens"}]}],"text":"In NLP, masked language modeling has become one of the best-known pretraining tasks: hide about 15% of the text tokens and ask the model to fill them in. This classic recipe gave us models such as BERT, RoBERTa, and ALBERT.\n\nWhat about images?\n\nWhy has vision not had a similarly successful pretraining method?\n\n## Define the problem\n\nViT had already tried something similar. In that paper, the authors masked part of an image and tried predicting the missing content, including pixel and region-level targets; see our [ViT note](/blog/papers/vision-transformers/vit).\n\nThe verdict in those experiments: neither approach worked as well as supervised pretraining.\n\n---\n\nThe MAE authors point to a central difference: **language and vision have different information densities.** Language is made by people and carries explicit semantic units. Images have plenty of spatial redundancy, so a model can restore a few missing patches from nearby ones without working hard to understand parts, objects, or scenes.\n\nIt can just interpolate from its neighbors. No wonder the result might disappoint.\n\n## Solve the problem\n\nTo get around that difference, the authors simply hide most of the patches. How many? Oh, just **75%**!\n\n### Give the encoder only visible patches\n\nFigure 1 shows the data flow. As in ViT, the image is first split into patches. The patches to hide are sampled at random to avoid a center bias. Masked patches are removed **before** the encoder, leaving it only the visible quarter. The decoder later inserts mask tokens and reconstructs the image at the original patch positions.\n\n![Paper Figure 1: the MAE encoder processes only visible patches](/content/papers/assets/f6a24c00fab9f102a2680899072c0e9de2ff2ae0cd7197666455a34c566f6542.jpg)\n\nSource: [paper Figure 1](https://arxiv.org/html/2111.06377). This lets a large encoder process a much smaller token sequence during pretraining. For downstream inference, remove the masks and discard the decoder, leaving the encoder to process a complete image. The smaller encoder input saves compute; it **does not reduce the size of the training dataset**. Masked patches skip the encoder input, but the encoder still receives gradients through the decoder's reconstruction loss.\n\nIn implementation, patches become tokens with positional information. The tokens are shuffled, and only the visible quarter goes into the encoder. The decoder gets encoded visible tokens, shared learned mask tokens that contain none of the missing pixels, and positional embeddings, then restores their original order. No special sparse operator is needed.\n\n### Reconstruction target and loss\n\nMAE reconstructs the input by predicting the pixel values of each masked patch. For an RGB patch of side length $P$, the decoder's final projection outputs $P^2\\times3$ pixel values. The default objective is pixel mean squared error (MSE), **computed only at masked positions**, rather than over the whole image. The decoder also emits values for visible positions, but this loss does not constrain them. A blurry visible region in the reconstruction is therefore a different issue from a wrong masked region.\n\nThe authors even give us plenty of pictures to make this easier to follow. In paper Figure 2, each triplet shows the masked input on the left, the decoder's reconstruction in the middle, and the original image on the right. These qualitative examples use **80%** masking, rather than the 75% default in the ablations below.\n\n![Paper Figure 2: masked ImageNet inputs, MAE reconstructions, and ground truth](/content/papers/assets/1d9cfb01b370abfb5720a2bfd0c1686297bd0a79c5b0bcddde3dfdd84ecdfb60.jpg)\n\nSource: [paper Figure 2](https://arxiv.org/html/2111.06377). Downstream evaluation is stronger evidence.\n\n## Experimental results and discussion\n\nMost ablations below use **ViT-L/16, ImageNet-1K, and 800 pretraining epochs**. In the tables, `ft` means end-to-end encoder fine-tuning, while `lin` freezes the encoder and trains a linear classifier. Keep the two protocols separate.\n\n### Establish the baseline first\n\nThe original ViT recipe trained ViT-L/16 from scratch to **76.5%** top-1 accuracy. The MAE authors' improved supervised training recipe reached **82.5%**. MAE pretraining followed by fine-tuning reached **84.9%**. Those first two numbers matter: a strong supervised baseline makes the pretraining gain easier to see.\n\n![Paper Section 4 ViT-L baseline comparison: 76.5%, 82.5%, and 84.9%](/content/papers/assets/fe286adcfcf95fe32d6e0d20706532373aba7f2f1e5842672d81d05231f86b82.jpg)\n\nSource: [paper Section 4, Baseline: ViT-Large](https://arxiv.org/html/2111.06377). MAE still adds **2.4 percentage points** over the authors' strong supervised baseline—almost absurdly good. The entire 76.5-to-84.9 gap, however, is not attributable to masking.\n\n### Why 75% masking?\n\nThe top panel of paper Figure 5 shows full fine-tuning and the bottom panel shows linear probing. Fine-tuning remains fairly stable at about **40–80%** masking. Linear probing improves up to **73.5% at 75% masking**, then falls. The 75% default balances representation quality and compute in these tests; it is not a rule that more masking always helps.\n\n![Paper Figure 5: fine-tuning and linear-probe accuracy at different masking ratios](/content/papers/assets/702fde186463af61a026fc97c97eae31ec8b8ef9b22eed8ea1a7f4721c78b29e.jpg)\n\nSource: [paper Figure 5](https://arxiv.org/html/2111.06377). Both vertical axes report ImageNet-1K validation accuracy, but the levels and trends differ between protocols.\n\nPaper Table 1(c) compares an encoder that receives mask tokens. Its linear-probe accuracy falls from **73.5% to 59.6%**, a **13.9-point** difference; full fine-tuning moves from **84.9% to 84.2%**, only **0.7 point**. The authors propose a pretraining-to-downstream input mismatch as one explanation, since downstream images have no mask tokens. The compute saving from fewer encoder tokens is more direct.\n\n### The decoder need not match the encoder's weight\n\nPaper Table 1(a)(b) tests decoder depth and width. An **eight-block** decoder has the best linear-probe result, **73.5%**, but depths two, four, and eight all reach **84.9%** after full fine-tuning. Width **512** is the default and half the ViT-L encoder's 1024 dimensions. It works well here; a half-width decoder is not a universal rule.\n\n![Paper Table 1(a)(b): decoder depth and width ablations](/content/papers/assets/8306ea2dd0740797fef7bc0651d7f8f9afdaddd3b054529eed1c3c21c2447f24.jpg)\n\nSource: [paper Table 1(a)(b)](https://arxiv.org/html/2111.06377). Linear-probe and fine-tuned results require separate comparison.\n\n### Pixels or tokens as targets?\n\nPaper Table 1(d) gives fine-tuning/linear-probe accuracy for four targets: raw pixels **84.9/73.5**, per-patch normalized pixels **85.4/73.9**, PCA **84.6/72.3**, and dVAE tokens **85.3/71.6**. dVAE beats raw pixels after full fine-tuning but trails normalized pixels and needs an extra pretrained tokenizer. Thus, “every alternative is worse than raw pixels” misreads the table.\n\n![Paper Table 1(d): raw and normalized pixels, PCA, and dVAE targets](/content/papers/assets/b30e8faf85aace11810c6bd8aeaf9eeda3d75e6260edb88666d6924bdec8989b.jpg)\n\nSource: [paper Table 1(d)](https://arxiv.org/html/2111.06377). The default ablation uses raw pixels; the later 1600-epoch ImageNet comparison uses normalized pixels. Check which setting a number belongs to.\n\n### The retained augmentations\n\nIn paper Table 1(e), random resized cropping with horizontal flipping scores **84.9/73.5**; fixed-size crop with flip **84.7/73.1**; center crop without random augmentation **84.0/65.7**; adding color jitter **84.3/71.9**. There is no random-rotation ablation. MAE depends less on augmentation than some alternatives, but its default still crops and flips images.\n\n![Paper Table 1(e): augmentation ablation under fine-tuning and linear probing](/content/papers/assets/1d979104d89e66e55ffa47b2f9577d66f1a2149a7a62575a0143f916dfc2553c.jpg)\n\nSource: [paper Table 1(e)](https://arxiv.org/html/2111.06377). The authors compare augmentation dependence with [SimCLR](https://arxiv.org/abs/2002.05709) and [BYOL](https://arxiv.org/abs/2006.07733). BYOL has no explicit negative pairs, so it should not be described as a conventional contrastive loss.\n\n### Mask shape changes the task\n\nIn paper Table 1(f), random 75% masking reaches **84.9/73.5**; block masking at 50% reaches **83.9/72.3**, and at 75% drops to **82.8/63.9**; grid masking at 75% gives **84.0/66.0**. Block masks are harder to reconstruct, while grid masks are easier. A sharper reconstruction does not necessarily yield better recognition features.\n\n![Paper Table 1(f): random, block, and grid masking ablation](/content/papers/assets/7145d87a3873bb966ebcf3424b7e0400444aa7811dd05749195cdbecb7208cc0.jpg)\n\nSource: [paper Table 1(f)](https://arxiv.org/html/2111.06377). Paper Figure 6 then shows random 75%, block 50%, and grid 75% examples. Their different ratios matter to the visual comparison.\n\n![Paper Figure 6: examples of three mask sampling strategies and reconstructions](/content/papers/assets/8cb9e88d1eb75d805dbf5cf20e27e7723d72d518c817a2aad96d306b5b5522ad.jpg)\n\nSource: [paper Figure 6](https://arxiv.org/html/2111.06377). Random masking combined high masking and stronger downstream accuracy among these tested settings.\n\n### Read accuracy with training time\n\nPaper Table 3 uses **1600 epochs and normalized pixels**. MAE reaches **83.6%** with ViT-B, **85.9%** with ViT-L, and **86.9%** with ViT-H at 224-pixel input. The **87.8%** ViT-H result follows **fine-tuning at 448 pixels**, not merely enlarging a test image. At publication time, the authors report this above a previous 87.1% result among methods using only ImageNet-1K; that comparison has both a date and a data condition.\n\n![Paper Table 3: ImageNet-1K comparisons across self-supervised methods and model sizes](/content/papers/assets/5e9b82daf5c2019099e5c93054542d0c1539e0c6872eef14b3d84a2160c184f2.jpg)\n\nSource: [paper Table 3](https://arxiv.org/html/2111.06377). BEiT's pretraining-data column says IN1K+DALLE because its dVAE tokenizer used an additional 250 million images. In this table MAE is more accurate than BEiT without that tokenizer pretraining; the paper also reports about **3.5× faster pretraining per epoch** for MAE. Top-1 accuracy alone does not capture the whole cost comparison.\n\nPaper Table 2 also states the hardware. With **128 TPU-v3 cores, TensorFlow, 800 epochs, and 75% masking**, ViT-L with encoder mask tokens takes **42.4 hours**; MAE with an eight-block decoder takes **15.4 hours**, a **2.8×** speedup. For ViT-H, **119.6 hours is estimated**, versus 34.5 hours, about **3.5×**. On the same hardware, the paper separately reports **31 hours** for 1600-epoch ViT-L MAE and **36 hours** for 300-epoch MoCo v3. These support efficiency for the reported implementation.\n\n## Conclusion\n\nIn image processing, recorded light does not have the clear semantic pieces that words do. Yet MAE can make detailed reconstructions, suggesting that it has learned many important visual concepts.\n\nThis is reminiscent of what happened in NLP: vision seems to be following a similar path, though in its own way.\n\nMany later studies borrowed this idea and added MAE-style training to improve their models. We'll share more when we come across them.\n","imageSizes":{"/content/papers/assets/f6a24c00fab9f102a2680899072c0e9de2ff2ae0cd7197666455a34c566f6542.jpg":{"width":1224,"height":716},"/content/papers/assets/1d9cfb01b370abfb5720a2bfd0c1686297bd0a79c5b0bcddde3dfdd84ecdfb60.jpg":{"width":1224,"height":864},"/content/papers/assets/fe286adcfcf95fe32d6e0d20706532373aba7f2f1e5842672d81d05231f86b82.jpg":{"width":936,"height":100},"/content/papers/assets/702fde186463af61a026fc97c97eae31ec8b8ef9b22eed8ea1a7f4721c78b29e.jpg":{"width":1128,"height":704},"/content/papers/assets/8306ea2dd0740797fef7bc0651d7f8f9afdaddd3b054529eed1c3c21c2447f24.jpg":{"width":1226,"height":350},"/content/papers/assets/b30e8faf85aace11810c6bd8aeaf9eeda3d75e6260edb88666d6924bdec8989b.jpg":{"width":968,"height":318},"/content/papers/assets/1d979104d89e66e55ffa47b2f9577d66f1a2149a7a62575a0143f916dfc2553c.jpg":{"width":1020,"height":350},"/content/papers/assets/7145d87a3873bb966ebcf3424b7e0400444aa7811dd05749195cdbecb7208cc0.jpg":{"width":964,"height":344},"/content/papers/assets/8cb9e88d1eb75d805dbf5cf20e27e7723d72d518c817a2aad96d306b5b5522ad.jpg":{"width":1224,"height":488},"/content/papers/assets/5e9b82daf5c2019099e5c93054542d0c1539e0c6872eef14b3d84a2160c184f2.jpg":{"width":1080,"height":312}}}
