← All models

MODEL EXPLORER / GENERATIVE MODELS

Use a Transformer as the diffusion backbone

What changes when a Transformer denoises latent patches?

Curated by TensorVizDiffusion Transformer (DiT) · 4-step tour
Static architecture
What changes when a Transformer denoises latent patches?
Opening the interactive graph…
Architecture snapshot · No Python requiredDownload graph ↓

RECORDED NUMERICAL EXAMPLE

Open the residual gates with conditioning.

Recorded adaLN-Zero initialization and a controlled nonzero parameter intervention. A Transformer maps latent patches back to spatial noise and variance parameters.

At initialization all modulation and final projection weights are zero. The block is exactly identity and both output branches are zero. The first two spatial channels predict epsilon; the last two are raw variance-interpolation parameters, not positive variances. Class and timestep controls hold the latent fixed.

Input latent · channel 0

Min -2.26 · Max 1.57

Recorded cell values
Row / col0123
01.163-0.08965-1.2820.8583
11.5161.1681.57-0.4907
2-1.3180.8684-2.26-0.4815
3-0.7131-1.0840.90340.8996
Attention / FFN shift, scale and gate · six rows

Min 0 · Max 0

Recorded cell values
Row / col01234567
000000000
100000000
200000000
300000000
400000000
500000000
Predicted epsilon · channel 0

Min 0 · Max 0

Recorded cell values
Row / col0123
00000
10000
20000
30000
Raw variance parameter · channel 0

Min 0 · Max 0

Recorded cell values
Row / col0123
00000
10000
20000
30000

Each heatmap uses its own scale. Mint is positive, rust is negative, and the lightest color is zero. Table values are rounded to four significant digits.

Condition embedding
-1.503
-1.26
0.06687
0.2643
0.5072
0.3041
0.1624
0.07721

Bars share one scale within this example. Values are rounded to four significant digits.

Timestep
6
Class ID
1
Maximum block change from input
0
Latent patch tokens
4
Verified by the local recipe
  • Convolutional patch embeddings equal explicit unfold plus linear projection
  • Zero modulation initializes the residual block as identity and the final prediction as zero
  • Unpatchification preserves every patch coordinate and output channel
  • Initial gradients reach the output projection; after a declared nonzero intervention both timestep and class change predictions

Download the source and run.py to reproduce these checks. Choosing an example here replays recorded values.

ABOUT THIS EXAMPLE

Trace latent patches into a class- and time-conditioned Transformer, then inspect adaLN-Zero gates and reconstruct the spatial predictions.

Architecture · 2022

Diffusion Transformer (DiT)

Four 2 × 2 patches from a two-channel latent; one width-eight, two-head block; fixed 2D sinusoidal positions; sinusoidal time embedding plus class embedding; adaLN-Zero and spatial epsilon/variance-parameter heads.

Source, capture & limitations +

Untrained backbone, not DiT-XL/2 or a complete diffusion pipeline. No autoencoder, sampler, classifier-free guidance or variance-learning loss. Last two output channels are raw interpolation parameters, not variances. Nonzero cases deliberately perturb weights to expose conditioning and are not trained checkpoints. Paper preprint 2022, ICCV 2023.

Original TensorViz teaching example. PyTorch provides the underlying operators.

No separate redistribution license has been declared for these project examples.

Content revision
331d96f24b49d20a
Source SHA-256
28f6731c80c062f05c2bbf7266158a764af77382d11ddb24f5b30444b7426c44
Captured
2026-09-17 · Python 3.13.13 / Torch 2.7.1

Reduced class-conditioned DiT backbone. Patch projection, exact zero-initialized identity, spatial unpatchification, gradient-path and conditional-intervention checks. Output packs epsilon and raw variance parameters.

Read the model manifest ↗