T-MARS: Improving Visual Representations by Circumventing Text Feature Learning

Pratyush Maini, Sachin Goyal, Zachary Chase Lipton, J Zico Kolter, Aditi Raghunathan

TL;DR

T-MARS (Text Masking and Re-Scoring) is a novel data-filtering approach designed to prevent vision-language models from "cheating" by learning to read text instead of recognizing visual features. By masking out text in web-crawled images and re-evaluating their similarity to captions, T-MARS identifies high-quality training pairs. This method leads to a 6.5% boost in ImageNet zero-shot accuracy over standard CLIP filtering.

The "Shortcut" Problem in Vision-Language Models

Modern computer vision relies heavily on massive, web-crawled datasets like LAION-5B to train models such as CLIP. However, these datasets are inherently noisy. A significant portion of web images—nearly 40% in LAION—contain text that overlaps with the image caption (e.g., book covers, wine labels, or memes).

This creates a "shortcut" problem: if an image contains the word "Apple" and the caption is "Apple," a model might simply learn Optical Character Recognition (OCR) to minimize its training loss. While reading is a useful skill, it shouldn't come at the expense of learning what an actual apple looks like. Previous attempts to fix this either ignored the problem or naively deleted all images containing text. The latter approach is wasteful because many images (like a "vintage wine" bottle) contain both useful visual features and text. The core challenge is to filter out "text-dominated" images while retaining those where the visual content still matches the caption.

Methods: The T-MARS Pipeline

To address this, the authors propose T-MARS (Text Masking and Re-Scoring), a simple, three-step pipeline designed for web-scale efficiency:

T-MARS Pipeline and Performance
  1. Text Detection: The pipeline uses the FAST algorithm to identify bounding boxes for all text in an image. Crucially, it only detects the presence of text rather than recognizing it, making the process much faster and more scalable.
  2. Text Masking: The detected text regions are masked out by filling them with the average color of the surrounding pixels.
  3. Re-Scoring and Filtering: A pre-trained CLIP model calculates the cosine similarity between the masked image and the original caption.

If the similarity score remains high after masking, the visual features (not just the text) are well-aligned with the caption. If the score drops significantly, the text was likely the only element connecting the image to the caption, and the pair is filtered out.

Datasets and Evaluation

The approach was trained on subsets of LAION-400M (ranging from 2M to 64M samples) and the DataComp benchmark (Small and Medium scales). Evaluation spanned a suite of 23 benchmarks, including ImageNet (zero-shot), ImageNet-OOD (distribution shifts like Sketch and Adversarial), VTAB (12 diverse vision tasks), and retrieval tasks on MSCOCO and Flickr. Additionally, a synthetic version of ImageNet-Captions was created to precisely measure the "utility" of different data types.

Key Insights and Ideas

  • The "Bad Data" Penalty: Through synthetic experiments, the authors found that images containing only text features are just as harmful to model performance as completely mislabeled data.
Impact of OCR-only vs Mislabeled Data
  • Visual + Text = High Utility: Images that contain both visual features and text are highly valuable. T-MARS successfully retains these, whereas simpler "Text-Match" filters (which delete anything with overlapping text) discard them.
  • Scaling Laws for Curation: A major finding is that the accuracy gains from T-MARS increase linearly as the data and compute are scaled exponentially. This suggests that as we build larger models, the quality of data curation becomes more important, not less.
  • Pruning vs. Adding: The results show that pruning "bad" data can be up to 3x more effective for model accuracy than simply adding more "good" unfiltered data.

Key Results

  • State-of-the-Art Filtering: T-MARS is the top-ranked approach on the DataComp "medium scale" benchmark for ImageNet.
  • Accuracy Boosts: On a 64M subset of LAION, T-MARS outperformed standard CLIP filtering by 6.5% on ImageNet and 4.7% on VTAB.
  • Robustness: Models trained with T-MARS showed significantly better performance on out-of-distribution (OOD) datasets, likely because they were forced to learn robust visual representations rather than relying on text cues.

Limitations and Future Work

  • Static vs. Dynamic Filtering: T-MARS currently creates a static filtered subset before training begins. The authors suggest that "dynamic" filtering—refreshing the data pool during training—could be an interesting future direction.
  • Masking Artifacts: The current method uses simple pixel-averaging for masking. While effective, more sophisticated generative inpainting could reduce distribution shifts, though it would be much more computationally expensive.
  • Bias: While T-MARS is a generic filter, any data curation process carries the risk of introducing or amplifying biases present in the underlying dataset. The authors note this as an area for ongoing vigilance.

Summary updated

BibTeX
@inproceedings{maini2024t,
  author = {Pratyush Maini and Sachin Goyal and Zachary Chase Lipton and J Zico Kolter and Aditi Raghunathan},
  title = {{T-MARS: Improving Visual Representations by Circumventing Text Feature Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=ViPtjIVzUw},
}
Figure