Language Quantized AutoEncoders: Towards Unsupervised Text-Image Alignment

Hao Liu, Wilson Yan, Pieter Abbeel

Introduction

Large language models (LLMs) exhibit remarkable reasoning capabilities but fundamentally lack visual grounding. Bridging this gap typically requires training on massive, expensive datasets of paired images and text, such as the 300 million pairs used for CLIP. This paper introduces Language-Quantized AutoEncoders (LQAE), an unsupervised method that aligns images and text by quantizing image embeddings into a frozen language model's codebook. By doing so, LQAE enables powerful few-shot multimodal learning with LLMs like GPT-3, outperforming existing baselines while requiring zero paired image-text data during training.

The Challenge of Visual Grounding

Curating massive, aligned datasets is expensive, computationally burdensome, and difficult to scale to arbitrary new modalities. The authors tackle a compelling question: Can we learn a useful alignment between images and text in an entirely unsupervised manner, relying only on the structure already learned by pretrained language models, without ever showing the model a paired image and caption?

Methodology: Language-Quantized AutoEncoders

The authors propose LQAE, which builds on the standard Vector Quantized Variational AutoEncoder (VQ-VAE) architecture but introduces two clever twists to force visual data into a language space.

LQAE Architecture
  1. Pretrained Language Codebook: Instead of learning a custom codebook from scratch to compress images, LQAE replaces it with the frozen codebook of a pretrained language model (RoBERTa). The Vision Transformer (ViT) image encoder is forced to map image patches directly into discrete text token IDs.
  2. Language Denoiser Bottleneck: Simply mapping to text tokens doesn't guarantee the output will have language-like semantics. To enforce this, the authors mask a large portion of the quantized text tokens and feed them through a frozen RoBERTa model. The output features from RoBERTa are then passed to the ViT decoder to reconstruct the original image.

By training the encoder and decoder purely on image reconstruction and a masked language modeling loss, the encoder learns to group similar images into clusters of text tokens that RoBERTa can easily process.

Key Insights

  • Gibberish is Surprisingly Useful: If you decode the LQAE text tokens back into English, the output looks like complete nonsense to a human (e.g., "Shi expansions Heatheriful Mauritbi..."). However, LLMs like GPT-3 can recognize the underlying structural patterns in this "gibberish" and successfully use it for few-shot learning.
  • High Masking Ratios are Critical: Standard BERT models mask about 15% of tokens during training. The authors found that LQAE requires a much higher masking ratio (around 50%) to force the encoder to learn robust, language-aligned representations.
  • In-Context Learning Bridges the Gap: Because the pretraining is unsupervised, the model doesn't inherently know that a picture of a dog maps to the English word "dog." It relies entirely on the LLM's in-context learning abilities at test time. Given just 1 to 5 paired examples in the prompt, the LLM figures out how the LQAE's token clusters map to human labels.
Few-shot prompting with LQAE and GPT-3

Key Results

The model was trained in a completely unsupervised manner on ImageNet (using only images) and evaluated on few-shot tasks:

  • Few-Shot Image Classification: On the Open-Ended miniImageNet benchmark, LQAE prompted via GPT-3 (Davinci) achieved 53.97% on 2-way and 29.04% on 5-way classification. This outperforms the Frozen baseline (51.3% and 26.26%), despite Frozen being explicitly pretrained on 3 million paired images.
  • Few-Shot VQA: On the Fast VQA benchmark, LQAE achieved an average success rate of 8.8%, again beating the Frozen baseline (8.0%).
  • Linear Classification: The intermediate RoBERTa embeddings generated by LQAE can be used to train a linear classifier on ImageNet, achieving 35.6% accuracy. This proves the text tokens capture highly meaningful visual semantics.

Limitations and Future Work

Because the alignment is unsupervised, the generated text tokens are not human-readable. While GPT-3 can understand them, humans cannot, which limits the method's utility in domains requiring strict interpretability. Furthermore, due to compute limitations, the authors could not scale up the ViT encoders/decoders or use larger BERT-like models, hypothesizing that scaling these components would significantly improve capacity.

Ultimately, the LQAE framework is theoretically modality-agnostic. This approach could be generalized to align any two arbitrary modalities (e.g., audio and text, or video and audio) simply by swapping the encoder/decoder and using a relevant pretrained denoiser.

Summary updated

BibTeX
@inproceedings{liu2023language,
  author = {Hao Liu and Wilson Yan and Pieter Abbeel},
  title = {{Language Quantized AutoEncoders: Towards Unsupervised Text-Image Alignment}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=mlxRLIy7kc},
}
Figure