Chapter 013 · Artificial Intelligence

Beyond Text: Multimodality, Image Generation And Diffusion

How models connect language and vision, and how diffusion turns noise into images through iterative, conditioned denoising.

Published
Reading time
11 min read

A text model receives discrete token IDs and predicts more token IDs. An image is different: it is a grid of continuous-valued pixels with strong local structure, enormous dimensionality, and many valid descriptions. The sentence “a red bicycle beside a stone wall” does not determine the bicycle's exact shape, the camera angle, the lighting, or millions of pixel values. Image generation must represent both the semantic constraint and all that unresolved detail.

Modern multimodal systems address this problem in two related but distinct ways. Representation models learn which images and texts belong together. Generative models learn how to construct a sample from a distribution, possibly under textual guidance. Diffusion models became a particularly effective generative approach by turning synthesis into a sequence of denoising decisions.

The result can feel like a model is painting. That is a useful interface metaphor, not a mechanical description. A diffusion sampler normally begins with random noise and repeatedly updates an array of numbers. It does not retrieve a complete hidden picture and gradually uncover it. The image emerges because a neural network has learned statistical directions that make noisy states more like examples from its training distribution.

Origins

Computer vision and natural-language processing developed for decades as partly separate fields. Vision systems learned features from pixels; language systems learned patterns from words or tokens. Connecting them required a training signal that could express relationships between modalities without assigning every image to one fixed class.

Captions provide such a signal. An image and its description are not identical representations, but they refer to related content. If an image encoder and a text encoder map matching pairs near one another in a shared space, language can become an interface to visual concepts.

CLIP, released in 2021, scaled this contrastive idea using 400 million image-text pairs collected from the internet. During training, the system received a batch of images and texts and learned to identify the correct pairings. The paper demonstrated zero-shot transfer by converting class names into text prompts and comparing their embeddings with an image embedding. This was an important result, but not proof of general visual understanding: performance varied across tasks and inherited the limitations of the data and prompts.

Representation learning does not itself generate pixels. A similarity model can tell us that a caption and an image belong together without knowing how to sample a new image. Generative modeling needs another objective.

Earlier image generators included autoregressive models, which represented an image as a sequence of pixels or discrete visual tokens, and generative adversarial networks, which trained a generator against a discriminator. Both remain important. The rise of diffusion did not make them conceptually obsolete; it offered a different balance of training stability, likelihood-related objectives, sample quality, and generation cost.

Historical evolution

Diffusion probabilistic models trace their modern lineage to work that connected gradual corruption with learned reversal. The forward process destroys structure by adding small amounts of noise over many steps. A learned reverse process attempts to undo those transitions.

In 2020, Ho, Jain, and Abbeel showed that denoising diffusion probabilistic models could produce high-quality image samples using an objective connected to denoising score matching. Their results helped establish a practical recipe: choose a known Gaussian noising process, train a neural network to predict noise or a related quantity, and sample by iteratively reversing the process.

Text conditioning then turned an unconditional image distribution into a controllable generator. Systems could provide a text representation to the denoising network at each step. Classifier guidance and classifier-free guidance offered ways to strengthen conditioning, usually trading some diversity for closer adherence or sharper samples.

The 2022 DALL-E 2 paper combined CLIP representations with diffusion. Its two-stage design generated a CLIP image embedding from text, then used a diffusion decoder to construct an image conditioned on that embedding. The architecture illustrates that “text-to-image” can contain multiple learned spaces and models rather than one monolithic network.

Pixel-space diffusion is expensive because the network repeatedly processes large spatial arrays. Latent diffusion addressed that cost by first training an autoencoder to compress images into a smaller spatial representation. Diffusion then operated in this latent space, and a decoder mapped the final latent back to pixels. Rombach and colleagues also used cross-attention to inject conditioning such as text. This did not eliminate computation or information loss, but it made high-resolution synthesis substantially more practical.

These stages were not an inevitable march toward one final architecture. Contrastive encoders, autoencoders, transformers, convolutional U-Nets, autoregressive decoders, and diffusion processes continue to be combined in different ways. The useful historical pattern is modularity: learn representations, choose a generative process, and connect control signals to that process.

Technical explanation

Aligning images and text

Let an image encoder produce a vector viv_i for image ii, and a text encoder produce tjt_j for caption jj. After normalization, their dot product acts like cosine similarity. For a batch of NN matched pairs, a simplified image-to-text loss is:

Li→t=−1N∑i=1Nlog⁡exp⁡(vi⊤ti/τ)∑j=1Nexp⁡(vi⊤tj/τ)\mathcal{L}_{i\rightarrow t}=-\frac{1}{N}\sum_{i=1}^{N}\log\frac{\exp(v_i^{\top}t_i/\tau)}{\sum_{j=1}^{N}\exp(v_i^{\top}t_j/\tau)}

The temperature τ\tau controls how sharp the comparison is. A symmetric objective also asks each text to select its matching image. The other examples in the batch serve as negatives.

This objective does not require a universal list of categories. Natural language supplies flexible descriptions. Yet the embedding compresses information: two images can be close because they share semantics while differing in exact geometry, count, text, or style. A contrastive representation is therefore a useful condition or retrieval key, not a reversible encoding of every pixel.

The forward diffusion process

Suppose x0x_0 is a training image or image latent. The forward process produces progressively noisier variables x1,x2,…,xTx_1, x_2, \ldots, x_T. One common transition is:

q(xt∣xt−1)=N(1−βt xt−1,βtI)q(x_t\mid x_{t-1})=\mathcal{N}\left(\sqrt{1-\beta_t}\,x_{t-1},\beta_t I\right)

The schedule βt\beta_t specifies how much noise is added at step tt. Multiplying these transitions yields a convenient closed form:

xt=αˉt x0+1−αˉt ϵx_t=\sqrt{\bar{\alpha}_t}\,x_0+\sqrt{1-\bar{\alpha}_t}\,\epsilon

Here αt=1−βt\alpha_t=1-\beta_t, αˉt\bar{\alpha}_t is the product of the first tt alpha values, and ϵ\epsilon is standard Gaussian noise. This formula lets training sample any timestep directly instead of simulating every preceding step.

At small tt, much of the original structure remains. At large tt, the sample approaches noise. The forward process is fixed; it is not learned and is not the physical diffusion of paint or heat. The term describes a mathematical analogy involving gradual randomization.

Learning to reverse noise

A neural network receives xtx_t, the timestep tt, and optional conditioning cc. In the common noise-prediction parameterization, it estimates the noise used to create the sample. A simplified training loss is:

L=Ex0,t,ϵ[∥ϵ−ϵθ(xt,t,c)∥22]\mathcal{L}=\mathbb{E}_{x_0,t,\epsilon}\left[\left\|\epsilon-\epsilon_{\theta}(x_t,t,c)\right\|_2^2\right]

The network is often a U-Net or a related architecture that processes information at multiple spatial scales. The timestep embedding tells it how corrupted the current input is. If text is the condition, cross-attention can let spatial features query text-token representations.

Predicting noise is equivalent to providing information about how to move toward regions of higher data probability under specific formulations. During sampling, the model starts with xTx_T drawn from a Gaussian and applies a scheduler's reverse updates. Each update uses the network's estimate but may also inject controlled randomness.

The sampler matters. DDPM sampling, DDIM, and newer numerical solvers can use different update rules and step counts with the same or related trained models. Fewer steps reduce latency but may alter detail, stability, or prompt adherence. The neural network and the sampling algorithm are separate pieces of the system.

Conditioning and classifier-free guidance

To teach conditional and unconditional behavior in one model, training can sometimes replace the condition with an empty one. At sampling time, the model evaluates both versions. A typical guided noise estimate is:

ϵ^=ϵθ(xt,t,∅)+s[ϵθ(xt,t,c)−ϵθ(xt,t,∅)]\hat{\epsilon}=\epsilon_{\theta}(x_t,t,\varnothing)+s\left[\epsilon_{\theta}(x_t,t,c)-\epsilon_{\theta}(x_t,t,\varnothing)\right]

The guidance scale ss amplifies the difference caused by the condition. Higher values often make a prompt more visually apparent, but excessive guidance can reduce diversity, oversaturate images, or create artifacts. It is not a direct “quality” dial.

Negative prompts in some systems alter the baseline condition used in guidance. They do not impose a logical prohibition. If a concept is entangled with the requested scene, asking the model to avoid it can have unpredictable effects.

Why latent diffusion is cheaper

An autoencoder consists of an encoder EE and decoder DD. The encoder maps an image to a latent z=E(x)z=E(x); the decoder reconstructs approximately D(z)≈xD(z)\approx x. If the latent has fewer spatial values than the image, every denoising step processes a smaller tensor.

The savings can be large because the denoiser runs many times. The trade-off is that the autoencoder defines what details survive compression. Tiny text, exact line work, and high-frequency textures may be difficult even before the diffusion model makes its own errors.

Latent diffusion is not the same as reducing an image to a single semantic vector. Its latent normally preserves spatial organization. That distinction lets the model reconstruct layouts and local detail while working below pixel resolution.

Generation is probabilistic search through a learned distribution

A seed initializes pseudorandom noise. With fixed software, hardware, parameters, sampler, and inputs, the same seed may reproduce an output; across different implementations, exact reproduction is not guaranteed.

The prompt constrains the trajectory but does not specify one correct image. The model balances textual signals with patterns learned from training. It can produce plausible details never stated by the user and can fail at relationships that a sentence makes explicit, such as exact counts or which object is to the left of another.

This is why image generation is neither database lookup nor conventional rendering. A renderer follows an explicit scene model. A diffusion generator infers a plausible scene representation from statistical regularities and then realizes it through iterative denoising.

Practical applications

Text-to-image generation is useful when the desired output is underdetermined: concept art, mood boards, ad variations, storyboards, texture ideas, or rapid exploration of a visual direction. A designer can generate candidates, select useful compositions, and continue with conventional tools.

Image-to-image workflows begin from a noised version of an existing latent. Lower corruption tends to preserve more structure; higher corruption permits larger changes. Inpainting applies the reverse process selectively to a masked region while using the surrounding image as context. Outpainting extends the canvas and synthesizes plausible new surroundings.

Multimodal representation models support different applications. An embedding index can retrieve images with natural-language queries. A moderation or cataloging pipeline can compare visual content with candidate descriptions. A vision-language model can convert image features into tokens or states that a language model uses to answer questions.

Production systems need more than a model endpoint. They should record model and sampler versions, prompts, seeds, dimensions, guidance settings, and post-processing. They also need safety checks, provenance policies, latency budgets, and human review appropriate to the use case.

Evaluation should match the product. Similarity metrics can estimate correspondence between text and image, while distributional metrics such as FID compare generated and reference feature statistics. Neither guarantees correct anatomy, readable text, fairness, originality, or usefulness. Human evaluation is also sensitive to presentation and reviewer expectations.

For a developer, the most robust mental model is a pipeline:

prompt -> text representation -> conditioned denoising -> latent -> decoder -> pixels

Individual systems may omit, merge, or replace stages, but the decomposition helps diagnose failures. A misunderstood prompt differs from a weak denoising trajectory; both differ from detail lost by the autoencoder.

Limitations and misconceptions

Diffusion does not prove that a model understands a scene as a human does. It can reproduce strong visual correlations while failing on counting, physical causality, typography, uncommon viewpoints, or relationships rarely expressed in its data.

Generated images are not guaranteed to be novel. Models can memorize or closely imitate training examples, especially under duplication or narrow data. Determining whether a particular output infringes rights is a legal and factual question, not something the architecture answers.

Dataset provenance remains central. Image-caption pairs collected at internet scale contain inaccurate descriptions, stereotypes, copyrighted material, personal data, and uneven geographic coverage. Filtering changes the distribution but does not make it neutral.

The denoising metaphor can also mislead. The model is not cleaning a photograph that existed inside the initial noise. At every step it uses learned estimates to transform a random state. Different seeds can lead to substantially different valid outputs from the same prompt.

Multimodal does not mean all modalities share one perfectly unified internal language. Some systems align separate encoders; others translate one modality into tokens consumed by another model; still others train joint architectures. Capabilities must be established empirically for each design.

Finally, image generators can make evidence-looking artifacts without evidential value. Photorealism is not provenance. Applications that could confuse generated media with records need explicit labeling, metadata, access controls, and verification outside the generator.

What comes next

Multimodal models extend the interface beyond text, but the knowledge available at generation time is still largely encoded in parameters and the current context. That becomes a problem when information changes, belongs to a private database, or must be verified against a source.

Retrieval-augmented generation adds an external search step. Tool use lets a model request calculations, APIs, files, or actions. Agentic systems place these capabilities inside a loop that chooses steps, observes results, and decides what to do next.

This transition changes the engineering problem. A model is no longer only predicting an output; it participates in a stateful system with permissions, failure recovery, and side effects. The next chapter will separate these components and show why orchestration, evidence, and control matter as much as the model.

Further reading

  • Radford et al., "Learning Transferable Visual Models From Natural Language Supervision" (2021). Contrastive image-text representation learning: https://arxiv.org/abs/2103.00020

  • Ho, Jain, and Abbeel, "Denoising Diffusion Probabilistic Models" (2020). The practical DDPM formulation and noise-prediction objective: https://arxiv.org/abs/2006.11239

  • Ramesh et al., "Hierarchical Text-Conditional Image Generation with CLIP Latents" (2022). A two-stage text-to-image system using CLIP representations and diffusion: https://arxiv.org/abs/2204.06125

  • Rombach et al., "High-Resolution Image Synthesis with Latent Diffusion Models" (2022). Diffusion in compressed latent space with cross-attention conditioning: https://arxiv.org/abs/2112.10752

Next chapter

Proposed next chapter

RAG, Tools And Agents: How Models Reach Beyond Their Parameters

A language model can generate fluent answers, but its parameters are an awkward place to store changing documentation, private records, or exact calculations. The next chapter will follow a request through retrieval-augmented generation: chunking documents, creating embeddings, retrieving candidates, reranking evidence, and placing selected context into a prompt. It will then distinguish retrieval from tool calling and agents, where a model chooses operations, observes their results, and continues inside a controlled loop. We will examine permissions, schemas, retries, idempotency, prompt injection, and evaluation. This connects directly to multimodality: once models can consume varied representations, the next challenge is giving them timely external evidence and safe ways to act on it.

  1. How does RAG differ from adding knowledge through training or a longer prompt?
  2. What turns a model-generated tool call into a reliable application action?
  3. When is an agent loop useful, and when is a deterministic workflow safer?

Would you like to continue with this topic, or would you prefer a different direction?

  • Multimodality
  • Computer Vision
  • Image Generation
  • Diffusion Models
  • CLIP