Scalable Diffusion Models with Transformers

The paper replaces the usual convolutional U-Net denoiser in latent diffusion with a Transformer over latent image patches.

Metadata

FieldValue
PaperScalable Diffusion Models with Transformers
AuthorsWilliam Peebles, Saining Xie
Year2022 preprint; 2023 conference
VenueICCV 2023
arXiv2212.09748
ProjectDiT project page
Codefacebookresearch/DiT
Statusfull note

Question

DDPM and Latent Diffusion Models often use convolutional U-Net denoisers. DiT asks:

The paper’s answer:

Main Claim

Diffusion Transformers replace the U-Net backbone with a Transformer operating on latent patches and show predictable scaling with model compute.

The durable architecture claim is:

This is an architecture paper because it changes the denoising network family, not the basic diffusion objective.

Architecture Contract

ItemContract
Inputnoisy latent image
Tokenizationsplit latent into patches
BackboneTransformer blocks
Conditioningtimestep and class conditioning
Outputpredicted noise, velocity, or denoising target over latent patches
Decoderlatent decoder maps denoised latent to image
Main comparisonTransformer denoiser vs U-Net denoiser
Scaling axisdepth, width, patch size, token count, Gflops

Latent Patch Tokenization

DiT operates in latent space. Given:

split it into patches of size :

Each patch is projected into a token:

The Transformer receives:

where is positional information.

Smaller patch size gives more tokens:

Transformer Denoiser

A DiT block is a Transformer block applied to latent patch tokens:

The self-attention part follows the usual form:

The key change from U-Net diffusion is the spatial mixing operator:

BackboneSpatial Mixing
U-Net denoiserconvolution, down/up sampling, skip paths
DiT denoiserglobal self-attention over latent patch tokens

Conditioning

Diffusion denoisers need timestep conditioning. Class-conditional image generation also needs label conditioning.

DiT studies conditioning mechanisms, with adaptive layer normalization as a central route. Abstractly:

where is timestep and is optional class label.

The conditioned normalization can be written:

This lets the conditioning signal modulate the Transformer block without changing the token sequence length.

Output Head

After Transformer blocks, tokens are mapped back to latent patches:

The patches are unpatchified:

The diffusion loss can use the standard noise-prediction form:

Scaling View

DiT evaluates scaling through forward-pass compute:

Compute can increase by:

AxisEffect
depthmore Transformer blocks
widthlarger hidden dimension
patch size smaller gives more tokens
token count attention and MLP cost increase

The important empirical claim is that increasing DiT compute through these axes consistently improves FID in the tested ImageNet setting.

Why It Matters

DiT is important because it moves the architecture conversation from:

to:

This opened the path for Transformer-heavy image/video diffusion backbones where scale, tokenization, and conditioning are first-class design variables.

Evidence

Evidence TypeWhat It Supports
ImageNet class-conditional generationTransformer denoisers can outperform prior diffusion models under large scale
scaling curveshigher Gflops correlate with lower FID in the tested setup
patch-size comparisonstoken count is a meaningful scaling route
conditioning ablationsblock conditioning design matters for diffusion Transformers

Limits

  • DiT is evaluated mainly in class-conditional ImageNet latent diffusion.
  • Transformer attention cost grows with token count.
  • The scaling claim is tied to compute, data, training recipe, and benchmark setting.
  • U-Net backbones still remain strong in many settings, especially when locality and multi-scale skip structure are valuable.

Diffusion interface

DiT changes the denoising backbone while preserving the latent diffusion interface. Let be a clean latent, , and be a noise schedule. A noisy latent can be written:

The denoiser receives , where may be a class label or another condition, and predicts a target such as noise:

The standard training objective is:

The architecture boundary is:

LayerDiT changes?Contract
data/latent encoderusually inherited from latent diffusionimage to continuous latent
forward noising processnoclean latent to noisy latent
denoising backboneyesnoisy latent, timestep, condition to prediction
samplernot fundamentally changedpredicted denoising target to next latent
latent decoderusually inheritedfinal latent to image

This prevents a common attribution error. A lower FID can result from the denoising backbone, latent autoencoder, sampler, guidance, training budget, or data recipe. The DiT paper primarily isolates the backbone and its compute scaling within the stated setup.

From latent grid to token sequence

Let the noisy latent be:

With patch side length , the spatial token count is:

The -th patch has shape and is flattened:

The patch projection is:

After adding positional information:

The patch size is an architectural knob with two coupled effects:

Patch sizeToken countSpatial detailAttention cost
larger lowercoarserlower
smaller higherfinerhigher

This is not identical to changing image resolution. A fixed latent resolution and a changed patch size alter sequence length without changing the input image or diffusion schedule.

DiT block

A simplified Transformer block is:

For diffusion, the block must also receive timestep and condition information. DiT uses adaptive layer normalization variants to modulate the normalized hidden state.

Let the condition embedding be:

where is a timestep embedding and is an optional class embedding. The condition produces scale and shift vectors:

Adaptive normalization is:

The conditioning interface changes the block function from:

to:

This allows all tokens to share the same global condition without appending a separate condition token to the sequence.

adaLN-Zero

A residual block can be initialized so that its residual branch initially contributes almost nothing:

followed by a similarly modulated MLP residual branch.

With initialized near zero, the block starts close to an identity mapping:

The condition-dependent gates are not only a way to inject labels. They also control how strongly each block’s residual transformation is activated for a given timestep and class.

Output head

The final hidden sequence:

is projected back to patch-shaped predictions:

The patches are reassembled:

For a noise-prediction model, . For a model that predicts variance or another parameterization, the output channel contract changes and must be recorded.

The model is structurally symmetric:

Unlike a U-Net, there is no spatial downsampling and upsampling hierarchy inside the vanilla denoiser.

U-Net versus DiT

The comparison should be made at the denoising backbone boundary.

PropertyU-Net denoiserDiT denoiser
primitive spatial operationconvolutionself-attention and MLP
localitybuilt inlearned through attention
multi-scale hierarchyencoder-decoder with skip pathsnot inherent in the vanilla block
token countfeature-map resolution at each stagelatent patch sequence
conditioningfeature injection, cross-attention, normalizationtimestep/class modulation, optionally cross-attention
global interactionindirect or multi-scaledirect among all tokens
scaling analysisstage widths/resolutionsdepth, width, patch size, Gflops

DiT does not claim that convolution is unnecessary for every diffusion problem. It tests whether a standard Transformer can provide a scalable denoising backbone when the latent representation and compute are sufficiently large.

Attention cost

For hidden width and latent patches, global self-attention has approximate score-matrix cost:

The tokenization relation gives:

Halving the patch size increases token count by approximately four and the quadratic attention term by approximately sixteen, ignoring projection and implementation effects.

The MLP component has approximately:

cost. At different token counts, attention and MLP may dominate in different regimes. Reporting only parameter count does not reveal actual denoising cost.

For video or 3D latent grids, token count also grows with time or depth:

The same DiT abstraction can scale poorly if the tokenization contract is not redesigned.

Model variants and compute

DiT variants change depth, width, and patch size. A model name such as DiT-XL/2 encodes both backbone scale and patch size. The slash-two variant has a smaller patch size than a slash-eight variant, and therefore a longer token sequence at the same latent resolution.

The important comparison variables are:

VariableInterpretation
parameter countcapacity of the denoising network
Gflops per forward passapproximate compute per denoising step
token countspatial sequence length
denoising stepsnumber of network evaluations per sample
latent resolutioninformation available to the denoiser
training stepsoptimization budget

If a model has better FID but uses more denoising steps, larger latent resolution, or higher Gflops, the result is not a pure architecture comparison.

Conditioning strategies

The base DiT setting uses class and timestep conditions. The same block can be extended for other conditions.

Global modulation

Encode a condition and modulate each block:

This is compact and keeps sequence length unchanged.

Condition tokens

Append condition tokens:

This lets attention learn interactions between condition and spatial tokens, but increases sequence length.

Cross-attention

Use a condition sequence :

This is useful for text or structured conditioning but introduces additional memory and interface complexity.

The conditioning choice should be classified separately from the denoiser backbone. A Transformer with cross-attention and one with adaptive normalization may share the same spatial backbone while differing in condition injection.

Scaling claim

The paper studies the relationship between model compute and generation quality:

Within the reported class-conditional ImageNet setting, larger DiT models and higher compute correlate with improved FID. The paper reports FID 2.27 for DiT-XL/2 on the 256x256 benchmark in the cited setup.

That number is evidence for a benchmark result, not a universal law:

To interpret the claim, compare the same latent autoencoder, training data, diffusion objective, sampler, guidance, and evaluation protocol. Report matched Gflops and either matched optimization budget or an explicit compute budget.

Why DiT belongs in both architecture and generative shelves

The strongest claim is about the architecture:

The evidence is generated through a diffusion objective and sampling process. Therefore the canonical note belongs in Architecture Papers, while the generative-model shelf should link to it rather than duplicate it.

Paper claimCanonical shelf
replacing the denoising backboneArchitecture Papers
changing noise, score, or velocity objectiveGenerative Model Papers
improving sampler steps or ODE integrationGenerative Model Papers
applying DiT to molecules or proteinsComputational Biology plus Generative Models if generation is central
reducing attention memory or kernel trafficSystems or Architecture depending on strongest claim

Evidence and ablations

Useful DiT ablations separate backbone, conditioning, tokenization, and compute:

AblationQuestion
U-Net versus Transformeris the gain from denoiser family?
patch sizehow does token count affect quality and cost?
depth and widthdoes more compute improve the same architecture family?
adaLN varianthow does conditioning injection affect optimization?
latent versus pixel inputhow much comes from the representation interface?
sampler and stepsis the quality gain independent of inference budget?
same Gflops, different parametersis parameter count or actual compute the better predictor?
same model, different data scaledoes the weak inductive bias need more data?

An ablation that changes multiple columns at once cannot establish an architecture claim. Scaling plots are most useful when read with the training and compute contract attached.

Failure modes

Token explosion

At high resolution or small patch size:

This can make a small patch-size change dominate GPU memory and wall-clock time.

Weak locality

A vanilla Transformer does not guarantee that nearby latent patches interact first. It may learn local structure from data, but optimization and data requirements can differ from a convolutional model.

Latent bottleneck

If the latent autoencoder discards information, a larger DiT cannot recover it:

The autoencoder and denoiser should be evaluated as separate architectural components.

Conditioning leakage

If class or text information is exposed through an unintended path, conditional generation can look better without demonstrating stronger denoising structure.

Compute confounding

FID can improve because of longer training, larger batch size, more sampler steps, or more total FLOPs. Report all of these before assigning credit to the Transformer backbone.

Relation to nearby papers

PaperMain relation
[[papers/architectures/ddpmDDPM]]
[[papers/architectures/latent-diffusion-modelsLatent Diffusion Models]]
[[papers/architectures/vision-transformerVision Transformer]]
[[papers/architectures/taming-transformersTaming Transformers]]
[[papers/architectures/neural-discrete-representation-learningVQ-VAE]]
[[papers/architectures/attention-is-all-you-needAttention Is All You Need]]

Computational biology transfer

For a molecular or protein diffusion model, the DiT abstraction can be reused only after defining the tokenization and symmetry contract. A 3D structure may be represented as atom or residue tokens, graph nodes with edge attributes, continuous coordinate fields, or a latent grid learned by an autoencoder.

The vanilla image DiT does not automatically preserve geometric symmetries. For coordinates , a model may need:

for equivariant outputs, or:

for invariant scalar outputs. A molecular DiT must therefore be routed through Equivariant GNN or the relevant geometry contract when the task requires it.

This is an example of reusing the Transformer denoiser pattern without copying the image inductive bias unchanged.

Reproduction checklist

  • Specify the latent autoencoder, latent resolution, and channel dimension.
  • Record patch size, token count, hidden width, depth, and MLP expansion.
  • State timestep embedding and class/condition injection mechanism.
  • Report adaLN or adaLN-Zero details, including initialization.
  • Define diffusion target: noise, velocity, , or another parameterization.
  • Match sampler, number of denoising steps, guidance, and evaluation seed policy.
  • Compare U-Net and DiT under matched data, latent, training, and compute contracts.
  • Report parameters, Gflops, attention memory, wall-clock time, and denoising steps.
  • Track quality as a function of compute rather than reporting one model point only.
  • For biological data, document tokenization, coordinate frame, symmetry, and geometry-preserving augmentations.

Takeaway

DiT makes the denoising backbone a replaceable architecture:

Its durable lesson is not simply that Transformers can generate images. It is that a generative objective can be paired with a general architecture family, then analyzed through tokenization, conditioning, compute, and scaling. The correct comparison is the complete denoising contract, not a bare claim that Transformer beats U-Net.

Concepts