Designing BERT for Convolutional Networks: Sparse and Hierarchical Masked Modeling

Keyu Tian, Yi Jiang, qishuai diao, Chen Lin, Liwei Wang, Zehuan Yuan

Abstract

Masked Image Modeling (MIM) has revolutionized self-supervised learning for Vision Transformers, yet its application to Convolutional Networks (ConvNets) has been hindered by structural incompatibilities. We present SparK (Sparse masKed modeling), a framework that enables BERT-style pre-training for any ConvNet. By employing sparse convolutions to handle irregular masked inputs and a hierarchical UNet-style decoder, SparK preserves natural data distributions and leverages multi-scale features. Our results demonstrate that SparK-trained ConvNets outperform state-of-the-art Transformers and contrastive methods on ImageNet-1K and downstream COCO tasks, proving that generative pre-training is a powerful scaling path for convolutional architectures.

Introduction: The Challenge of Masked Modeling in ConvNets

Masked Image Modeling (MIM) involves reconstructing hidden image patches, a pretext task that has seen immense success in Vision Transformers (ViTs). However, adapting MIM to ConvNets faces two major hurdles: irregular inputs and the hierarchical nature of convolutional features.

Standard convolutions operate on regular grids. When patches are randomly masked, the resulting "holes" are typically filled with zeros (zero-outing). This creates a significant data distribution shift, as the masked input differs drastically from the natural images the model will encounter during inference. Furthermore, the sliding window of dense convolutions causes "mask pattern vanishing," where information from visible pixels "bleeds" into masked regions, simplifying the reconstruction task and reducing the quality of learned representations.

Comparison of masking strategies and their effects on data distribution. Note how zero-outing in standard CNNs (b) causes a massive distribution spike at zero, whereas SparK's sparse dropping (c) maintains the raw input distribution (d).

The SparK Framework

To address these issues, the authors introduce SparK, a general framework applicable to any ConvNet backbone (e.g., ResNet, ConvNeXt) without requiring modifications to the architecture.

Sparse Masking Strategy

SparK treats unmasked patches as sparse "voxels," utilizing submanifold sparse convolutions. Unlike dense convolutions, these operations only compute features at visible (unmasked) locations. This approach prevents mask pattern vanishing and ensures that the model cannot "cheat" by accessing leaked information from neighboring pixels during the encoding phase, maintaining the difficulty and effectiveness of the pretext task.

The Sparse CNN encoding process. Submanifold sparse convolutions maintain the mask pattern throughout the hierarchical feature extraction, preventing information leakage.

Hierarchical Encoder-Decoder

ConvNets are inherently multi-scale. SparK leverages this by using a UNet-style architecture. The encoder produces sparse features at multiple resolutions. These features are then "densified"—empty positions are filled with learnable mask embeddings—and passed through a hierarchical decoder to reconstruct the original image at full resolution.

Experimental Results

SparK was evaluated using ImageNet-1K for pre-training and fine-tuning, and the COCO dataset for downstream transferability.

  • State-of-the-Art Performance: SparK-trained ConvNeXt models outperformed transformer-based MIM methods (like MAE and SimMIM) by approximately +1.0% on ImageNet-1K.
  • Superior Transferability: The gains on downstream tasks were even more significant. On the COCO benchmark, SparK improved object detection and instance segmentation by up to +3.5% AP over supervised baselines.
  • Efficiency: By skipping computations in masked regions, SparK is highly efficient, saving approximately 23% in memory footprint during pre-training compared to dense methods.

Conclusion

SparK demonstrates that ConvNets are not obsolete in the era of self-supervised Transformers. By aligning the pre-training task with the inductive biases of convolutional architectures—specifically through sparse operations and hierarchical modeling—ConvNets can match or exceed ViT performance. While the implementation relies on specialized sparse convolution libraries, the performance gains and scaling potential make it a compelling framework for future vision research.

Summary updated

BibTeX
@inproceedings{tian2023designing,
  author = {Keyu Tian and Yi Jiang and qishuai diao and Chen Lin and Liwei Wang and Zehuan Yuan},
  title = {{Designing BERT for Convolutional Networks: Sparse and Hierarchical Masked Modeling}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=NRxydtWup1S},
}
Figure