A Vision Check-up for Language Models

Pratyusha Sharma, Tamar Rott Shaham, Manel Baradad, Adrián Rodríuez-Muñoz, Shivam Duggal, Phillip Isola, Antonio Torralba, Stephanie Fu · DOI

Abstract

What does learning to model relationships between strings teach Large Language Models (LLMs) about the visual world? We systematically evaluate LLMs' abilities to generate and recognize an assortment of visual concepts of increasing complexity and then demonstrate how a preliminary visual representation learning system can be trained using models of text. As language models lack the ability to consume or output visual information as pixels, we use code to represent images in our study. Although LLM-generated images do not look like natural images, results on image generation and the ability of models to correct these generated images indicate that precise modeling of strings can teach language models about numerous aspects of the visual world. Furthermore, experiments on self-supervised visual representation learning, utilizing images generated with text models, highlight the potential to train vision models capable of making semantic assessments of natural images using just LLMs.

Introduction

A central question in artificial intelligence is whether Large Language Models (LLMs) truly understand the concepts they describe or if they are merely "stochastic parrots." Specifically, can a model trained exclusively on text strings grasp the visual world—the geometry of a bicycle, the layout of a room, or the relative positions of objects? Because LLMs cannot process raw pixels, testing their visual knowledge requires a proxy. This study uses code as a bridge to vision, hypothesizing that if an LLM can write a script (e.g., TikZ or SVG) that renders a coherent image, it must possess an internal representation of that object's structure.

Methodology

The researchers conducted a three-part "vision check-up" for LLMs:

  1. Generation (Drawing): Models were prompted to write code to draw specific objects or scenes (e.g., "a row of bicycles").
  2. Recognition (Seeing): Models were given human-drawn sketches represented as code and asked to identify the depicted object.
  3. Self-Correction: Models were asked to iterate on their own generated code to improve realism or detail based on text feedback.
Overview of the study's three-part vision check-up (Generation, Recognition, Correction) and the subsequent visual representation learning pipeline.

Beyond these tests, the study explored Visual Representation Learning. They generated a dataset of 1.3 million images using LLM code and used this synthetic data to pre-train a standard ResNet-50 vision backbone via unsupervised contrastive learning (MoCo-v2).

Key Insights

  • Code as a Semantic Bridge: By training on vast repositories like GitHub, LLMs have learned the mapping between linguistic concepts and geometric instructions (e.g., ellipse, line).
  • Spatial Logic vs. Texture: LLMs excel at spatial relationships and global structure but struggle with low-level visual details like organic textures and precise surface contact physics.
  • The Generation-Recognition Paradox: Interestingly, LLMs find it easier to generate code for a complex scene than to recognize what that same code represents when reading it back—a reversal of typical human cognitive patterns.

Results and Evaluation

GPT-4 and GPT-3.5 significantly outperformed older models in generating executable and coherent code. In recognition tasks, GPT-3.5 achieved 38% accuracy on human-coded scenes, far above the 20% chance baseline.

Most remarkably, the ResNet-50 model trained only on LLM-generated images (augmented with the Shaders-21k dataset) achieved a top-1 accuracy of 46.03% on ImageNet-1k. This demonstrates that a vision model can learn to categorize real-world natural images using data derived entirely from a text-only model.

Evaluation of a ResNet-50 model, pre-trained on LLM-generated images, performing zero-shot classification on real-world images.

Conclusion

While LLM-generated images currently resemble "clip art" and lack photorealism, the study proves that the seeds of visual understanding are embedded within the world's collective text and code. Future work may focus on closing the loop between pixels and text more tightly, potentially reducing the need for massive paired datasets of images and captions by leveraging the latent visual knowledge already present in LLMs.

Summary updated

BibTeX
@misc{sharma2024vision,
  author = {Pratyusha Sharma and Tamar Rott Shaham and Manel Baradad and Adrián Rodríuez-Muñoz and Shivam Duggal and Phillip Isola and Antonio Torralba and Stephanie Fu},
  title = {{A Vision Check-up for Language Models}},
  year = {2024},
  eprint = {2401.01862},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2401.01862},
}
Figure