On the Difference of BERT-style and CLIP-style Text Encoders

Zhihong Chen, Guiming Hardy Chen, Shizhe Diao, Xiang Wan, Benyou Wang · DOI

Introduction

In the landscape of Natural Language Processing (NLP), BERT (Masked Language Modeling) has long served as the gold standard for generating robust text representations. Conversely, the rise of CLIP (Contrastive Language-Image Pretraining) has revolutionized computer vision by aligning images with text. However, while CLIP’s vision encoder is widely celebrated, its text encoder is often regarded as a secondary component—a mere byproduct of the multimodal training process.

This research investigates a fundamental question: Are CLIP text encoders actually useful for understanding language? By conducting a comparative analysis between encoders trained exclusively on text (BERT-style) and those trained to align text with visual data (CLIP-style), the authors explore whether multimodal training grants a unique form of "intelligence" that purely linguistic models lack.

The "Synesthesia" Hypothesis

The authors propose that CLIP text encoders experience a digital form of "synesthesia." Much like humans who associate specific sounds with colors, CLIP-style models appear to associate words with their visual structures. This "visual knowledge" allows the model to understand concepts through a lens of physical appearance rather than just linguistic relationships. While BERT-style models excel at the mechanics of language—grammar, syntax, and logic—CLIP models prioritize the visual essence of the concepts described.

Experimental Methodology

To test this hypothesis, the researchers employed three distinct experimental setups across various datasets:

  1. General Linguistic Understanding: The models were benchmarked on the GLUE (General Language Understanding Evaluation) suite, which includes tasks such as sentiment analysis (SST-2) and linguistic acceptability (CoLA).
  2. Vision-Centric Text Understanding: Using the Crisscrossed Captions (CxC) dataset—an extension of MS-COCO—the researchers measured Semantic Textual Similarity from both a Language perspective (STS-L) and a Vision perspective (STS-V). This task determines if a model can recognize that two differently worded captions describe the same visual scene.
  3. Linear Probing for Image Generation: To determine if visual information is "hidden" within text embeddings, the team used the Multi-Modal CelebA-HQ dataset. They trained a simple single linear layer to map text representations to a frozen image decoder (VQGAN-Transformer). The goal was to see if a basic linear transformation could extract enough visual data from the text embedding to reconstruct a recognizable image.

Key Results: Linguistic vs. Visual Trade-offs

The Syntax Gap

The study found that CLIP-style encoders are significantly less proficient at handling syntax and grammar. On the GLUE benchmark, CLIP-style models consistently underperformed, achieving only approximately 85% of the scores reached by BERT-style models. The disparity was most evident in tasks like CoLA, where CLIP models often behaved like "bag-of-words" models, largely ignoring word order and grammatical structure.

Superiority in Visual Concepts

Despite their linguistic shortcomings, CLIP-style encoders proved superior in vision-centric tasks. In the STS-V benchmark, CLIP-style encoders (specifically ViT-L/14) outperformed even the largest BERT-style models, such as RoBERTa-large, with a Spearman correlation of 45.03 versus 43.54. This suggests that CLIP models are better at recognizing that "a man flying a kite" and "a woman flying a kite" are visually similar, even if the subjects differ.

Linear Accessibility of Visual Knowledge

The most compelling evidence for the synesthesia hypothesis came from the image generation experiments. Images generated from CLIP embeddings were significantly more accurate to the text prompts than those generated from BERT. Statistical analysis (pooled t-tests) yielded p-values as low as 2.250e-9, confirming that CLIP's ability to associate text with visual form is statistically significant. Remarkably, because this was achieved via a simple linear layer, it demonstrates that visual information is not just present in CLIP, but is easily accessible and structured linearly within the embedding space.

Limitations and Future Directions

The researchers identified two primary limitations in their study. First, the models compared were not controlled for training data volume or parameter count, a common challenge when evaluating massive pre-trained models. Second, the use of the CLIP score to evaluate generated images introduces a risk of circular evaluation, as the text encoder being tested shares the same training objective as the evaluation metric.

Looking forward, the study suggests that the next frontier in encoder design is the synthesis of these two strengths. The goal is to develop a model that possesses both BERT’s mastery of complex grammar and CLIP’s "synesthetic" visual imagination, creating a more holistic understanding of how language describes the world.

Conclusion

While BERT remains the superior choice for pure NLP tasks, CLIP-style encoders offer a unique and powerful alternative for vision-centric applications. Their ability to encode the visual essence of language—accessible through simple linear transformations—marks a significant departure from traditional linguistic modeling and opens new doors for multimodal AI development.

Summary updated

Abstract

Masked language modeling (MLM) has been one of the most popular pretraining recipes in natural language processing, e.g., BERT, one of the representative models. Recently, contrastive language-image pretraining (CLIP) has also attracted attention, especially its vision models that achieve excellent performance on a broad range of vision tasks. However, few studies are dedicated to studying the text encoders learned by CLIP. In this paper, we analyze the difference between BERT-style and CLIP-style text encoders from three experiments: (i) general text understanding, (ii) vision-centric text understanding, and (iii) text-to-image generation. Experimental analyses show that although CLIP-style text encoders underperform BERT-style ones for general text understanding tasks, they are equipped with a unique ability, i.e., synesthesia, for the cross-modal association, which is more similar to the senses of humans.
BibTeX
@inproceedings{chen2023difference,
  author = {Zhihong Chen and Guiming Hardy Chen and Shizhe Diao and Xiang Wan and Benyou Wang},
  title = {{On the Difference of BERT-style and CLIP-style Text Encoders}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.findings-acl.866},
}
Figure