TL;DR
A multimodal diffusion transformer, or MM-DiT, processes text tokens and image tokens in one joint sequence. Each modality has its own weights, so the two streams can keep their own representations, but the attention step runs over both streams together. The prompt therefore influences the image in every layer, not just once at the start.
Where you'll see it: in text-to-image models that use the Stable Diffusion 3 design, where it denoises the latent image of a latent diffusion model while reading the prompt through its text stream.
Intuition
Two translators in one meeting
Imagine two translators who speak different languages and work for the same client. A text translator knows the prompt. An image translator knows the picture being drawn. Each keeps their own notes, since the words of a sentence and the patches of a picture are very different kinds of thing.
In an older design, the image side only looked at the text through a single window, called cross-attention. The image asked a question of the text, received an answer, and that was all. The text never learned anything from the image. A multimodal diffusion transformer puts both sets of notes on the same table for each round of discussion. Each side reads the other's current state before updating its own. Over many layers the text representation is refined in light of the partly drawn image, and the image is refined in light of the words.
The paper motivates this directly. Text and image embeddings are conceptually quite different, so it gives them separate weights, but it joins the sequences for the attention operation so that each representation can work in its own space while taking the other into account (Esser et al., 2024, section 4).
Why the image is a sequence of patches
A diffusion transformer does not run on raw pixels. A pretrained autoencoder first compresses the image into a smaller latent grid, and the denoiser works on that grid. This is the Latent Diffusion Model idea: the expensive denoising happens on a compact code, and a decoder turns the final code back into pixels. The latent grid is then cut into small square patches, and each patch becomes one token. A transformer can handle a sequence of tokens, so the image has become a sequence like the text.
flowchart LR P[Prompt] --> T1[Text encoders] T1 --> TS[Text tokens] N[Noisy latent image] --> PA[2 by 2 patches] PA --> IS[Image tokens] TS --> J[Joint attention over both sequences] IS --> J J --> OUT[Predicted velocity for the image]
The math
Let be a clean latent image, a sample of standard Gaussian noise of the same shape, and the text conditioning. The model is trained on noisy latents at a time .
The rectified flow path
Rectified flow uses the simplest possible path from data to noise, a straight line:
At the sample is the clean image, and at it is pure noise. The velocity along this path is constant, . The network is trained to predict that velocity from the noisy latent, the time and the condition:
This is a plain regression, and it needs no simulation of an ODE during training. That is the main practical gain of the flow-matching view, covered in Flow Matching.
A quick check of the path. Take and , so the target velocity is . At , . If the network predicted the target exactly, one Euler step from back to gives , which is .
The time sampler
The paper argues that the choice of timesteps matters. Instead of drawing uniformly, it draws from a logit-normal distribution. Write . The density is
The location biases training towards the data end (negative ) or the noise end (positive ). The scale sets how wide the distribution is. The paper reports that this sampler beats uniform timesteps for rectified flow, and beats the diffusion baselines it compares against, in its own experiments.
Joint attention
Let the image stream have token matrix and the text stream have token matrix . Each stream has its own projection weights, which is the "two sets of weights" idea. For each stream the layer computes its queries, keys and values with its own matrices:
where and . The streams are then joined along the sequence axis for the attention step only:
The semicolon means stacking along the sequence. The output rows are split back into the two streams, and each stream then passes through its own feed-forward block. Every position can attend to every other position, so image tokens can read text tokens and the reverse.
Using a single set of weights for both streams, with the two sequences concatenated, is the vanilla diffusion transformer variant. The paper compares it with MM-DiT and finds it weaker.
Timestep conditioning
The timestep and a pooled summary of the text, , enter through the adaptive normalisation of Diffusion Transformer (DiT). The pooled vector carries only coarse information about the prompt, so the full sequence of text tokens is also needed. The paper uses both: the pooled vector modulates each block, and the token sequence takes part in attention.
Normalising queries and keys
Large transformers can diverge during training, because the attention logits grow until the softmax saturates. The paper applies RMS normalisation with a learnable scale to the queries and keys in both streams. It reports that this prevents the logit growth and the collapse in attention entropy that goes with it, and that it allows stable training in mixed precision.
Worked examples
Take the paper's setup: an autoencoder with downsampling factor and latent channels, followed by patches. The numbers are from the paper's configuration. The text length of 256 tokens is an illustrative choice.
- The latent grid is by with 16 channels.
- Patching by gives a grid of by , so image tokens.
- Each patch holds numbers, which is the input size of one image token before its embedding.
- The joint sequence has tokens.
- One attention head then has a score matrix of entries, about 18.9 million.
Interpretation: almost all of the sequence is image, so the cost of joint attention is dominated by image-to-image attention. Adding the text tokens to the sequence costs little in comparison. This is why the design can fuse modalities without a large overhead.
Take the path from the math section with and , so the target velocity is at every .
- At , .
- Assume the network predicts exactly.
- Start at with , and take a single Euler step of size in time: .
- The result equals .
Interpretation: a straight path with a constant velocity means one step is enough if the velocity is right. In practice the velocity depends on the input and the model's prediction is imperfect, so sampling uses several steps.
Compare the logit-normal density with and , which puts the mass in the middle of the path.
- At : , and . The density is .
- At : . The exponent is , so . Also . The density is .
- The density at the middle is about 1,500 times the density near pure noise.
Interpretation: with the sampler spends most of its training effort on intermediate noise levels, and rarely visits the extremes. Changing moves that effort towards the data or the noise end, and controls how concentrated it is.
Tradeoffs and failure modes
The joint design costs more than cross-attention, and the paper reports that MM-DiT significantly outperforms the cross-attention and vanilla variants on validation loss, CLIP score and FID, and that a three-stream version adds only a small gain. The table summarises the choices.
| Situation | Problem | Better choice |
|---|---|---|
| Simple class-conditional generation | No text stream is needed | A plain Diffusion Transformer (DiT) is enough |
| Text-to-image with rich prompts | A single cross-attention window carries little prompt detail | MM-DiT with separate text and image weights |
| More modalities or more text encoders | Each stream needs its own weights, so parameters and memory grow | Two streams, or a third set only when the gain justifies the cost |
| Limited GPU memory at high resolution | Image tokens dominate the sequence and attention scales with its square | Smaller patches or a latent with fewer tokens, at a cost in detail |
| Training at high resolution in mixed precision | Attention logits can grow and diverge | Normalise queries and keys, and check the loss curve closely |
Failure modes to watch for:
- Sharing one set of weights. In the paper's comparison on CC12M, the vanilla variant with one shared set of weights underperformed MM-DiT, and a third parameter set gave only a small further gain at the cost of more parameters and memory.
- Unstable high-resolution fine-tuning. The paper pretrains at and then finetunes at higher resolutions with mixed aspect ratios. Mixed precision can diverge there, and the paper reports that full precision avoids it at a cost of about a factor of two in performance, The normalisation of queries and keys is the cheaper fix.
- Trusting the pooled text vector alone. The pooled summary keeps only coarse information. Dropping the sequence of text tokens loses fine prompt detail, such as spelling and spatial relations.
- Reading scaling curves as guarantees. The paper shows that validation loss decreases smoothly with model size and correlates with image metrics. The correlation was measured for its own models and data, and should not be assumed for another architecture.
History
Before this design, text-to-image diffusion models fed a fixed text representation into the image network, usually through cross-attention. The latent diffusion work of Rombach and colleagues used this approach. The paper frames it as the widely used baseline, and argues that a fixed text representation fed directly into the model is not ideal (Esser et al., 2024, introduction). Cross-attention variants of the diffusion transformer also existed, which the paper calls CrossDiT.
Esser and colleagues proposed MM-DiT in 2024 as a backbone with learnable streams for both image and text tokens. In their comparison on CC12M, the multimodal design significantly outperformed the vanilla concatenation and cross-attention variants, and a three-stream version gave only a small further gain. They chose two streams for the rest of the work. The same paper paired this backbone with the rectified flow formulation and the logit-normal sampler.
The paper does not discuss later adoption beyond its own experiments, so this lesson makes no claim about its later influence.
Check yourself
QuestionIn MM-DiT, what is shared between the image and text streams, and what is separate?Show answer
The attention operation is shared: the queries, keys and values of both streams are concatenated along the sequence and attend to each other. The projection weights and the feed-forward blocks are separate for each stream, so each modality keeps its own representation.
QuestionWith , and , what is in the rectified flow path, and what velocity should the network predict?Show answer
. The target velocity is .
QuestionWhy does joint attention cost little extra when the text sequence is short, and why does that matter for the design?Show answer
The attention score matrix grows with the square of the total sequence length. With about 4096 image tokens and a few hundred text tokens, the text adds only a small fraction to the total, so most of the cost is image-to-image attention that the model would pay anyway. This makes it cheap to let the text stream take part in every layer.
QuestionYou want the model to put more training effort into high-noise timesteps. Which way should you move the location parameter of the logit-normal sampler, and why?Show answer
Move towards positive values. The paper says positive biases training towards the noise end, near 1, while negative biases it towards the data end, near 0. Adjusting instead would only change how concentrated the samples are, not which end they favour.
Sources
- Esser et al., Scaling Rectified Flow Transformers for High-Resolution Image Synthesis (2024).
- Rombach et al., High-Resolution Image Synthesis with Latent Diffusion Models (2022).