Latent diffusion model
The latent diffusion model (LDM) is a diffusion model architecture developed by the CompVis (Computer Vision & Learning) group at LMU Munich.[src] Introduced in 2015, diffusion models (DMs) are trained with the objective of removing successive applications of noise (commonly Gaussian) on training images.[src] The LDM is an improvement on standard DM by performing diffusion modeling in a latent space, and by allowing self-attention and cross-attention conditioning.[src] LDMs are widely used in practical diffusion models.[src] For instance, Stable Diffusion versions 1.1 to 2.1 were based on the LDM architecture.[src]
The latent diffusion model (LDM) is a diffusion model architecture developed by the CompVis (Computer Vision & Learning) group at LMU Munich.[src] Introduced in 2015, diffusion models (DMs) are trained with the objective of removing successive applications of noise (commonly Gaussian) on training images.[src] The LDM is an improvement on standard DM by performing diffusion modeling in a latent space, and by allowing self-attention and cross-attention conditioning.[src] LDMs are widely used in practical diffusion models.[src] For instance, Stable Diffusion versions 1.1 to 2.1 were based on the LDM architecture.[src] A latent image array, produced by the VAE encoder.[src] It has dimensions (\text{channel}, \text{width}, \text{height}) .[src] Typically, (\text{channel}, \text{width}, \text{height}) = (4, 64, 64) .[src] A timestep-embedding vector, which tells the backbone how much noise there is in the image.[src] For example, an embedding of timestep t = 0 would indicate that the input image is already noiseless, while t = 100 would mean there is much noise.[src] A modality-embedding vector sequence, which indicates to the backbone about additional conditions for denoising.[src] For example, in text-to-image generation, the text is divided into a sequence of tokens, then encoded by a text encoder, such as a CLIP encoder, before feeding into the backbone.[src] As another example, an input image can be processed by a Vision Transformer into a sequence of vectors, which can then be used to condition the backbone for tasks such as generating an image in the same style.[src] Each run through the U-Net backbone produces a predicted noise vector.[src] This noise vector is scaled down and subtracted away from the latent image array, resulting in a slightly less noisy latent image.[src] The denoising is repeated according to a denoising schedule ("noise schedule"), and the output of the last step is processed by the VAE decoder into a finished image.[src] Similar to the standard U-Net, the U-Net backbone used in the SD 1.5 is essentially composed of down-scaling layers followed by up-scaling layers.[src] However, the U-Net backbone has additional modules to allow for it to handle the embedding.[src] As an illustration, we describe a single down-scaling layer in the backbone: The latent array and the time-embedding are processed by a ResBlock : The latent array is processed by a convolutional layer.[src] The time-embedding vector is processed by a one-layered feedforward network, then added to the previous array (broadcast over all pixels).[src] This is processed by another convolutional layer, then another time-embedding.[src] The latent array and the embedding vector sequence are processed by a SpatialTransformer , which is essentially a standard pre-LN Transformer decoder without causal masking.[src] In the cross-attentional blocks, the latent array itself serves as the query sequence, one query-vector per pixel.[src] For example, if, at this layer in the U-Net, the latent array has dimensions (128, 32, 32) , then the query sequence has 1024 vectors, each of which has 128 dimensions.[src] The embedding vector sequence serves as both the key sequence and as the value sequence.[src] When no embedding vector sequence is input, a cross-attentional block defaults to self-attention, with the latent array serving as the query, key, and value.[src] In pseudocode, def ResBlock(x, time, residual_channels): x_in = x time_embedding = feedforward_network(time) x = concatenate(x, residual_channels) x = conv_layer_1(activate(normalize_1(x))) + time_embedding x = conv_layer_2(dropout(activate(normalize_2(x)))) return x_in + x def SpatialTransformer(x, cond): x_in = x x = normalize(x) x = proj_in(x) x = cross_attention(x, cond) x = proj_out(x) return x_in + x def unet(x, time, cond): residual_channels = [] for resblock, spatialtransformer in downscaling_layers: x = resblock(x, time) residual_channels.append(x) x = spatialtransformer(x, cond) x = middle_layer.resblock_1(x, time) x = middle_layer.spatialtransformer(x, time) x = middle_layer.resblock_2(x, time) for resblock, spatialtransformer in upscaling_layers: residual = residual_channels.pop() x = resblock(concatenate(x, residual), time) x = spatialtransformer(x, cond) return x The detailed architecture may be found in.[src]
32 sentences · 32 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Latent diffusion model." encyclopegia.org, 2026, https://encyclopegia.org/wiki/latent-diffusion-model. Accessed 28 November 2026.
Chicago
"Latent diffusion model." encyclopegia.org. Accessed November 28, 2026. https://encyclopegia.org/wiki/latent-diffusion-model.
APA
encyclopegia.org. (2026). Latent diffusion model. Retrieved November 28, 2026, from https://encyclopegia.org/wiki/latent-diffusion-model
Accessed November 28, 2026 · CC BY-SA 4.0 · citation page · JSON