What SD 3.5 changes
Stable Diffusion 3 (Esser et al.) changes both halves of the earlier models. The objective is rectified flow, a straight line from image to noise, in place of DDPM's curved noise schedule. The denoiser is a multimodal diffusion transformer (MMDiT): text tokens and image tokens go through the same blocks with separate weights and meet in one joint attention, instead of image tokens reading frozen text through cross-attention. Esser et al. showed that this design kept improving with scale; their largest model has 8 B parameters.
This tab records Stable Diffusion 3.5 Medium, whose transformer alone has 2.2 B parameters in 24 blocks of width 1536 with 24 heads of 64. It draws a beagle in a yard at 256 × 256 pixels with 10 flow-matching steps, guidance 4.5 and seed 0, and shows block 14's joint attention at step 7, where .
Three text encoders and a 16-channel latent
The Text conditioning card shows three encoders reading the prompt. CLIP-L (768 wide) and CLIP-G (1280 wide) give their second-to-last layer at 77 positions each; their states are laid side by side, 2048 numbers per token, and zero-padded to 4096. T5-XXL reads the prompt again into 256 tokens of 4096. Stacked, these are text tokens. The two CLIP models' pooled vectors, numbers, join the timestep in the conditioning vector:
The image side uses a new VAE with 16 latent channels instead of 4, which Esser et al. found reconstructs detail much better, at the price of a harder latent to model; its latents are shifted by 0.0609 and scaled by 1.5305 to about unit variance. Each 2 × 2 patch of the 32 × 32 latent becomes one image token with a fixed 2D sine–cosine position, so the image is 16 × 16 = 256 tokens and every block sees .
The MMDiT block
Each stream has its own adaLN-Zero modulation from , its own Q, K and V projections, its own output projection and its own MLP. Only attention is shared: the two streams' queries, keys and values are concatenated, and one softmax runs over all 589 tokens.
The rows of are then split back by stream. Image tokens read text and each other, as cross-attention and self-attention would; text tokens also read the image, so the text representation changes block by block with the picture. The page draws it left to right: adaLN(x) per stream, Q · K · V from each stream's own weights, Joint attention with one softmax over text and image, the Output per-stream projection, and Where it looks, which splits the selected token's weight between the 256 image tokens and the 333 text tokens.
SD 3.5 Medium is the MMDiT-X variant: blocks 1–13 add a second, image-only self-attention, and the last block drops the text stream's output, since nothing reads it after.
QK-norm
Before the dot product, each head's queries and keys are divided by their root mean square and multiplied by a learned per-dimension scale:
Dehghani et al. found that in very large vision transformers the attention logits can grow until the softmax collapses onto one key and training diverges; normalising and bounds the logits. Esser et al. saw the same instability in large MMDiTs trained in mixed precision and adopted the fix, with RMSNorm.
Rectified flow and the Euler sampler
Training puts a latent on the straight line between the clean latent and noise, and the transformer learns the line's velocity:
Esser et al. compared many ways of choosing during training and found that sampling it from a logit-normal distribution, which favours the middle of the path, worked best. Sampling walks the line back from with Euler steps:
With shift 3 the ten steps fall at , crowded at high noise. Each step runs the prompt and the empty prompt and mixes the velocities, . The Sampling loop shows every step's latent and its , both decoded by the VAE.
Where SD 3.5 came from
Rectified flow (Liu et al.) and flow matching (Lipman et al.) appeared in 2022; Esser et al. scaled rectified flow with the MMDiT in Stable Diffusion 3 (2024), and Stability AI released the 3.5 Large and Medium models later that year. FLUX (the FLUX tab), from Black Forest Labs, keeps the MMDiT's double-stream blocks, adds single-stream blocks and rotary positions, and was distilled to four steps with latent adversarial diffusion distillation, a method first applied to SD 3.
Papers
- Scaling Rectified Flow Transformers for High-Resolution Image Synthesis Stable Diffusion 3: the MMDiT, rectified-flow training with logit-normal timesteps, QK-norm and the 16-channel VAE.
- Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow Rectified flow: learning the velocity of straight paths between noise and data.
- Flow Matching for Generative Modeling Flow matching, the training objective rectified flow is one case of.
- Scalable Diffusion Models with Transformers DiT: latent patches and adaLN-Zero, which each MMDiT stream keeps.
- Scaling Vision Transformers to 22 Billion Parameters Unbounded attention-logit growth in large transformers, and QK normalisation as the cure.
- Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer T5, whose XXL encoder gives 256 of the 333 text tokens.
- Learning Transferable Visual Models From Natural Language Supervision CLIP, the contrastive text–image training behind the CLIP-L and CLIP-G encoders.