Free-ATM: Harnessing Free Attention Masks for Representation Learning on Diffusion-Generated Images

David Junhao Zhang, Mutian Xu, Jay Zhangjie Wu, Chuhui Xue, Wenqing Zhang, Xiaoguang Han, Song Bai, Mike Zheng ShouECCV 2024

Abstract

Self-supervised representation learning has traditionally relied on massive, curated real-world datasets. While synthetic data offers a scalable alternative, it introduces challenges such as multi-object ambiguity and inefficient information density. This paper presents Free-ATM (Free Attention Masks), a framework that extracts internal cross-attention maps from text-to-image diffusion models to provide "free" semantic supervision. By integrating these masks into contrastive learning, masked image modeling, and vision-language pretraining, Free-ATM achieves a 1-10% performance boost and a 2-4x acceleration in pretraining speed, effectively closing the performance gap between synthetic and real-world data.

Overview of the Free-ATM framework showing the pipeline from diffusion generation to downstream application boosts.

Introduction

As the demand for large-scale pretraining data grows, synthetic datasets generated by diffusion models have emerged as a promising alternative to manually curated real-world datasets. However, standard self-supervised learning (SSL) techniques often struggle with synthetic data due to three primary issues:

  1. Multi-Object Ambiguity: Random cropping in contrastive learning can lead to "positive pairs" that actually contain different objects, confusing the model.
  2. Information Density: Masked Image Modeling (MIM) often wastes resources reconstructing low-signal backgrounds common in synthetic images.
  3. Grounding Costs: Vision-Language Pretraining (VLP) typically requires expensive, slow, and often brittle pre-trained object detectors to link text to image regions.

Methodology

The core innovation of Free-ATM is the utilization of cross-attention layers within diffusion models. During image generation, these layers naturally align text tokens with spatial regions. Free-ATM harvests these maps as semantic masks at no additional computational cost.

Detailed breakdown of Free-ATM applications in (a) Contrastive Learning, (b) Masked Image Modeling, and (c) Vision-Language Pretraining.

1. Instance-Level Contrastive Learning

Instead of relying on image-level random crops, Free-ATM uses "attentive pooling" guided by the extracted masks. This ensures that positive pairs are derived from the same semantic instance, while negative pairs are formed from distinct instances within the same image, resolving multi-object ambiguity.

2. Targeted Masked Modeling

Free-ATM replaces random masking with a strategy that prioritizes foreground objects. By gradually increasing the masking ratio of semantically rich areas as training progresses, the model is forced to learn complex object features rather than simple background textures.

3. Detector-Free Position Grounding

For VLP, Free-ATM converts masks into simple "position-aware prompts" (e.g., "The dog is in block 9"). This provides spatial grounding for the text encoder without the need for heavy, offline object detectors like Faster R-CNN, significantly reducing the computational overhead.

Experimental Results

The authors evaluated Free-ATM using synthetic images from Stable Diffusion 1.5 and DeepIF, testing on benchmarks including ImageNet-1K, MS-COCO, and PASCAL VOC.

  • Performance and Speed: Free-ATM provided a 1-10% improvement across various tasks and a 2-4x speedup in pretraining. For instance, SimCLR with Free-ATM reached the same accuracy in 200 epochs that standard SimCLR achieved in 800.
  • Closing the Gap: On ImageNet linear probing, MoCo-v2 trained on DeepIF images with Free-ATM achieved 67.4% accuracy, slightly outperforming the same model trained on real ImageNet data (67.3%).
  • Zero-Shot Retrieval: In text-to-image retrieval on COCO, BLIP trained with Free-ATM improved R@1 from 23.2 to 31.8 (Stable Diffusion) and 35.6 to 43.1 (DeepIF).

Conclusion

Free-ATM demonstrates that the generative process itself is a rich source of supervision. By treating cross-attention maps as high-quality, annotation-free semantic masks, the framework significantly enhances the efficiency and effectiveness of synthetic data pretraining. As diffusion models continue to improve in spatial accuracy, Free-ATM-like approaches may eventually position synthetic data as the primary choice for large-scale representation learning.

Summary updated

BibTeX
@inproceedings{zhang2024free,
  author = {David Junhao Zhang and Mutian Xu and Jay Zhangjie Wu and Chuhui Xue and Wenqing Zhang and Xiaoguang Han and Song Bai and Mike Zheng Shou},
  title = {{Free-ATM: Harnessing Free Attention Masks for Representation Learning on Diffusion-Generated Images}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-73661-2\_26},
}
Figure