Multimodal AI

Introduction to Multimodal AI

Humans perceive and understand the world through multiple senses—vision, hearing, touch, and language. Multimodal AI aims to build systems that can similarly process, relate, and generate information across multiple data modalities (text, images, audio, video, etc.) within a unified framework.

📖 Multimodal AI

AI systems designed to understand, integrate, and generate information from two or more distinct data modalities (e.g., text + images, audio + video, text + code). Unlike unimodal models that specialise in a single modality, multimodal models learn shared representations that capture cross-modal relationships and enable tasks like visual question answering, image captioning, and text-to-image generation.

The surge in multimodal AI research has been driven by: (1) the availability of large-scale paired datasets (image-text pairs from the internet), (2) the success of Transformer architectures that can be adapted across modalities, and (3) the development of contrastive and generative training objectives that learn rich cross-modal representations.

💡 Modalities in AI

Common modalities include: Text (natural language), Images (photographs, diagrams), Audio (speech, music, environmental sounds), Video (temporal sequences of frames), 3D (point clouds, meshes), Tabular data, and Sensor readings (lidar, radar, IMU). The term "multimodal" typically implies at least two of these are jointly processed.

CLIP: Contrastive Language-Image Pre-training

CLIP (Contrastive Language-Image Pre-training), introduced by OpenAI in 2021, revolutionised multimodal AI by learning a joint embedding space for images and text using a simple yet powerful contrastive objective.

📖 CLIP Architecture

CLIP consists of two encoders: an image encoder (Vision Transformer or ResNet) and a text encoder (Transformer). Both encoders map their inputs to a shared embedding space of dimension d. The model is trained with a contrastive loss that maximises the cosine similarity between matching (image, text) pairs and minimises it for non-matching pairs within a batch.

CLIP training procedure:

  1. Collect a massive dataset of (image, text) pairs from the internet (~400 million pairs in the original paper).
  2. For a batch of N pairs, compute image embeddings I1...IN and text embeddings T1...TN.
  3. Compute the N × N similarity matrix S where Sij = cos(Ii, Tj) / τ (temperature-scaled).
  4. Apply cross-entropy loss treating the diagonal entries as positive pairs and off-diagonal entries as negatives (symmetric InfoNCE loss).

🔧 CLIP Contrastive Loss (InfoNCE)

For a batch of N image-text pairs with image embeddings {Ii} and text embeddings {Ti}:
L = −(1/2N) ∑i [log(exp(Ii·Ti/τ) / ∑j exp(Ii·Tj/τ)) + log(exp(Ti·Ii/τ) / ∑j exp(Ti·Ij/τ))]
where τ is a learnable temperature parameter. The first term is image-to-text matching; the second is text-to-image matching.

🔬 Zero-Shot Classification with CLIP

To classify an image into one of K classes without any training: (1) Create text prompts like "a photo of a {class_name}" for each class. (2) Compute text embeddings for all K prompts and the image embedding. (3) Select the class whose text embedding has the highest cosine similarity with the image embedding. This achieves competitive accuracy on ImageNet without ever training on ImageNet labels.

💡 Impact of CLIP

CLIP's shared embedding space became foundational for subsequent models: DALL-E 2 uses CLIP embeddings for text-to-image generation, Stable Diffusion uses CLIP's text encoder, and numerous downstream applications use CLIP for image search, content filtering, and zero-shot transfer across visual tasks.

Text-to-Image Generation: DALL-E & Diffusion Models

Text-to-image generation is one of the most visible applications of multimodal AI, producing realistic images from natural language descriptions. The field has evolved rapidly from DALL-E (2021) through Stable Diffusion to modern systems.

📖 Text-to-Image Generation

The task of generating a visual image conditioned on a natural language description (prompt). Modern systems use diffusion models conditioned on text embeddings from CLIP or T5 encoders to produce high-fidelity, diverse images that faithfully follow complex textual instructions.

Evolution of text-to-image systems:

ModelYearApproachKey Innovation
DALL-E2021Discrete VAE + Autoregressive TransformerFirst large-scale text-to-image model
DALL-E 22022CLIP + Diffusion (unCLIP)CLIP-guided diffusion prior
Stable Diffusion2022Latent Diffusion Model (LDM)Operates in latent space; open-source
Imagen2022T5 text encoder + Cascade DiffusionShowed language understanding matters more than image prior
DALL-E 32023Improved captioning + DiffusionBetter prompt following via recaptioned training data
FLUX / SD32024–25DiT (Diffusion Transformer)Transformer replaces U-Net backbone

🔬 How Latent Diffusion Works

Stable Diffusion operates in a compressed latent space: (1) An autoencoder compresses images into a smaller latent representation (e.g., 64×64 instead of 512×512). (2) A U-Net diffusion model is trained to denoise in this latent space, conditioned on text embeddings from CLIP. (3) At generation time, start from random noise in latent space, iteratively denoise conditioned on the text prompt, then decode the final latent back to pixel space. Operating in latent space dramatically reduces computation.

⚠️ Ethical Concerns in Text-to-Image

Text-to-image models raise significant concerns: generation of deepfakes and misinformation, reproduction of biases from training data (stereotypical depictions), potential copyright infringement from training on artists' work without consent, and generation of harmful/explicit content. Responsible deployment requires content filters, provenance watermarks, and clear usage policies.

Vision-Language Models (VLMs)

Vision-Language Models (VLMs) go beyond CLIP's contrastive alignment to enable rich, generative understanding of both visual and textual information. They can describe images, answer questions about them, and reason over visual content.

📖 Vision-Language Model

A model that takes both visual (image/video) and textual inputs and produces textual outputs. VLMs typically combine a pre-trained vision encoder with a large language model, connected via a projection layer or cross-attention mechanism. They are trained on image-text pairs for tasks like captioning, VQA, and visual reasoning.

Major VLM architectures:

  • Flamingo (DeepMind, 2022): Interleaves frozen vision features into an LLM via gated cross-attention layers. Supports few-shot visual learning by conditioning on interleaved image-text examples.
  • BLIP-2 (Salesforce, 2023): Uses a lightweight Querying Transformer (Q-Former) to bridge a frozen image encoder and a frozen LLM, minimising trainable parameters.
  • LLaVA (Microsoft, 2023): Projects visual features from CLIP's ViT into the LLM's embedding space using a simple linear projection, then fine-tunes the LLM on visual instruction data.
  • GPT-4V / GPT-4o (OpenAI, 2023–24): Natively multimodal large model capable of processing interleaved text and images, with strong visual reasoning capabilities.
  • Gemini (Google, 2023–24): Natively multimodal from pre-training, processing text, images, audio, and video in a single model.

🔬 LLaVA Architecture

LLaVA (Large Language and Vision Assistant): (1) Process image with CLIP ViT-L/14 to get grid features. (2) Apply a trainable linear projection W to map visual tokens into the LLM's word embedding space: Hv = W · Zv. (3) Concatenate visual tokens with text tokens and feed into the LLM (e.g., LLaMA). (4) The LLM generates text conditioned on both visual and textual inputs. (5) Fine-tune on 150K GPT-4-generated visual instruction-following examples.

Multimodal Fusion Strategies

A central design decision in multimodal AI is how and when to combine information from different modalities. This is the fusion problem.

📖 Multimodal Fusion

The process of integrating information from multiple modalities into a unified representation. Fusion strategies vary by when in the processing pipeline the combination occurs and how the modalities interact.

Three primary fusion strategies:

StrategyDescriptionProsCons
Early FusionCombine raw or lightly processed inputs at the input level (e.g., concatenation of features)Captures low-level cross-modal interactionsModalities must have compatible representations; high dimensionality
Late FusionProcess each modality independently with separate encoders; combine final representationsModular; pre-trained unimodal encoders can be reusedMisses fine-grained cross-modal interactions
Mid/Deep FusionIntegrate modalities at intermediate layers using cross-attention, gating, or bilinear poolingRich cross-modal interactions; flexibleMore complex; harder to train

🔬 Fusion in Practice

  • CLIP: Late fusion — separate image/text encoders with contrastive alignment at the output level.
  • Flamingo: Mid fusion — cross-attention layers interleave visual information into LLM layers.
  • VisualBERT: Early fusion — image region features and text tokens are concatenated and jointly processed by a single Transformer.
  • Gemini: Deep/native fusion — all modalities are tokenised and processed jointly from the earliest layers of a single Transformer.

💡 Choosing a Fusion Strategy

The optimal fusion strategy depends on: (1) whether pre-trained unimodal encoders are available (favouring late/mid fusion), (2) the degree of cross-modal interaction required by the task (VQA needs fine-grained fusion; retrieval may not), (3) computational budget, and (4) dataset size (native fusion requires more data).

Cross-Modal Attention

Cross-modal attention is the dominant mechanism for mid-level fusion in modern multimodal models. It allows one modality to selectively attend to relevant parts of another modality.

📖 Cross-Modal Attention

An attention mechanism where queries come from one modality and keys/values come from another. For example, in image-guided text generation, text tokens generate queries (Q) while image patch embeddings provide keys (K) and values (V): CrossAttn(Qtext, Kimage, Vimage) = softmax(QtextKimageT/√d) · Vimage

Variants of cross-modal attention:

  • Bidirectional Cross-Attention: Both modalities attend to each other (used in VisualBERT, ALBEF). Text attends to image AND image attends to text.
  • Unidirectional Cross-Attention: Only one modality attends to the other (used in Flamingo: text attends to image, but not vice versa).
  • Gated Cross-Attention: A learnable gate controls how much cross-modal information flows into each layer (Flamingo uses tanh gating, initialised to zero).
  • Perceiver Cross-Attention: A small set of learnable latent tokens cross-attend to the input modality, creating a bottleneck that compresses information (used in Perceiver IO, BLIP-2's Q-Former).

🔧 Cross-Attention Complexity

For text with n tokens attending to an image with m patches, standard cross-attention has complexity O(n · m · d). The Perceiver's bottleneck approach reduces this to O(n · k · d + k · m · d) where k « min(n, m) is the number of latent tokens, enabling efficient processing of high-resolution images or long videos.

Visual Question Answering (VQA)

Visual Question Answering is a benchmark multimodal task that requires understanding both an image and a natural language question to produce a natural language answer.

📖 VQA

Given an image I and a question Q about the image, produce an answer A. The answer may be a single word ("yes", "red", "3"), a phrase, or a full sentence. VQA requires visual recognition (what objects are present?), spatial reasoning (where are they?), counting, reading text in images (OCR), and commonsense reasoning.

Evolution of VQA approaches:

  1. CNN + LSTM (early): Extract CNN features from the image and LSTM encoding of the question; combine via concatenation or element-wise product; classify into answer vocabulary.
  2. Attention-based (2016–19): Apply question-guided attention over image regions (Stacked Attention Networks, Bottom-Up Top-Down Attention). Enables focusing on relevant image regions.
  3. Transformer-based (2019–22): Models like ViLBERT, LXMERT, and UNITER use Transformer architectures with cross-attention between image features and question tokens.
  4. VLM-based (2023+): GPT-4V, Gemini, and LLaVA treat VQA as a general visual instruction-following task, achieving state-of-the-art through in-context learning and extensive pre-training.

🔬 VQA Example

Image: A kitchen scene with a cat sitting on a red mat next to a white oven.
Question: "What colour is the mat the cat is sitting on?"
Answer: "Red"

This requires: object detection (cat, mat), relationship understanding (sitting on), attribute recognition (red colour), and language comprehension of the question.

⚠️ VQA Dataset Biases

Many VQA models exploit language biases rather than truly understanding images. For example, the answer to "What sport is being played?" is almost always "tennis" in VQA v1. The VQA v2 dataset addresses this with balanced pairs: for every (image, question, answer) triple, there exists a semantically similar image that leads to a different answer, forcing models to actually look at the image.

Multimodal Architecture Taxonomy

Modern multimodal systems can be classified by how they handle multiple modalities architecturally:

📖 Architecture Classes

  • Dual-Encoder: Separate encoders for each modality, aligned in a shared space (CLIP, ALIGN). Good for retrieval.
  • Encoder-Decoder: An encoder processes the input modality, and a decoder generates in the output modality (image captioning, text-to-image).
  • Fusion Encoder: A single encoder processes concatenated multimodal tokens (VisualBERT, Gemini).
  • Bridge/Adapter: A lightweight module connects frozen unimodal models (BLIP-2's Q-Former, LLaVA's projection layer).

🔬 Adapter-Based Efficiency

BLIP-2 demonstrates extreme parameter efficiency: by training only a 188M-parameter Q-Former bridge between a frozen 1B-parameter ViT and a frozen 3B-parameter LLM, it achieves strong VQA performance while training less than 5% of total parameters. This "bridge" approach has become a dominant paradigm, enabling rapid adaptation of existing foundation models to multimodal tasks.

Applications & Benchmarks

Multimodal AI has a wide range of practical applications:

  • Image Captioning: Generate textual descriptions of images (MS-COCO, Flickr30K benchmarks).
  • Visual Grounding: Locate objects in an image given a textual description (referring expression comprehension).
  • Image-Text Retrieval: Find relevant images given a text query or vice versa.
  • Document Understanding: Extract information from documents combining text, tables, and figures.
  • Video Understanding: Answer questions about videos, generate video summaries, temporal grounding.
  • Embodied AI: Agents that perceive the world visually and receive language instructions.
  • Medical Imaging: Combine radiology images with clinical text for diagnosis support.
  • Accessibility: Image descriptions for visually impaired users, automatic alt-text generation.

💡 Key Benchmarks

VQA v2: Visual question answering. MS-COCO: Captioning and detection. Winoground: Compositional reasoning. MMMU: Multi-discipline multimodal understanding requiring expert knowledge. MMBench: Comprehensive VLM evaluation. These benchmarks test increasingly complex aspects of multimodal understanding, from basic recognition to expert-level reasoning.

Summary & Key Takeaways

Multimodal AI represents a paradigm shift from specialised unimodal models to unified systems that perceive and reason across modalities, much like humans do.

Core concepts covered:

  • CLIP: Contrastive learning aligns images and text in a shared embedding space, enabling zero-shot transfer.
  • Text-to-Image: Diffusion models (DALL-E 2, Stable Diffusion) generate images conditioned on text embeddings.
  • Vision-Language Models: Combine vision encoders with LLMs for generative visual understanding (Flamingo, LLaVA, GPT-4V).
  • Fusion Strategies: Early, late, and mid fusion offer different trade-offs between cross-modal interaction depth and modularity.
  • Cross-Modal Attention: The dominant mechanism for fine-grained multimodal interaction, with variants like gated and perceiver-style attention.
  • VQA: A key benchmark task requiring joint visual and linguistic understanding.
  • Architecture Patterns: Dual-encoder, encoder-decoder, fusion encoder, and bridge/adapter represent the main design paradigms.

🔧 GATE DA Connection

For GATE DA, the relevant foundations of multimodal AI include: (1) attention mechanisms and their mathematical formulation (softmax over scaled dot products), (2) contrastive loss functions and their relationship to maximum likelihood estimation, (3) encoder-decoder architectures, and (4) the concept of representation learning and transfer learning. These are all core ML topics that underpin multimodal systems.