Seyed Masoud Hosseini · Overview · Study log · Weekly summaries · Ideas · Search · Transcript · RSS feed

NLP with Deep Learning · Lecture 19 of 23 · 1:18:23

Lecture 16: Multimodal Deep Learning, with Douwe Kiela

Stanford CS224N NLP with Deep Learning | 2023 | Lecture 16 - Multimodal Deep Learning, Douwe Kiela on YouTube

Study guide

What this lecture covers

Douwe Kiela, a researcher who has worked on multimodal models at Facebook AI Research and Hugging Face, gives a guest lecture surveying how deep learning has combined text with other modalities, mainly images. The lecture answers a practical question for anyone building or evaluating multimodal systems: what are the main architectural approaches to combining information from different modalities, and how has the field progressed from simple embedding alignment to today's large foundation models. It fits into the course as a look beyond pure text, showing how techniques already covered (word embeddings, attention, Transformers) extend to other data types.

After watching, you should be able to describe why multimodal training matters, distinguish early, middle, and late fusion strategies, explain how contrastive models like CLIP work, and recognize common pitfalls in multimodal evaluation datasets.

Key ideas

  • Modality: a type of information source, such as text, image, audio, or smell; multimodal models combine several of these.
  • Motivations for multimodality: it mirrors how humans perceive the world, matches the multimodal nature of real internet content, and offers a way to keep scaling models as high-quality text data runs out.
  • Fusion: the general problem of how to combine feature vectors from different modalities, ranging from early fusion (interaction from the start) to late fusion (combining only final scores).
  • Contrastive (late-fusion) models: models like CLIP encode each modality independently and align matching pairs in a shared embedding space using a contrastive loss, enabling efficient training and zero-shot classification.
  • BERT-style multimodal transformers: models like VisualBERT and ViLBERT extend masked-language-model pretraining to combine region-based image features with text, using single-stream or dual-stream (cross-attention) architectures.
  • Foundation models: more recent systems (FLAVA, Flamingo, BLIP-2) aim for one model that handles vision, language, and multimodal tasks together, often by freezing a pretrained language model and learning to project image features into its input space.
  • Evaluation pitfalls: several popular benchmarks (early VQA, some multimodal pretraining gains) turned out to be solvable without real multimodal reasoning, motivating harder, more carefully designed datasets like Winoground and Hateful Memes.

Walkthrough

Why multimodality matters now (1:06)

Kiela opens by noting that "multimodality" is loosely defined, then gives three reasons it matters: human understanding of the world is inherently multimodal, real internet content mixes text and images constantly, and the field is starting to run out of pure text data for scaling large language models, making other modalities a way to keep growing training data. He illustrates the perceptual point with the McGurk effect, where identical audio is perceived differently depending on the video shown alongside it, and lists common multimodal applications: retrieval, image captioning, text-to-image generation, visual question answering, and multimodal classification (such as hate speech detection).

Early cross-modal embeddings (7:10)

The lecture traces early pre-deep-learning and early deep learning work that aligned word embeddings with image features in a shared space using similarity metrics and margin losses, enabling cross-modal retrieval, such as finding images near the embedding for "horse." It covers the "bag of visual words" approach (clustering image keypoint descriptors the way bag-of-words clusters text), then how convolutional neural network features were concatenated with or used to predict word embeddings, followed by extensions from words to sentences using LSTMs and recursive networks, sequence-to-sequence captioning models, attention-based alignment between generated words and image regions, and GANs conditioned on text for image generation.

Featurizing images and fusion strategies (15:19)

Kiela explains why combining modalities is harder than it sounds: text can dominate a model's learned signal (some early visual question answering systems learned to ignore images entirely), extra modalities add noise, and data coverage is often incomplete. He describes ways to featurize images, from region features produced by object detectors to Vision Transformers that treat image patches like tokens, and surveys ways to combine two feature vectors, from simple similarity or concatenation to multiplicative interactions, gating, and attention. He frames most multimodal research as fundamentally about this fusion question, and distinguishes early fusion (interaction from the start), middle fusion, and late fusion (combining only final outputs), illustrated with the FiLM model, which modulates a ResNet's feature maps at every layer using a vector derived from the other modality.

Late fusion in practice: CLIP and contrastive pretraining (23:22)

The lecture covers CLIP as the most influential late-fusion, contrastive model: independent Transformer encoders for text and images are trained so that matching image-text pairs rank higher than mismatched pairs within a batch. Kiela credits CLIP's success less to architectural novelty than to training on roughly 300 million web-sourced image-text pairs, which produced a model that generalizes far better than a comparable ResNet to adversarial image variants, even though it didn't outperform ResNet on plain ImageNet. He mentions that CLIP-style captions (natural web captions rather than single labels) enable zero-shot classification through prompting, and describes follow-up work (Google's ALIGN, the open LAION datasets) that scaled the same idea to billions of pairs.

Early and middle fusion: BERT-style multimodal transformers (28:27)

Kiela walks through the wave of BERT-derived multimodal models that appeared once BERT and region-based image features were both available: VisualBERT as a simple single-stream model that concatenates image region features and text tokens into one Transformer, and ViLBERT as a dual-stream model with cross-attention between two parallel Transformers, trained with masked-language-modeling and image-text-matching objectives analogous to BERT's next-sentence prediction. He also mentions his own MMBT model, which simply pools ResNet feature maps into BERT's token space without extra multimodal pretraining, and Pixel-BERT and ViLT, which move toward using raw image patches instead of region features. He cites a paper showing that, once trained on identical data, many of these architecturally different models perform similarly, suggesting data and scale mattered more than specific fusion tricks.

Toward foundation models and generation (36:33)

The lecture covers FLAVA, Kiela's own project aiming for a single foundation model handling vision-only, language-only, and multimodal tasks together, combining masked image modeling, masked language modeling, image-text matching, and a CLIP-style contrastive loss. It then traces a shift toward generative multimodal models: SimVLM and CoCa add text decoders for richer captioning; frozen-language-model approaches (following the earlier MMBT idea) learn only a projection into a frozen model's token space, enabling few-shot, in-context "binding" behavior; and Flamingo (DeepMind) combines a frozen Chinchilla language model with a "Perceiver Resampler" and gated cross-attention to reason over multiple images. BLIP-2 pushes this further, freezing both the image encoder and the language model and learning only a small connecting module, producing strong captioning and visual question answering. Kiela closes this section by noting that multimodal chain-of-thought prompting, generating a rationale before answering, measurably improves performance on benchmarks requiring visual reasoning.

Evaluating multimodal models: pitfalls and better benchmarks (54:43)

Kiela argues that careful evaluation matters as much as model design, describing how early visual question answering (VQA) datasets could be gamed: guessing "two" for every counting question scored roughly 70% accuracy, revealing that images often weren't needed to answer. He describes datasets built specifically to prevent shortcuts: Hateful Memes, which he helped create, pairs benign and hateful versions of memes that differ only when image and text are read together, and found that fancy multimodal pretraining barely improved over simpler baselines; and Winoground, which tests whether models like CLIP truly understand word order and compositional relationships (such as "a mug in some grass" versus "grass in a mug"), where state-of-the-art models sometimes perform below random chance. He also notes that even a strong generative model like DALL-E 2 struggles with details like relative counts of objects, reflecting biases in its training data.

Before you watch

  • Familiarity with word embeddings, attention, and the Transformer architecture from earlier lectures is assumed throughout.
  • It helps to have seen the course's coverage of BERT and sequence-to-sequence models, since much of the lecture builds directly on both.

Check your understanding

  1. What are the three main motivations Kiela gives for pursuing multimodal deep learning?
  2. How does a contrastive model like CLIP differ from an early- or middle-fusion architecture like ViLBERT in how it combines modalities?
  3. Why might comparing multimodal models trained on different datasets be misleading when judging architectural improvements?
  4. What made the original VQA benchmark solvable without real multimodal reasoning, and how did Hateful Memes and Winoground try to avoid the same problem?
  5. What role does freezing a pretrained language model play in architectures like the frozen-projection approach, Flamingo, and BLIP-2?

Vocabulary

modality (noun)
A type of information, such as text, image, or audio.
Combining the text and image modality is the goal of multimodal models.
multimodal (adjective)
Involving more than one type of information, like text and images together.
A multimodal model can process both a caption and its picture.
McGurk effect (noun)
An illusion where what you see changes what sound you perceive hearing.
The McGurk effect shows perception blends different senses together.
fusion (noun)
The process of combining information from different modalities.
Fusion strategies decide when and how modalities interact.
early fusion (noun)
Combining modalities right from the start of processing.
Early fusion lets image and text features interact from the beginning.
late fusion (noun)
Combining modalities only at the end, using their final separate outputs.
Late fusion keeps each modality's processing independent until the end.
contrastive loss (noun)
A training objective that pulls matching pairs together and pushes mismatched pairs apart.
CLIP is trained using a contrastive loss between images and captions.
embedding space (noun)
A mathematical space where similar items are represented close together.
Matching image-text pairs are aligned in a shared embedding space.
zero-shot classification (noun)
Classifying new categories without any specific training examples for them.
CLIP enables zero-shot classification using text prompts.
cross-attention (noun)
An attention mechanism where one sequence attends to a different sequence.
Cross-attention lets a dual-stream model connect image and text features.
region feature (noun)
A feature vector extracted from a detected region of an image.
Older multimodal models used region features from object detectors.
Vision Transformer (noun)
A Transformer model adapted to treat image patches like tokens.
A Vision Transformer splits an image into patches processed like words.
foundation model (noun)
A large, general-purpose model that can be adapted to many different tasks.
FLAVA aims to be a single foundation model for vision and language.
frozen model (noun)
A pretrained model kept unchanged while only a small extra part is trained.
BLIP-2 keeps its language model frozen and trains a small connector.
chain-of-thought prompting (noun)
Prompting a model to produce reasoning steps before its final answer.
Multimodal chain-of-thought prompting improves visual reasoning tasks.
benchmark (noun)
A standard test used to measure and compare model performance.
Winoground is a benchmark testing compositional understanding.
inherently (adverb)
In a basic, essential way, by its very nature.
Human understanding of the world is inherently multimodal.
illusion (noun)
A false perception that differs from reality.
The McGurk effect is a well-known perceptual illusion.
keypoint descriptor (noun)
A numeric summary of a distinctive small region in an image.
Bag of visual words clusters keypoint descriptors from images.
concatenate (verb)
To join two or more things together in a sequence.
VisualBERT concatenates image region features and text tokens.
modulate (verb)
To adjust or control something's strength or form.
FiLM modulates a ResNet's feature maps using another modality's vector.
novelty (noun)
The quality of being new and original.
CLIP's success owed less to architectural novelty than to data scale.
generalize (verb)
To perform well across situations different from training examples.
CLIP generalizes better to adversarial image variants than ResNet.
adversarial (adjective)
Deliberately designed to confuse or trick a model.
CLIP performs surprisingly well on adversarial image variants.
pool (verb)
To combine multiple values into a single summary representation.
MMBT pools ResNet feature maps into BERT's token space.
compositional (adjective)
Built from smaller parts combined according to rules, like word order in a sentence.
Winoground tests compositional understanding of word order.
game (a benchmark) (verb)
To achieve a good score without truly solving the intended problem.
Early VQA datasets could be gamed by guessing a common answer.
benign (adjective)
Not harmful or dangerous.
Hateful Memes pairs benign and hateful versions of the same meme.

From the YouTube description

For more information about Stanford's Artificial Intelligence professional and graduate programs, visit: https://stanford.io/ai

To learn more about this course, visit: https://online.stanford.edu/courses/c...
To follow along with the course schedule and syllabus, visit: http://web.stanford.edu/class/cs224n/

Douwe Kiela
Adjunct Professor in Symbolic Systems at Stanford University.
https://douwekiela.github.io/

Professor Christopher Manning
Thomas M. Siebel Professor in Machine Learning, Professor of Linguistics and of Computer Science
Director, Stanford Artificial Intelligence Laboratory (SAIL)

#naturallanguageprocessing #deeplearning

← Lecture 18: NLP, Linguistics, and Philosophy · Lecture 19: Model Interpretability and Editing, with Been Kim →