Computer Vision and Image Processing

Chapter 12
Generative AI, Multimodal Models, and Foundation Vision Models

Post Graduate Program in AI and ML
Computer Vision and Image Processing   •   Post Graduate

12. Generative AI, Multimodal Models, and Foundation Vision Models

Introduction and Context

Computer vision has traditionally been framed as a discriminative discipline: an image is provided to a model, and the model predicts a class, location, identity, depth value, or other property. Generative artificial intelligence changes this direction of reasoning. Instead of only asking what is present in an image, generative models learn how visual data are distributed and can produce new images, reconstruct missing information, edit existing content, or translate between modalities.

This shift has been accompanied by the emergence of foundation vision models. A foundation model is trained on broad and usually very large datasets so that it learns transferable representations rather than solving only one narrowly defined task. Vision-language models extend this idea by learning relationships between images and text. They can support image captioning, visual question answering, retrieval, open-vocabulary recognition, document analysis, visual search, and multimodal agents.

These technologies are important for postgraduate students because their value does not depend only on architecture. Effective use requires understanding objectives, data, training procedures, prompting, adaptation, evaluation, deployment constraints, and governance. A visually impressive generated image may still be factually incorrect. A model that performs well on a benchmark may fail under distribution shift. A multimodal system may retrieve relevant evidence yet generate an unsupported conclusion. The central professional task is therefore not simply selecting the largest model, but designing a reliable system around its capabilities and limitations.

Learning Objectives

After studying this chapter, students should be able to:

1. Explain the principles and differences among autoencoders, variational autoencoders, GANs, and diffusion models.

2. Describe how self-supervised learning produces transferable visual representations.

3. Analyse the architecture and applications of vision-language and multimodal foundation models.

4. Design prompts, retrieval-augmented workflows, and adaptation strategies for visual tasks.

5. Evaluate synthetic data, zero-shot learning, and model performance under realistic conditions.

6. Identify technical, ethical, legal, security, and governance risks in generative vision systems.

7. Select an appropriate model or system architecture for a practical computer-vision problem.

From Recognition to Generation

A discriminative model estimates a conditional relationship such as P(y|x), where x is an image and y is a label. A generative model attempts to learn the data distribution P(x), or a conditional distribution such as P(x|c), where c may be a text description, class, mask, or reference image. This distinction is not absolute: many modern systems combine generative and discriminative objectives.

Generative modelling is useful for image synthesis, inpainting, super-resolution, style transfer, simulation, data augmentation, and representation learning. It is also difficult. Images contain complex spatial dependencies, and visual quality is not equivalent to semantic correctness. A model may produce a realistic-looking object with an impossible structure, incorrect text, or physically implausible lighting.

Autoencoders and Variational Autoencoders

An autoencoder consists of an encoder and a decoder. The encoder maps an input image x to a latent representation z, while the decoder reconstructs an approximation x-hat from z. Training commonly minimizes a reconstruction loss, such as mean squared error or a perceptual loss. The bottleneck encourages the network to retain information useful for reconstruction.

A conventional autoencoder is primarily a representation-learning and compression model. Its latent space is not necessarily smooth or suitable for sampling. A variational autoencoder (VAE) addresses this issue by treating z as a probability distribution, usually parameterized by a mean and variance. Its objective combines reconstruction loss with a regularization term that encourages the learned latent distribution to remain close to a prior, often a standard normal distribution. The regularization term is commonly expressed through Kullback–Leibler divergence.

VAEs offer structured latent spaces and stable training, but samples may appear blurry because pixel-level likelihood objectives average over multiple plausible outcomes. In contemporary systems, latent autoencoders are often used to compress images before a more powerful generative process operates in latent space. This reduces computational cost while preserving semantically useful visual information.

Generative Adversarial Networks

A GAN contains a generator and a discriminator. The generator maps random noise, or a condition, to a synthetic image. The discriminator attempts to distinguish real images from generated images. Training is formulated as an adversarial game: the generator seeks to fool the discriminator, while the discriminator seeks to classify correctly.

GANs can produce sharp, high-resolution images and have been widely used for face synthesis, image-to-image translation, super-resolution, and domain adaptation. However, adversarial training can be unstable. Mode collapse occurs when the generator produces limited varieties of samples, even if those samples appear realistic. The discriminator may become too strong or provide uninformative gradients. Choices such as Wasserstein objectives, gradient penalties, normalization, and carefully designed architectures can improve stability, but do not eliminate the underlying challenge.

GAN evaluation illustrates an important principle: visual sharpness alone is insufficient. A system should be assessed for diversity, fidelity, conditioning accuracy, robustness, and downstream utility.

Diffusion Models

Diffusion models generate data through a gradual denoising process. During the forward process, controlled noise is added to an image until it approaches a simple noise distribution. A neural network then learns the reverse process: given a noisy sample and a time step, it predicts the noise, clean image, or related parameterization needed to progressively recover a sample.

Text-to-image diffusion models condition denoising on text representations. Cross-attention enables image-generation layers to use token-level information from a text encoder. Image-to-image generation, inpainting, control by edges or depth, and subject conditioning can be implemented by modifying the initial noise or adding spatial controls.

Diffusion models generally provide strong sample diversity and stable training compared with classical GANs, but sampling can be computationally expensive. Acceleration methods reduce the number of denoising steps, while latent diffusion performs the process in a compressed representation. Model quality remains dependent on training data, conditioning fidelity, resolution, and the ability of the text encoder to represent the requested concept.

Self-Supervised Learning and Visual Representation

Supervised learning requires labelled examples, which are expensive and often ambiguous. Self-supervised learning constructs a learning signal from the data itself. The model may predict a hidden portion of an image, determine whether two views belong to the same image, reconstruct masked patches, or align image and text representations.

Contrastive learning trains related views to have similar representations and unrelated examples to have dissimilar representations. The choice of augmentations is critical: an augmentation should preserve the semantic identity relevant to the task. Excessive cropping, colour alteration, or geometric distortion can remove information that the downstream task requires.

Masked image modelling hides patches and asks a model to infer their content or representation. This objective encourages contextual understanding and is especially compatible with transformer-based vision architectures. In distillation-based approaches, a student representation is trained to match a teacher representation without requiring manual labels.

Self-supervised pretraining is valuable because the resulting encoder can be adapted to classification, segmentation, detection, retrieval, or anomaly detection. Nevertheless, pretraining does not guarantee neutrality. The model can absorb demographic, geographic, cultural, and commercial biases from its data. Transfer performance also depends on similarity between the pretraining distribution and the deployment domain.

Vision-Language and Multimodal Foundation Models

A vision-language model (VLM) represents visual and textual information in a shared or connected computational space. One influential design uses separate image and text encoders trained so that matching image-text pairs have similar embeddings. This supports cross-modal retrieval and zero-shot classification: a visual embedding can be compared with text embeddings representing candidate labels.

Another design connects a pretrained vision encoder to a language model through a projection layer or a learned query module. The language model can then condition its responses on visual features. Autoregressive multimodal models generate text token by token, whereas some systems also generate images, audio, or actions.

Important capabilities include:

  • Image and video captioning.
  • Visual question answering.
  • Document understanding and chart interpretation.
  • Image-text retrieval.
  • Open-vocabulary detection and segmentation.
  • Visual grounding, in which language is linked to image regions.
  • Multimodal dialogue and tool use.

The word “understanding” should be used carefully. A VLM may associate language with visual patterns without possessing a complete physical model of the world. It may recognize a familiar object but misinterpret relations, counting, scale, text, or causality.

Zero-Shot and Few-Shot Learning

Zero-shot learning applies a model to a class or task for which it received no direct task-specific labels during adaptation. In a contrastive image-text model, the system may compare an image with prompts such as “a photograph of a healthy leaf” and “a photograph of a diseased leaf.” The prediction follows from similarity between image and text embeddings.

Prompt wording, class-name ambiguity, and domain mismatch can strongly influence results. Prompt ensembling, calibrated confidence, and a small number of labelled examples can improve reliability. Few-shot learning uses limited examples to adapt the decision boundary or guide the model through demonstrations, but it remains vulnerable to unrepresentative examples.

Prompting as System Design

A prompt is not merely a question. In a professional multimodal application, it is part of an interface contract. A robust prompt may specify the task, relevant visual evidence, output schema, uncertainty behaviour, and prohibited assumptions. For example, a document-extraction prompt can require a JSON structure, page and region references, explicit null values for missing fields, and a distinction between observed text and inferred meaning.

Prompt engineering should be evaluated experimentally. Variables include image resolution, crop selection, ordering of images, instruction specificity, demonstrations, and output constraints. A prompt cannot compensate for absent evidence, poor image quality, or a model that lacks the required capability. Systems should validate outputs with parsers, schemas, rules, or secondary models rather than treating generated text as authoritative.

Retrieval-Augmented Multimodal Systems

Retrieval-augmented generation (RAG) supplies a model with external evidence at inference time. In a multimodal RAG pipeline, documents may contain text, tables, page images, diagrams, photographs, and metadata. The system first converts these resources into searchable representations, retrieves relevant items, and then provides them to a multimodal generator.

A typical workflow includes ingestion, optical character recognition, layout analysis, chunking, image or region embedding, hybrid retrieval, reranking, context assembly, generation, and citation validation. Hybrid retrieval combines lexical search with dense vector search. Reranking can use a cross-encoder or multimodal relevance model to improve the evidence set.

RAG reduces dependence on static model memory and can provide traceable sources. It does not automatically eliminate hallucination. Retrieval may fail because of poor OCR, incomplete indexing, ambiguous queries, or visually complex layouts. The generator may ignore evidence or combine unrelated passages. Therefore, evaluation should separately measure retrieval recall, evidence relevance, answer faithfulness, citation accuracy, and task success.

Synthetic Data and Model Adaptation

Synthetic data are generated or procedurally produced examples used for training, testing, simulation, or privacy-preserving development. In computer vision, synthetic images can provide precise masks, depth maps, poses, object identities, and rare failure cases. They are particularly useful in robotics, industrial inspection, autonomous systems, and augmented reality.

The principal risk is synthetic-to-real domain gap. Differences in texture, lighting, camera characteristics, object variation, and background context can cause a model trained on synthetic images to fail in deployment. Domain randomization, photorealistic rendering, style adaptation, real-data fine-tuning, and careful validation can reduce but not remove this gap.

Adaptation strategies range from linear probing, in which only a classifier head is trained, to full fine-tuning. Parameter-efficient approaches such as adapters, low-rank updates, and prompt tuning modify a small number of parameters and reduce storage and computational demands. They are useful when several domain-specific versions must be maintained. Adaptation data must be curated for coverage, quality, licensing, and demographic or environmental representation.

Evaluation and Decision-Making

Generative and multimodal models require multidimensional evaluation. For images, useful dimensions include fidelity, diversity, prompt alignment, visual quality, anatomical or geometric plausibility, and safety. For VLMs, evaluation may include accuracy, grounding, calibration, hallucination rate, robustness to perturbations, and performance across demographic or geographic subgroups.

Automated metrics are useful but incomplete. Pixel similarity can penalize a valid alternative reconstruction. Embedding-based metrics may reward semantic similarity while missing factual errors. Human evaluation should use clear rubrics and, where possible, independent raters. Real-world evaluation should include distribution shift, degraded inputs, adversarial prompts, ambiguous cases, and abstention behaviour.

A useful deployment decision compares not only accuracy but also latency, cost, energy consumption, privacy, auditability, integration complexity, and consequences of error. A smaller adapted model may be preferable to a larger general model when the task is stable, sensitive, and well specified.

Illustrative Case Study: Multimodal Inspection of Industrial Components

Background

A manufacturing organization inspects cast-metal components for cracks, incomplete filling, and surface deformation. Existing inspection relies on manual examination and a conventional classifier trained on a limited set of labelled photographs.

Situation and Problem

The classifier performs acceptably under controlled lighting but fails when cameras, materials, or production lines change. Rare defects are underrepresented, and operators need an explanation linked to the inspected region. The organization is considering a multimodal foundation model and synthetic data.

Analysis

A general VLM may describe visible defects but cannot be assumed to meet the precision or traceability requirements of quality control. The project therefore separates detection from explanation. A self-supervised vision encoder is pretrained or selected for industrial imagery. Synthetic rendering generates varied views, lighting conditions, and defect masks. Real images are used for validation and parameter-efficient adaptation. A retrieval system stores approved defect manuals, process specifications, and labelled reference images.

Approach and Solution

The production pipeline first performs image-quality checks and defect segmentation. Candidate regions are passed to an adapted vision model. A multimodal assistant receives the region, model prediction, confidence, and retrieved specification excerpts. It produces a structured report containing defect category, location, evidence, confidence, and recommendation. If confidence is low or evidence conflicts, the system abstains and routes the item to an expert.

Outcome

The combined design is more dependable than asking a general-purpose model to make an unrestricted accept-or-reject decision. Synthetic data improve coverage, while real-data validation exposes rendering artefacts. Retrieval makes explanations traceable, but the final decision remains governed by validated inspection rules and human escalation.

Learning Points

The case demonstrates that foundation models are components within a socio-technical system. Task decomposition, evidence retrieval, adaptation, uncertainty handling, and human oversight are as important as model selection. Generative capability should not be confused with authorization to make safety-critical decisions.

Limitations, Risks, and Professional Governance

Generative vision systems can hallucinate objects, text, relationships, or sources. They may reproduce training-data biases, expose private information, or generate misleading synthetic media. Training data may contain copyrighted, confidential, or personally identifiable material. Deepfakes and image manipulation create risks for identity fraud, misinformation, and reputational harm.

Security threats include prompt injection through images or retrieved documents, data poisoning, model extraction, adversarial perturbations, and leakage of sensitive training examples. Multimodal systems may also follow malicious instructions embedded in a document image rather than the trusted system instruction.

Governance should address data provenance, consent, licensing, access control, retention, model cards, audit logs, red-team testing, incident response, and disclosure of synthetic content. High-impact decisions require documented human accountability and an appeal process. Privacy-preserving techniques such as de-identification, access minimization, secure inference, and differential privacy may be appropriate, although each introduces trade-offs.

Common professional mistakes include using benchmark scores as deployment guarantees, fine-tuning on contaminated evaluation data, accepting fluent responses as evidence, ignoring class imbalance, failing to test rare cases, and deploying a model without an abstention policy. A reliable workflow defines failure conditions before deployment and monitors them continuously afterward.

Current Developments and Emerging Directions

Research is moving toward unified models that process images, video, text, audio, 3D data, and actions. Video-language models are being used for temporal retrieval, event understanding, and robotic planning. Vision encoders are increasingly connected to tool-using agents that can search databases, execute code, inspect multiple images, or control software.

Other important directions include controllable generation, 3D-aware synthesis, neural rendering, efficient on-device inference, watermarking and provenance standards, retrieval over multimodal knowledge bases, and continual adaptation. Evaluation is also evolving toward stress tests that measure grounding, factuality, cultural variation, temporal reasoning, and real-world utility rather than image quality alone.

Best Practices for Applied Work

A sound project begins with a precise task definition and an explicit error-cost analysis. Select the simplest model that can meet the requirement. Establish a representative baseline before introducing a foundation model. Maintain separate development, validation, and deployment-like test sets, and document their provenance.

Use retrieval when current or organization-specific evidence matters. Require structured outputs and validate them programmatically. Treat synthetic data as a supplement, not an automatic substitute for real examples. Test adaptation for catastrophic forgetting and subgroup performance. Monitor latency, cost, drift, hallucination, and abstention rates after deployment. Finally, retain human review for high-consequence decisions and communicate uncertainty to users.

Chapter Summary

Generative computer vision models learn to reconstruct, synthesize, transform, or complete visual data. Autoencoders provide compact representations, VAEs introduce probabilistic latent spaces, GANs use adversarial training, and diffusion models generate images through learned denoising. Self-supervised learning enables transferable visual representations without requiring exhaustive manual labels.

Vision-language and multimodal foundation models connect visual information with language, supporting retrieval, captioning, question answering, open-vocabulary recognition, and multimodal interaction. Zero-shot learning and prompting extend their use, while retrieval-augmented generation supplies current and organization-specific evidence. Synthetic data and parameter-efficient adaptation can improve domain performance, but domain gaps and biased data remain important concerns.

Reliable deployment requires evaluation beyond visual quality or benchmark accuracy. Hallucination, bias, privacy risk, prompt injection, copyright concerns, distribution shift, and poor uncertainty handling must be addressed through technical controls and governance. The most effective systems combine foundation models with retrieval, validation, human oversight, and clearly defined operational boundaries.

Key Terms

Autoencoder: A network that encodes an input into a latent representation and reconstructs it through a decoder.

Variational autoencoder: A probabilistic autoencoder that regularizes its latent distribution toward a prior.

GAN: A generative adversarial network containing a generator and discriminator trained competitively.

Mode collapse: A GAN failure in which generated samples lack sufficient diversity.

Diffusion model: A generative model that learns to reverse a gradual noise-addition process.

Latent diffusion: Diffusion performed in a compressed representation rather than directly in pixel space.

Self-supervised learning: Learning from automatically constructed targets derived from unlabelled data.

Contrastive learning: Learning representations by bringing related examples together and separating unrelated examples.

Foundation model: A broadly pretrained model adaptable to many downstream tasks.

Vision-language model: A model that represents or connects visual and textual information.

Zero-shot learning: Performing a task or recognizing a class without task-specific labelled examples.

Prompt: An instruction or conditioning input that guides model behaviour.

Multimodal RAG: Retrieval-augmented generation using text, images, layouts, or other modalities as evidence.

Synthetic data: Artificially generated or procedurally simulated training or testing examples.

Domain shift: A change between training data conditions and deployment data conditions.

Parameter-efficient adaptation: Updating a small portion or auxiliary set of parameters for a new task or domain.

Grounding: Linking a model’s output to specific visual regions or external evidence.

Hallucination: A plausible-looking but unsupported or incorrect model output.

Calibration: The agreement between predicted confidence and actual correctness.

Model card: Documentation describing a model’s intended use, performance, limitations, and risks.

Review Questions

Short Answer Questions

1. How does a variational autoencoder differ from a conventional autoencoder?

2. What is mode collapse in GAN training?

3. Why is self-supervised pretraining useful for computer vision?

4. Define zero-shot learning in the context of vision-language models.

5. What is the purpose of retrieval in a multimodal RAG system?

Long Answer Questions

1. Compare autoencoders, GANs, and diffusion models in terms of objectives, strengths, and limitations.

2. Explain how a vision-language model can support image-text retrieval and open-vocabulary classification.

3. Describe the stages of a multimodal retrieval-augmented generation pipeline.

4. Discuss synthetic-to-real domain gap and methods for reducing it.

5. Explain why benchmark accuracy alone is insufficient for evaluating multimodal foundation models.

Analytical / Application Questions

1. You must build a system to extract fields from scanned invoices containing tables and handwritten notes. Propose a multimodal architecture, retrieval strategy, validation method, and human-escalation policy.

2. A text-to-image model produces visually realistic products but frequently omits a required safety component. Analyse possible causes and design an evaluation and mitigation plan.

3. An organization wants to use a general VLM for medical triage. Assess the technical, ethical, governance, and operational conditions that should be satisfied before deployment.

22. Multiple Choice Questions with Answers

Question 1

Which characteristic most directly distinguishes a variational autoencoder from a conventional autoencoder?

A. It uses a discriminator to classify real and generated images

B. It regularizes a probabilistic latent distribution toward a prior

C. It removes the decoder from the architecture

D. It can only reconstruct binary images

Correct Answer: B. It regularizes a probabilistic latent distribution toward a prior

Question 2

A GAN generates highly realistic images, but nearly all samples have the same appearance. Which problem is most likely occurring?

A. Mode collapse

B. Over-regularized diffusion

C. Retrieval failure

D. Prompt ensembling

Correct Answer: A. Mode collapse

Question 3

In a diffusion model, what is learned during generation?

A. A reverse process that progressively removes noise

B. A fixed lookup table of image pixels

C. Only a binary real-versus-fake decision

D. A manual segmentation mask for every image

Correct Answer: A. A reverse process that progressively removes noise

Question 4

Why can a contrastive vision-language model perform zero-shot classification?

A. It compares an image representation with representations of candidate text labels

B. It retrains all parameters for every new class

C. It requires a segmentation mask for each test image

D. It generates labels randomly and selects the longest one

Correct Answer: A. It compares an image representation with representations of candidate text labels

Question 5

Which practice best improves reliability when prompting a multimodal model to extract invoice fields?

A. Request unrestricted prose and trust fluent responses

B. Use a structured schema, require evidence, and validate the output programmatically

C. Remove all instructions so the model can reason freely

D. Evaluate only on images selected by the model

Correct Answer: B. Use a structured schema, require evidence, and validate the output programmatically

Question 6

What is a principal benefit of multimodal retrieval-augmented generation?

A. It guarantees that the model cannot hallucinate

B. It supplies external, potentially current evidence at inference time

C. It eliminates the need for image preprocessing

D. It ensures that every retrieved document is legally usable

Correct Answer: B. It supplies external, potentially current evidence at inference time

Question 7

A detector trained entirely on rendered factory images performs poorly on camera images from a real factory. What is the most likely explanation?

A. Synthetic-to-real domain gap

B. Mode collapse in the discriminator

C. Excessive prompt ensembling

D. Perfect calibration

Correct Answer: A. Synthetic-to-real domain gap

Question 8

Which evaluation plan is most appropriate for a high-consequence multimodal inspection system?

A. Measure only image sharpness

B. Use benchmark accuracy alone

C. Assess accuracy, grounding, calibration, rare cases, distribution shift, and abstention behaviour

D. Evaluate only examples that contain common defects

Correct Answer: C. Assess accuracy, grounding, calibration, rare cases, distribution shift, and abstention behaviour

Question 9

Why might parameter-efficient adaptation be selected instead of full fine-tuning?

A. It updates a smaller set of parameters and can reduce storage and computational demands

B. It guarantees immunity to bias

C. It prevents the model from using visual information

D. It removes the need for domain-specific data

Correct Answer: A. It updates a smaller set of parameters and can reduce storage and computational demands

Question 10

Which governance measure is most relevant when a generative vision system uses personal images?

A. Increasing image resolution without consent

B. Documenting provenance, controlling access, addressing privacy, and defining retention policies

C. Disabling all evaluation procedures

D. Treating generated outputs as automatically factual

Correct Answer: B. Documenting provenance, controlling access, addressing privacy, and defining retention policies

Computer Vision and Image Processing
Chapter 12 of 15