# Scalable Diffusion Models with Transformers

Transformer를 활용한 확장 가능한 Diffusion 모델

William Peebles, Saining Xie · arXiv · 2022년 12월 19일

- **연구 문제** 확산 모델의 역방향 과정을 계산하는 네트워크는 지금까지 합성곱 기반 U-Net이 사실상 표준이었습니다. 이 논문은 그 귀납 편향이 성능에 꼭 필요한지, 그리고 트랜스포머로 바꿔도 성능을 유지할 수 있는지를 묻습니다.
- **연구 방법** DiT는 확산 모델의 잡음 예측 백본으로 트랜스포머를 사용합니다. 잠재 표현을 패치 토큰으로 나누어 표준 트랜스포머 블록에 넣고, 조건 정보는 adaLN-Zero 방식으로 주입합니다. 모델 크기는 Gﬂops로 비교합니다.
- **주요 결과** DiT-XL/2는 클래스 조건부 ImageNet 256×256에서 cfg=1.50일 때 FID-50K 2.27을 보고합니다. 512×512에서는 FID 3.04를 보고합니다. Gﬂops와 FID-50K 사이에는 강한 음의 상관관계가 있으며 상관계수는 -0.93입니다.

## U-Net 백본을 트랜스포머로 바꾸는 문제

확산 모델은 데이터에 잡음을 점차 섞는 순방향 과정과, 이를 거꾸로 되돌리는 역방향 과정을 학습하는 생성 모델입니다. 이 역방향 과정을 계산하는 네트워크로는 지금까지 합성곱 기반 U-Net이 사실상 표준으로 쓰였습니다. 트랜스포머가 자연어 처리와 시각 인식에서 기본 구조로 자리 잡은 것과 달리, 이미지 확산 모델의 백본은 대부분 U-Net에 머물러 있었습니다.

이 논문은 U-Net의 귀납 편향이 확산 모델 성능에 꼭 필요한지를 묻습니다. 저자들은 U-Net을 표준 트랜스포머 설계로 바꾸어도 좋은 성능을 얻을 수 있는지 확인하려 합니다. 이때 모델 크기를 비교하는 기준으로 파라미터 수 대신 순방향 연산량인 Gﬂops를 사용합니다. 이미지 해상도처럼 연산량에 큰 영향을 주는 요소가 파라미터 수에는 드러나지 않기 때문입니다.

## 잠재 패치 토큰과 DiT 블록의 연산

확산 공정은 잠재 공간에서 정의됩니다. 순방향 과정은 데이터 x0에 잡음을 점차 섞으며, 재매개변수화 트릭으로 시간 단계 t의 샘플을 직접 만들 수 있습니다.

\\\[ x\_t = \\sqrt{\\bar\\alpha\_t}\\,x\_0 + \\sqrt{1-\\bar\\alpha\_t}\\,\\epsilon\_t \\\]

여기서 \\(\\bar\\alpha\_t\\)는 미리 정한 하이퍼파라미터이고, \\(\\epsilon\_t\\)는 표준 정규 잡음입니다. 이 식은 깨끗한 데이터와 잡음의 비율을 시간 단계에 따라 정하는 순방향 과정을 나타냅니다.

학습 목표는 네트워크 \\(\\epsilon\_\\theta\\)가 예측한 잡음과 실제 잡음 사이의 제곱 오차를 줄이는 것입니다.

\\\[ L\_{simple}(\\theta)=\\lVert \\epsilon\_\\theta(x\_t)-\\epsilon\_t\\rVert\_2^2 \\\]

DiT의 입력은 VAE가 만든 잠재 표현입니다. 예를 들어 256×256×3 이미지는 32×32×4 잠재 표현이 되고, 패치 크기 p인 패치화 층이 이를 T=(I/p)² 개의 토큰으로 나눕니다. 각 토큰은 차원 d로 선형 임베딩되며, 사인-코사인 위치 임베딩이 더해집니다. 패치 크기를 절반으로 줄이면 토큰 수는 네 배가 되므로 트랜스포머의 연산량도 최소 네 배로 늘어납니다. 그림 4는 이 입력 규격을 보여 줍니다.

![Figure 4: Input speciﬁcations for DiT. Given patch size p× p, a spatial representation (the noised latent from the V AE) of shape I× I× C is “patchiﬁed” into a…](https://refivu.com/papers/20637697-d13d-4af8-bc4d-7f97df178df2/figures/figure-159e8b2d34f67a2a2da86a515492ee15.png?thumb=512)

**Figure 4** . Input speciﬁcations for DiT. Given patch size p× p, a spatial representation (the noised latent from the V AE) of shape I× I× C is “patchiﬁed” into a sequence of length T = ( I/p)2 with hidden dimension d. A smaller patch size p results in a longer sequence length and thus more Gﬂops.

[원문](https://arxiv.org/abs/2212.09748v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · William Peebles, Saining Xie · Scalable Diffusion Models with Transformers · 원문 그림 인용 · 원본 PDF 4쪽에서 그림 영역을 추출했습니다.

토큰 시퀀스는 N개의 DiT 블록을 통과합니다. 논문의 나머지 실험에서는 모든 모델이 adaLN-Zero 블록을 사용합니다. 마지막 블록 뒤에는 레이어 정규화와 선형 디코더가 각 토큰을 p×p×2C 텐서로 바꾸고, 원래 공간 배치로 재배열하여 예측 잡음과 대각 공분산을 얻습니다.

## 조건 주입 방식의 비교

DiT는 시간 단계 t와 클래스 레이블 c를 네 가지 방식으로 블록에 넣을 수 있습니다. in-context 방식은 두 임베딩을 입력 시퀀스에 토큰으로 덧붙입니다. cross-attention 방식은 별도의 교차 주의 층을 추가하며, 원문은 이 방식이 약 15%의 추가 연산 부담을 준다고 설명합니다. adaLN 방식은 임베딩 합으로부터 스케일과 시프트를 회귀합니다. adaLN-Zero는 여기에 잔차 연결 직전에 곱하는 차원별 스케일 α를 더하고, MLP가 0 벡터를 출력하도록 초기화하여 블록을 항등 함수로 시작하게 합니다.

네 가지 설계는 같은 XL/2 모델에서 비교되었습니다. 400K 학습 반복 시점에서 adaLN-Zero의 FID는 in-context 모델의 거의 절반입니다. 저자들은 조건 주입 방식이 모델 품질에 실제로 큰 영향을 준다고 해석합니다. 초기화도 중요하여 adaLN-Zero는 기본 adaLN보다 유의미하게 낫습니다.

## Gﬂops와 FID의 관계

논문은 S, B, L, XL 구성과 패치 크기 8, 4, 2를 조합한 12개의 DiT 모델을 학습합니다. 패치 크기를 고정하고 모델을 깊고 넓게 만들면 모든 학습 단계에서 FID가 개선됩니다. 반대로 모델 크기를 고정하고 패치 크기를 줄이면 토큰 수가 늘어나며, 파라미터 수는 거의 같게 유지된 채 Gﬂops가 증가합니다. 이때에도 FID는 뚜렷하게 개선됩니다.

![Table 1: Details of DiT models. We follow ViT \[10\] model con- ﬁgurations for the Small (S), Base (B) and Large (L) variants; we also introduce an XLarge (XL) c…](https://refivu.com/papers/20637697-d13d-4af8-bc4d-7f97df178df2/figures/figure-37fadd7330b29e01529bd00beb2f9032.png?thumb=512)

**Table 1** . Details of DiT models. We follow ViT \[10\] model con- ﬁgurations for the Small (S), Base (B) and Large (L) variants; we also introduce an XLarge (XL) conﬁg as our largest model.

[원문](https://arxiv.org/abs/2212.09748v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · William Peebles, Saining Xie · Scalable Diffusion Models with Transformers · 원문 그림 인용 · 원본 PDF 5쪽에서 그림 영역을 추출했습니다.

![Figure 6: Scaling the DiT model improves FID at all stages of training. We show FID-50K over training iterations for 12 of our DiT models. Top row: We compare…](https://refivu.com/papers/20637697-d13d-4af8-bc4d-7f97df178df2/figures/figure-cc9f0745b8cab82766b164bd356836fe.png?thumb=512)

**Figure 6** . Scaling the DiT model improves FID at all stages of training. We show FID-50K over training iterations for 12 of our DiT models. Top row: We compare FID holding patch size constant. Bottom row: We compare FID holding model size constant. Scaling the transformer backbone yields better generative models across all model sizes and patch sizes.

[원문](https://arxiv.org/abs/2212.09748v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · William Peebles, Saining Xie · Scalable Diffusion Models with Transformers · 원문 그림 인용 · 원본 PDF 6쪽에서 그림 영역을 추출했습니다.

![Figure 7: Increasing transformer forward pass Gﬂops increases sample quality. Best viewed zoomed-in. We sample from all 12 of our DiT models after 400K trainin…](https://refivu.com/papers/20637697-d13d-4af8-bc4d-7f97df178df2/figures/figure-9c95071e4256a721adb1513aa29f2355.png?thumb=512)

**Figure 7** . Increasing transformer forward pass Gﬂops increases sample quality. Best viewed zoomed-in. We sample from all 12 of our DiT models after 400K training steps using the same input latent noise and class label. Increasing the Gﬂops in the model—either by increasing transformer depth/width or increasing the number of input tokens—yields signiﬁcant improvements in visual ﬁdelity.

[원문](https://arxiv.org/abs/2212.09748v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · William Peebles, Saining Xie · Scalable Diffusion Models with Transformers · 원문 그림 인용 · 원본 PDF 7쪽에서 그림 영역을 추출했습니다.

이 관찰을 확인하기 위해 400K 학습 스텝의 FID-50K와 transformer Gﬂops를 비교합니다. 두 값 사이에는 강한 음의 상관관계가 있으며 상관계수는 -0.93입니다. 같은 총 Gﬂops를 가진 DiT-S/2와 DiT-B/4가 비슷한 FID를 보이는 것도 연산량이 파라미터 수보다 더 직접적인 요인임을 시사합니다. 저자들은 추가 모델 연산량이 DiT 성능 향상의 핵심 요인이라고 해석합니다.

![Figure 2: ImageNet generation with Diffusion Transformers (DiTs). Bubble area indicates the ﬂops of the diffusion model. Left: FID-50K (lower is better) of our…](https://refivu.com/papers/20637697-d13d-4af8-bc4d-7f97df178df2/figures/figure-0809441e946ddfce69e274e6ec48b66f.png?thumb=512)

**Figure 2** . ImageNet generation with Diffusion Transformers (DiTs). Bubble area indicates the ﬂops of the diffusion model. Left: FID-50K (lower is better) of our DiT models at 400K training iterations. Performance steadily improves in FID as model ﬂops increase. Right: Our best model, DiT-XL/2, is compute-efﬁcient and outperforms all prior U-Net-based diffusion models, like ADM and LDM.

[원문](https://arxiv.org/abs/2212.09748v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · William Peebles, Saining Xie · Scalable Diffusion Models with Transformers · 원문 그림 인용 · 원본 PDF 2쪽에서 그림 영역을 추출했습니다.

![Table 4: Details of all DiT models. We report detailed information about every DiT model in our paper. Note that FID-50K here is computed without classiﬁer-fre…](https://refivu.com/papers/20637697-d13d-4af8-bc4d-7f97df178df2/figures/figure-cbb503884718e6200bee27f01f44729b.png?thumb=512)

**Table 4** . Details of all DiT models. We report detailed information about every DiT model in our paper. Note that FID-50K here is computed without classiﬁer-free guidance. Parameter and ﬂop counts exclude the V AE model which contains 84M parameters across the encoder and decoder. For both the 256× 256 and 512× 512 DiT-XL/2 models, we never observed FID saturate and continued training them as long as possible. Numbers reported in this table use the ft-MSE V AE decoder.

[원문](https://arxiv.org/abs/2212.09748v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · William Peebles, Saining Xie · Scalable Diffusion Models with Transformers · 원문 그림 인용 · 원본 PDF 13쪽에서 그림 영역을 추출했습니다.

![Figure 12: DiT scaling behavior on several generative modeling metrics.Left: We plot model performance as a function of total training compute for FID, sFID, I…](https://refivu.com/papers/20637697-d13d-4af8-bc4d-7f97df178df2/figures/figure-57629409fc3d25b491bb600b809c4f29.png?thumb=512)

**Figure 12** . DiT scaling behavior on several generative modeling metrics.Left: We plot model performance as a function of total training compute for FID, sFID, Inception Score, Precision and Recall. Right: We plot model performance at 400K training steps for all 12 DiT variants against transformer Gﬂops, ﬁnding strong correlations across metrics. All values were computed using the ft-MSE V AE decoder.

[원문](https://arxiv.org/abs/2212.09748v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · William Peebles, Saining Xie · Scalable Diffusion Models with Transformers · 원문 그림 인용 · 원본 PDF 14쪽에서 그림 영역을 추출했습니다.

학습 연산량은 모델 Gﬂops, 배치 크기, 학습 스텝 수, 그리고 역전파를 근사하는 계수 3의 곱으로 추정됩니다. 이 기준에서 작은 DiT는 더 오래 학습해도 더 큰 DiT를 짧게 학습한 경우보다 연산 효율이 떨어진다고 보고됩니다.

## ImageNet 클래스 조건부 생성 결과

256×256 ImageNet에서 DiT-XL/2는 7M 스텝까지 학습되었습니다. FID-50K는 250 DDPM 샘플링 단계로 측정되며, 모든 비교 값은 ADM의 TensorFlow 평가 도구로 계산되었습니다. classifier-free guidance를 cfg=1.50으로 적용하면 DiT-XL/2의 FID는 2.27입니다. 같은 표에서 LDM-4-G(cfg=1.50)는 3.60, ADM-G 계열 행은 4.59 이상으로 제시되어 있어 DiT-XL/2의 값이 가장 낮습니다. 가이던스를 적용하지 않은 DiT-XL/2 행의 FID는 9.62입니다.

512×512에서는 DiT-XL/2를 3M 반복 동안 256 모델과 같은 하이퍼파라미터로 새로 학습했습니다. 패치 크기 2에서 64×64×4 입력 잠재 표현은 1024개의 토큰이 되며, 연산량은 524.6 Gﬂops입니다. cfg=1.50에서 FID는 3.04이며, 본문은 이전 최고 값을 3.85로 제시합니다. 표 3에서 이 3.85는 ADM-G, ADM-U 행에 해당합니다. 같은 모델은 cfg=1.25에서 4.64, 가이던스가 없을 때 12.03입니다.

![Table 3: Benchmarking class-conditional image generation on ImageNet 512×512. Note that prior work \[9\] measures Precision and Recall using 1000 real samples fo…](https://refivu.com/papers/20637697-d13d-4af8-bc4d-7f97df178df2/figures/figure-a22292f5e53267c878771ab06e67e9ae.png?thumb=512)

**Table 3** . Benchmarking class-conditional image generation on ImageNet 512×512. Note that prior work \[9\] measures Precision and Recall using 1000 real samples for 512× 512 resolution; for consistency, we do the same.

[원문](https://arxiv.org/abs/2212.09748v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · William Peebles, Saining Xie · Scalable Diffusion Models with Transformers · 원문 그림 인용 · 원본 PDF 9쪽에서 그림 영역을 추출했습니다.

## 샘플링 연산량과 모델 연산량

이 실험은 DiT 12개 모델을 400K 스텝까지 학습한 뒤, FID-10K를 16, 32, 64, 128, 256, 1000 샘플링 단계에서 측정합니다. 그림 10은 샘플링 단계 수에 따른 FID와 샘플 한 장을 만드는 데 쓰인 Gﬂops를 함께 보여 줍니다.

![Figure 10: Scaling-up sampling compute does not compensate for a lack of model compute. For each of our DiT models trained for 400K iterations, we compute FID-…](https://refivu.com/papers/20637697-d13d-4af8-bc4d-7f97df178df2/figures/figure-3a930166f1e5f43c38d9d4b119da6503.png?thumb=512)

**Figure 10** . Scaling-up sampling compute does not compensate for a lack of model compute. For each of our DiT models trained for 400K iterations, we compute FID-10K using \[16, 32, 64, 128, 256, 1000\] sampling steps. For each number of steps, we plot the FID as well as the Gﬂops used to sample each image. Small mod- els cannot close the performance gap with our large models, even if they sample with more test-time Gﬂops than the large models.

[원문](https://arxiv.org/abs/2212.09748v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · William Peebles, Saining Xie · Scalable Diffusion Models with Transformers · 원문 그림 인용 · 원본 PDF 9쪽에서 그림 영역을 추출했습니다.

대표 비교에서 L/2는 1000 단계로 샘플 한 장당 80.7 Tﬂops를 쓰고 FID-10K 25.9를 얻습니다. XL/2는 128 단계로 15.2 Tﬂops만 쓰며 FID-10K 23.7을 얻습니다. 이는 L/2보다 샘플링 연산량이 5배 적은 설정입니다. 저자들은 이 결과를 근거로, 샘플링 단계를 늘리는 방식으로는 모델 연산량이 부족한 문제를 보상하기 어렵다고 해석합니다.

## 적용 범위와 해석 조건

Gﬂops는 이론적 순방향 연산량이므로 실제 실행 시간과 같은 값이 아닙니다. 저자들은 이미지 모델의 복잡도를 재는 골든 지표는 응용 시나리오에 따라 달라지며 아직 논쟁 중이라고 설명합니다. 파라미터 수가 이미지 모델 복잡도의 불완전한 대리 지표라는 점도 이 맥락에서 읽어야 합니다.

주요 실험은 클래스 조건부 ImageNet 256×256과 512×512에 한정됩니다. DiT는 VAE의 잠재 공간에서 학습되었고, 논문은 픽셀 공간에도 수정 없이 적용할 수 있다고 언급하지만 이 설정의 실험은 제시되지 않습니다.

FID 수치는 classifier-free guidance의 사용 여부를 함께 읽어야 합니다. 이 절의 FID 수치는 가이던스를 쓰지 않은 값이 명시된 경우를 제외하면 가이던스 조건의 값입니다. 가이던스 스케일이 커지면 시각적 충실도는 높아지고 샘플 다양성은 줄어드는 경향이 있다고 저자들은 설명합니다.

## 논문 정보

- **저자**: William Peebles, Saining Xie
- **학회·저널**: arXiv · 프리프린트
- **최초 공개일**: 2022년 12월 19일
- **등록일**: 2026년 10월 20일
- **수정일**: 2023년 3월 2일
- **버전**: v2
- **arXiv**: 2212.09748
- **분류**: cs.CV · cs.LG
- **원문 이용 조건**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **제공 범위**: 논문 정보, 해설, 허용된 원문 그림

[논문 원문 ↗](https://arxiv.org/abs/2212.09748v2) · [원문 PDF ↗](https://arxiv.org/pdf/2212.09748v2)

AI 해설은 논문 원문과 별개의 설명이며 오류가 있을 수 있습니다. 원문과 그림은 각 출처의 이용 조건과 따로 표시된 권리를 따릅니다.

## 초록

We explore a new class of diffusion models based on the transformer architecture. We train latent diffusion models of images, replacing the commonly-used U-Net backbone with a transformer that operates on latent patches. We analyze the scalability of our Diffusion Transformers (DiTs) through the lens of forward pass complexity as measured by Gflops. We find that DiTs with higher Gflops -- through increased transformer depth/width or increased number of input tokens -- consistently have lower FID. In addition to possessing good scalability properties, our largest DiT-XL/2 models outperform all prior diffusion models on the class-conditional ImageNet 512x512 and 256x256 benchmarks, achieving a state-of-the-art FID of 2.27 on the latter.

## 원문 인용

William Peebles, Saining Xie (2022). Scalable Diffusion Models with Transformers. arXiv:2212.09748v2. https://arxiv.org/abs/2212.09748v2

**BibTeX**

```
@misc{peebles2022scalable,
  title = {{Scalable Diffusion Models with Transformers}},
  author = {William Peebles and Saining Xie},
  year = {2022},
  eprint = {2212.09748},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2212.09748v2}
}
```

## 이 논문의 용어

- [Imagenet](https://refivu.com/terms/5eadad128667-imagenet)
- [FID](https://refivu.com/terms/e110afe65f86-fid)
- [U-Net](https://refivu.com/terms/f49a93d54ad5-u-net)
- [Latent Diffusion Models](https://refivu.com/terms/5d65023babcd-latent-diffusion-models)
- [AdaLN-Zero](https://refivu.com/terms/423853356265-adaln-zero)
- [GFLOPs](https://refivu.com/terms/6ad611ed6283-gflops)
- [ADM](https://refivu.com/terms/608fe8241379-adm)

## 다른 논문 해설

- [FrameMorrow: Future-guided Frame Selection with Prospective Tokens for Long-Horizon Video Generation](https://refivu.com/papers/4ded9e76-0bb8-4f45-83ca-f2cf234c1860-framemorrow-future-guided-frame-selection-with-prospective.md)
- [DiffusionART: Efficient, Stable and Scalable Reinforcement of Diffusion Models](https://refivu.com/papers/89443a6c-9e26-4b10-9b54-a9d119590181-diffusionart-efficient-stable-and-scalable-reinforcement-of.md)
- [Spectral Normalization for Generative Adversarial Networks](https://refivu.com/papers/a69a23bf-3dd6-4b32-9fb1-444f7f67a6e8-spectral-normalization-for-generative-adversarial-networks.md)
- [Denoising Diffusion Implicit Models](https://refivu.com/papers/211aa1a1-08e2-40a7-b187-72384021f47a-denoising-diffusion-implicit-models.md)
- [Diffusion Models Beat GANs on Image Synthesis](https://refivu.com/papers/c4296a34-b538-4422-b11f-4a805621a24f-diffusion-models-beat-gans-on-image-synthesis.md)
- [A Style-Based Generator Architecture for Generative Adversarial Networks](https://refivu.com/papers/4dbbd963-fe20-4e79-9ec9-730023411ef1-a-style-based-generator-architecture-for-generative.md)
- [Beyond the Timeline: Augmenting Long-Video Memory with Grounded Entity Biographies](https://refivu.com/papers/84056291-c078-4eb3-b655-ba939da0557e-beyond-the-timeline-augmenting-long-video-memory-with.md)
- [EvoDuet: Bilevel Co-Evolution of Web Searching and Task Solving for Scientific Discovery](https://refivu.com/papers/77c0e163-5404-4875-9b6f-5deeb1d2aea9-evoduet-bilevel-co-evolution-of-web-searching-and.md)
- [MotorMind: Scaffolding General Vision Language Models for Zero-Shot Robot Manipulation](https://refivu.com/papers/b87dcc37-1c56-4bfa-b53b-67f8afb682bb-motormind-scaffolding-general-vision-language-models-for.md)
- [Learning to Think and Explore in 3D World](https://refivu.com/papers/77b21acc-df94-4db4-864a-9fbf3e4dc0de-learning-to-think-and-explore-in-3d-world.md)
- [Voyager: An Open-Ended Embodied Agent with Large Language Models](https://refivu.com/papers/39fe0a31-1bf8-4ca2-bc7b-151ae7a6faa4-voyager-an-open-ended-embodied-agent-with-large.md)
- [From Traces to Agentic Worlds: Agentic Language World Models for Interactive Environment Simulation](https://refivu.com/papers/db870ea5-8df7-48cd-89f7-8f715d869b36-from-traces-to-agentic-worlds-agentic-language-world.md)

---

AI 해설에는 오류가 있을 수 있습니다. [Refivu](https://refivu.com/papers/20637697-d13d-4af8-bc4d-7f97df178df2-scalable-diffusion-models-with-transformers)
