NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

MOCA: Self-supervised Representation Learning by Predicting Masked Online Codebook Assignments

Spyros Gidaris, Andrei Bursuc, Oriane Siméoni, Antonín Vobecký, Nikos Komodakis, Matthieu Cord, Patrick Pérez

Introduction

Vision Transformers (ViTs) have become a cornerstone of modern computer vision, yet they often struggle with the "data-hungry" nature resulting from a lack of inherent spatial inductive biases. Self-supervised learning (SSL) has addressed this by allowing models to learn from vast unlabeled datasets. Historically, SSL has split into two primary paradigms: Masked Image Modeling (MIM), which excels at spatial reasoning through reconstruction (e.g., MAE), and Discriminative Learning, which focuses on global semantic invariance (e.g., DINO).

MOCA (Masked Online Codebook Assignments) introduces a unified framework that captures the benefits of both paradigms. By predicting high-level semantic assignments from a dynamically updated online codebook, MOCA avoids the need for pre-trained tokenizers while delivering state-of-the-art performance, particularly in low-data regimes, and training up to three times faster than existing methods.

Methodology

MOCA employs a teacher-student architecture that leverages a novel target generation process to bridge the gap between local and global learning.

Online Codebook Assignments

A significant challenge in MIM is choosing what to predict. While pixel reconstruction is simple, it often focuses on low-level noise. MOCA instead maintains a first-in-first-out (FIFO) queue of features generated by the teacher network, acting as an "online codebook." The teacher computes soft probability assignments for each image patch relative to these codebook entries. The student is then tasked with predicting these semantic targets, forcing it to learn higher-level concepts rather than raw pixel values.

Dual Training Objectives

The model is trained using two distinct but synergistic losses:

  • Local Loss ($L_{LOC}$): The student receives a masked image and must predict the teacher's codebook assignments for the hidden patches. This encourages the model to develop a strong understanding of local spatial structure and context.
  • Global Loss ($L_{IMG}$): The student predicts the average codebook assignment of a different, unmasked view of the same image. This objective promotes semantic invariance, ensuring the model recognizes the same object regardless of crops or color jitters.

Efficiency via Partial Decoding

To minimize computational overhead, MOCA utilizes Partial Decoding. The student only predicts a small subset (typically 20%) of the masked tokens. This, combined with the semantic nature of the targets, allows MOCA to achieve high accuracy with significantly less training time than pixel-based reconstruction methods.

Key Insights

The core innovation of MOCA lies in its ability to generate "ready-to-use" features that are both spatially aware and semantically rich.

The Condenser Architecture

A critical component is the Condenser-based Decoder. By feeding the decoder patch features from an intermediate layer but the global feature from the final layer, the authors create a bottleneck. This forces the final global representation to be highly informative, as it must compensate for the "weaker" intermediate patch features to successfully predict the teacher's assignments. This design is pivotal for MOCA's superior performance in k-NN and linear probing benchmarks.

Synergy of Local and Global Learning

The paper demonstrates that these two objectives are not just additive but complementary. The global loss helps populate the online codebook with semantically meaningful features, while the local loss ensures that the model does not lose sight of fine-grained spatial details, a common pitfall of purely discriminative methods.

Experimental Results

MOCA's performance was validated across ImageNet-1k, Cityscapes, and COCO benchmarks, showing dominance in both speed and accuracy.

Training Efficiency

MOCA achieves higher K-NN accuracy in significantly less training time compared to established baselines like MAE and DINO. Source, p. 2

MOCA achieves higher K-NN accuracy in significantly less training time compared to established baselines like MAE and DINO.

As shown in the efficiency analysis, MOCA is remarkably fast. It surpasses the accuracy of MAE (trained for 142 hours) in just 38 hours of training on a single 8-A100 node. This efficiency makes high-quality SSL more accessible for researchers with limited compute resources.

State-of-the-Art in Low-Shot Tasks

MOCA truly shines in scenarios with limited labeled data. On the 1-shot ImageNet benchmark, it achieves 55.4% accuracy, outperforming the previous best method, MSN, by a substantial 5.6 points.

Comprehensive evaluation of MOCA across classification and segmentation tasks, highlighting its dominance in low-shot and linear probing scenarios.

Downstream Versatility

Beyond classification, MOCA excels in semantic segmentation on Cityscapes. In low-shot segmentation (using only 100 images), MOCA's features prove to be much more semantically mature than those of MAE or SimMIM, providing a strong foundation for complex spatial tasks even when labels are scarce.

Conclusion

MOCA successfully unifies masked modeling and discriminative learning into a single, efficient framework. By moving away from pixel reconstruction toward online semantic assignments, it provides a powerful tool for learning robust representations from unlabeled data. While future work may refine codebook management or scale the approach to multi-modal datasets, MOCA currently stands as a leading method for high-efficiency, high-performance self-supervised learning.

Summary updated

BibTeX
@article{gidaris2024moca,
  author = {Spyros Gidaris and Andrei Bursuc and Oriane Siméoni and Antonín Vobecký and Nikos Komodakis and Matthieu Cord and Patrick Pérez},
  title = {{MOCA: Self-supervised Representation Learning by Predicting Masked Online Codebook Assignments}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2024},
  url = {https://openreview.net/forum?id=ywSUztJhiC},
}
Figure