Stable Diffusion uses a variant of diffusion model called latent diffusion model. Diffusion models are trained with the objective of removing successive applications of Gaussian noise on training images which can be thought of as a sequence of denoising autoencoders. Stable Diffusion consists of 3 parts: 

1.	A variational autoencoder, an image to latent space compressor. 
2.	U-Net, a denoising algorithm.
3.	A clip model, a pretrained CLIP text encoder.

A prompt is taken by the clip model and tokenizes by transforming text prompts to an embedding space. This is passed to the U-net. The U-Net block, composed of a ResNet backbone, along with the text embedding, takes in gaussian noise that has been transformed into the latent space by the variational autoencoder (VAE). The U- net then over several iterations denoises the output from forward diffusion backwards to obtain latent representation of the image. Finally, the VAE decoder generates the final image by converting the representation back into pixel space.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence