Blogs博客›REPA
May 19, 20262026 年 5 月 19 日

REPA: Training DiT Faster by Aligning One LayerREPA:对齐一层,让 DiT 训得更快

REPA adds one term to DiT training: the patch features of one layer, passed through a small MLP, should match the patch features a frozen DINOv2 gives for the same image. The term exists only during training. With it, SiT-XL/2 reaches the same FID in over 17.5 times fewer steps.

REPA 给 DiT 的训练加了一项:某一层的 patch 特征经过一个小 MLP 后,要接近冻结的 DINOv2 在同一张图上给出的 patch 特征。这一项只在训练时存在。加上它,SiT-XL/2 达到同样的 FID,训练步数少了 17.5 倍以上。

The problem问题

DiT is slow to converge. The authors compared what its layers represent with what DINOv2 represents[1]. A linear probe on DiT's layers stays far below DINOv2 even at the best layer, and the two representations are only weakly aligned. Their reading: learning a good semantic representation is the bottleneck of DiT training, and the model has to learn it from the denoising loss alone.

DiT 收敛慢。作者比较了 DiT 各层和 DINOv2 的表征[1]:在 DiT 各层上做 linear probing,最好的一层也远低于 DINOv2;两者的表征对齐程度也很弱。作者的判断是,学出好的语义表征是 DiT 训练的瓶颈,而模型只能从去噪的 loss 里慢慢学。

REPA supplies that representation from outside: it asks one DiT layer to resemble DINOv2 directly.

REPA 从外面把这种表征给它:直接要求 DiT 的某一层像 DINOv2。

Method做法

xVAEzₜDiT第 8 层layer 8velocityMLPDINOv2(冻结)DINOv2 (frozen)投影后的特征projected逐个 patch 算cosine similarity,cosine similaritypatch by patchDINOv2 特征DINOv2 features

Training runs two branches on the same image $x$.

训练时,同一张图 $x$ 走两条支路。

The diffusion branch is unchanged. The VAE encoder maps $x$ to a latent $z=E(x)$, noise gives $z_t$, and DiT predicts the velocity, trained with the usual loss $\mathcal{L}_{\text{velocity}}$.

diffusion 支路不变:VAE encoder 把 $x$ 变成 latent $z=E(x)$,加噪得到 $z_t$,DiT 预测 velocity,用原来的 loss $\mathcal{L}_{\text{velocity}}$ 训练。

The alignment branch takes the hidden state $h_t$ of one DiT layer while it processes $z_t$. A trainable MLP $h_\phi$ maps it to the width of DINOv2, and the result is pulled toward $y^*=f(x)$, the features a frozen DINOv2 gives for the clean image, by cosine similarity. The two losses are added:

对齐支路取 DiT 处理 $z_t$ 时某一层的 hidden state $h_t$,经可训练的 MLP $h_\phi$ 映射到 DINOv2 的维度,再用 cosine similarity 拉向 $y^*=f(x)$,即冻结的 DINOv2 在干净原图上的特征。两项 loss 相加:

$$\mathcal{L} = \mathcal{L}_{\text{velocity}} + \lambda\,\mathcal{L}_{\text{REPA}}, \qquad \lambda = 0.5$$

The paper tried $\lambda$ from 0.25 to 1.0 on SiT-XL/2 at 400K iterations. FID barely changes from 0.5 upward; 0.25 is slightly worse.

论文在 SiT-XL/2 上训练 400K 步,试了 $\lambda$ 从 0.25 到 1.0:0.5 及以上 FID 基本不再变化,0.25 略差。

FID for each weight of the REPA lossREPA loss 取不同权重时的 FID
SiT-XL/2 + REPAFID05100.250.50.751.0λ8.67.97.87.8
Each bar is one value of λ, the weight of the REPA loss.每根柱是 REPA loss 的一个权重 λ。Source: SiT-XL/2, 400K iterations, ImageNet 256, no CFG. Paper Table 5出处:SiT-XL/2,400K 步,ImageNet 256,无 CFG。论文表 5

At inference only DiT runs. The MLP and DINOv2 are dropped, so sampling costs the same as before.

推理时只跑 DiT,MLP 和 DINOv2 都不用,采样成本不变。

Without classifier-free guidance, SiT-XL/2 with REPA reaches FID 7.9 at 400K iterations, below the 8.3 that the original SiT-XL/2 reaches at 7M. That ratio of steps is the 17.5 times in the opening paragraph. With longer training REPA goes on to 6.4 at 1M and 5.9 at 4M.

不用 classifier-free guidance 时,加了 REPA 的 SiT-XL/2 训练 400K 步 FID 到 7.9,低于原版 SiT-XL/2 训练 7M 步的 8.3;导语里的 17.5 倍就是这两个步数之比。继续训练,REPA 在 1M 步到 6.4,4M 步到 5.9。

FID against training iterations, with and without REPA加与不加 REPA 时 FID 随训练步数的变化
SiT-XL/2 + REPAVanilla SiT-XL/2原版 SiT-XL/2Vanilla SiT-XL/2 at 7M原版 SiT-XL/2 训练 7M 步FID510205050K100K400K1M4M7MTraining iterations训练步数
Both axes are logarithmic. The paper reports the original SiT-XL/2 only at 400K and 7M; the dashed line marks its FID at 7M.两轴均为对数坐标。论文只给了原版 SiT-XL/2 在 400K 和 7M 步的结果;虚线是它 7M 步的 FID。Source: SiT-XL/2, ImageNet 256, no CFG. Paper Table 3 and Table 8出处:SiT-XL/2,ImageNet 256,无 CFG。论文表 3、表 8

Which layer对齐哪一层

REPA puts the loss on a single early layer: on SiT-XL/2, the output of layer 8. In the paper's ablation on SiT-L/2, which tried layers 6 to 16, layers 6 and 8 gave the best FID and later layers did worse.

REPA 只在一层上加这项 loss,而且是靠前的一层:SiT-XL/2 上取第 8 层的输出。论文在 SiT-L/2 上试了第 6 到第 16 层,第 6、8 层的 FID 最好,越往后越差。

FID when aligning different layers对齐不同层时的 FID
REPAVanilla SiT-L/2原版 SiT-L/2FID051015206810121416Aligned layer对齐的层10.310.010.511.211.612.1
Each bar puts the REPA loss on one layer of SiT-L/2; the dashed line is SiT-L/2 trained without it.每根柱把 REPA loss 加在 SiT-L/2 的某一层上;虚线是不加这项 loss 的 SiT-L/2。Source: SiT-L/2, 400K iterations, ImageNet 256, DINOv2-L target, NT-Xent objective, no CFG. Paper Table 2出处:SiT-L/2,400K 步,ImageNet 256,目标 DINOv2-L,目标函数 NT-Xent,无 CFG。论文表 2

The layers of DiT divide the work. Early layers build the image's structure and semantics; late layers turn them into the velocity. Aligning an early layer hands the semantic part to DINOv2's guidance and leaves the late layers to denoise.

DiT 的层有分工:前面的层建立图像的结构和语义,后面的层把它们变成 velocity。对齐前面的层,等于让 DINOv2 带着学语义,后面的层专心去噪。

Patch by patch按 patch 对齐

The alignment is per patch, not per image. The hidden state is $h_t\in\mathbb{R}^{N\times D}$ for $N$ patches of width $D$; DINOv2 gives $y^*\in\mathbb{R}^{N\times D'}$ for the same patches. After the MLP, each patch is compared with its own DINOv2 feature:

对齐按 patch 做,不按整张图做。hidden state 是 $h_t\in\mathbb{R}^{N\times D}$,$N$ 个 patch,每个 $D$ 维;DINOv2 对同样的 patch 给出 $y^*\in\mathbb{R}^{N\times D'}$。经过 MLP 后,每个 patch 和它自己的 DINOv2 特征比:

$$\mathcal{L}_{\text{REPA}} = -\frac{1}{N}\sum_{n=1}^{N} \operatorname{sim}\big(y^*_{n},\ h_\phi(h_t)_{n}\big)$$

A single global embedding would tell the model what the image shows, a dog or a car, but not how its regions are arranged. Generation needs the arrangement, and per-patch targets carry it.

只对齐一个全局 embedding,模型知道图里是狗还是车,却不知道各个区域怎么摆。生成需要的是摆法,按 patch 的目标正好带着这个信息。

References参考文献

  1. Sihyun Yu, Sangkyung Kwak, Huiwon Jang, Jongheon Jeong, Jonathan Huang, Jinwoo Shin, and Saining Xie. Representation Alignment for Generation: Training Diffusion Transformers Is Easier Than You Think. ICLR, 2025. arXiv:2410.06940