Papers › BEiT: BERT Pre-Training of Image Transformers

BEiT: BERT Pre-Training of Image Transformers

15 Jun 2021ICLR 2022 4arXiv:2106.08254archive 2025-07-28

Hangbo Bao, Li Dong, Songhao Piao, Furu Wei

We introduce a self-supervised vision representation model BEiT, which stands for Bidirectional Encoder representation from Image Transformers. Following BERT developed in the natural language processing area, we propose a masked image modeling task to pretrain vision Transformers. Specifically, each image has two views in our pre-training, i.e, image patches (such as 16x16 pixels), and visual tokens (i.e., discrete tokens). We first "tokenize" the original image into visual tokens. Then we randomly mask some image patches and fed them into the backbone Transformer. The pre-training objective is to recover the original visual tokens based on the corrupted image patches. After pre-training BEiT, we directly fine-tune the model parameters on downstream tasks by appending task layers upon the pretrained encoder. Experimental results on image classification and semantic segmentation show that our model achieves competitive results with previous pre-training methods. For example, base-size BEiT achieves 83.2% top-1 accuracy on ImageNet-1K, significantly outperforming from-scratch DeiT training (81.8%) with the same setup. Moreover, large-size BEiT obtains 86.3% only using ImageNet-1K, even outperforming ViT-L with supervised pre-training on ImageNet-22K (85.2%). The code and pretrained models are available at https://aka.ms/beit.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2106.08254")

Code

Syntology Ran 6 of 11 code samples harvested from 3 repositories linked to this paper; 5 have no recorded run. Of those that ran: 2 ran · fixture could not drive it; 4 ran with no contract checked.

By repository: official repository: 2 samples from 1 repository, 1 ran; community (archive-listed): 9 samples from 2 repositories, 5 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

14 repositories listed; official and paper-mentioned ones first.

microsoft/unilm officialpytorch report
E-DEEP/PapersReview mentioned on GitHub report
facebookresearch/data2vec_vision mentioned on GitHubpytorch report
facebookresearch/vissl mentioned on GitHubpytorch report
huggingface/transformers mentioned on GitHubpytorch report
rwightman/pytorch-image-models mentioned on GitHubpytorch report
sunsmarterjie/itpn mentioned on GitHubpytorch report
woctezuma/steam-BEiT mentioned on GitHubMIT report
yyk-wew/semanticmim mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

11 samples harvested; 6 ran; 0 honoured the contract we drafted; 5 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

2ran · fixture could not drive it
4ran
5unverified

Licence: 0 of the 11 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 3 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

Block microsoft/unilm/beit/modeling_pretrain.py official repository ran MIT (permissive) · 8d8f50f0e337e6ae · report
VisionTransformerForMaskedImageModeling microsoft/unilm/beit/modeling_pretrain.py official repository unverified MIT (permissive) · 40fe357c6531e542 · report
DropPath facebookresearch/vissl/vissl/models/trunks/beit_transformer.py community (archive-listed) ran · metamorphic tier: invariant fingerprinted MIT (permissive) · f4d723c4060a9c88 · report
PatchEmbed facebookresearch/data2vec_vision/beit/modeling_pretrain.py community (archive-listed) ran MIT (permissive) · b4267c3279f7dc9e · report
PatchEmbed facebookresearch/vissl/vissl/models/trunks/beit_transformer.py community (archive-listed) ran · metamorphic tier: invariant MIT (permissive) · d00d78c96a79991c · report
drop_path facebookresearch/vissl/vissl/models/trunks/beit_transformer.py community (archive-listed) ran · fixture could not drive it fingerprinted MIT (permissive) · 0233d6e8a07784ae · report
trunc_normal_ facebookresearch/vissl/vissl/models/trunks/beit_transformer.py community (archive-listed) ran · fixture could not drive it MIT (permissive) · ab8464b48ee9d702 · report
BEiT facebookresearch/vissl/vissl/models/trunks/beit_transformer.py community (archive-listed) unverified MIT (permissive) · 0b04b71ac3366634 · report
Block facebookresearch/data2vec_vision/beit/modeling_pretrain.py community (archive-listed) unverified MIT (permissive) · 514990276df7d1e1 · report
Block facebookresearch/vissl/vissl/models/trunks/beit_transformer.py community (archive-listed) unverified MIT (permissive) · c8d115d51a70401e · report
VisionTransformerForMaskedImageModeling facebookresearch/data2vec_vision/beit/modeling_pretrain.py community (archive-listed) unverified MIT (permissive) · c4156b300b1ba24f · report

Tasks

Document Image ClassificationDocument Layout AnalysisImage ClassificationSelf-Supervised Image ClassificationSemantic Segmentationimage-classification

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Document Image Classification RVL-CDIP BEiT-B Accuracy 91.09% #27 of 31 Archive leaderboard report
Document Image Classification RVL-CDIP BEiT-B Parameters 87M #27 of 31 Archive leaderboard report
Document Layout Analysis PubLayNet val BEiT-B Figure 0.957 #11 of 15 Archive leaderboard report
Document Layout Analysis PubLayNet val BEiT-B List 0.924 #11 of 15 Archive leaderboard report
Document Layout Analysis PubLayNet val BEiT-B Overall 0.931 #11 of 15 Archive leaderboard report
Document Layout Analysis PubLayNet val BEiT-B Table 0.973 #11 of 15 Archive leaderboard report
Document Layout Analysis PubLayNet val BEiT-B Text 0.934 #11 of 15 Archive leaderboard report
Document Layout Analysis PubLayNet val BEiT-B Title 0.866 #11 of 15 Archive leaderboard report
Image Classification ImageNet BEiT-L (ViT; ImageNet-22K pretrain) Number of params 331M #37 of 1060 Archive leaderboard report
Image Classification ImageNet BEiT-L (ViT; ImageNet-22K pretrain) Top 1 Accuracy 88.60% #37 of 1060 Archive leaderboard report
Image Classification ImageNet BEiT-L (ViT; ImageNet 1k pretrain) Number of params 86M #158 of 1060 Archive leaderboard report
Image Classification ImageNet BEiT-L (ViT; ImageNet 1k pretrain) Top 1 Accuracy 86.3% #158 of 1060 Archive leaderboard report
Image Classification OmniBenchmark BeiT Average Top-1 Accuracy 30.1 #22 of 22 Archive leaderboard report
Self-Supervised Image Classification ImageNet (finetuned) BEiT-L (ViT) Number of Params 307M #14 of 65 Archive leaderboard report
Self-Supervised Image Classification ImageNet (finetuned) BEiT-L (ViT) Top 1 Accuracy 86.3% #14 of 65 Archive leaderboard report
Self-Supervised Image Classification ImageNet (finetuned) BEiT-B (ViT) Number of Params 86M #29 of 65 Archive leaderboard report
Self-Supervised Image Classification ImageNet (finetuned) BEiT-B (ViT) Top 1 Accuracy 84.6% #29 of 65 Archive leaderboard report
Semantic Segmentation ADE20K BEiT-L (ViT+UperNet) Validation mIoU 57.0 #35 of 235 Archive leaderboard report
Semantic Segmentation ADE20K val BEiT-L (ViT+UperNet, ImageNet-22k pretrain) mIoU 57.0 #22 of 95 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Absolute Position EncodingsAdamAttentionAttention DropoutBERTBPEDeiTDense ConnectionsDropoutFeedforward NetworkLabel SmoothingLayer NormalizationLinear LayerLinear Warmup With Linear DecayMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformerWeight DecayWordPiece

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections