HyperAIHyperAI

Command Palette

Search for a command to run...

Passage à l'échelle des transformers à flux rectifié pour la synthèse d'images en haute résolution

Résumé

Les modèles de diffusion génèrent des données à partir de bruit en inversant les trajectoires directes des données vers le bruit et se sont imposés comme une technique puissante de modélisation générative pour les données perceptuelles de grande dimension telles que les images et les vidéos. Le flux rectifié est une formulation récente de modèle génératif qui relie les données et le bruit par une ligne droite. Malgré ses meilleures propriétés théoriques et sa simplicité conceptuelle, il n'est pas encore définitivement établi comme pratique standard. Dans ce travail, nous améliorons les techniques existantes d'échantillonnage de bruit pour l'entraînement des modèles à flux rectifié en les biaisant vers des échelles perceptuellement pertinentes. À travers une étude à grande échelle, nous démontrons la supériorité de cette approche par rapport aux formulations de diffusion établies pour la synthèse texte-à-image en haute résolution. De plus, nous présentons une nouvelle architecture basée sur un transformateur pour la génération d'images à partir de texte, qui utilise des poids séparés pour les deux modalités et permet un flux bidirectionnel d'information entre les jetons d'image et de texte, améliorant ainsi la compréhension du texte, la typographie et les évaluations de préférence humaine. Nous montrons que cette architecture suit des tendances de mise à l'échelle prévisibles et corrèle une perte de validation plus basse à une amélioration de la synthèse texte-à-image, mesurée par divers métriques et évaluations humaines. Nos plus grands modèles surpassent les modèles de l'état de l'art. Stability AI envisage de rendre publiquement disponibles des données expérimentales, du code et des poids de modèles.

One-sentence Summary

Stability AI scales rectified flow transformers for high-resolution text-to-image synthesis by introducing perceptually-biased noise sampling and a novel transformer architecture with separate image and text token weights that enables bidirectional cross-modal attention, demonstrating predictable scaling trends and state-of-the-art performance across automated metrics and human evaluations.

Key Contributions

  • Introduces a reweighted timestep sampling method for training rectified flow models that biases timestep selection toward perceptually relevant scales, and a large-scale study shows improved high-resolution text-to-image synthesis over established diffusion formulations while retaining few-step sampling advantages.
  • Presents a transformer-based multimodal architecture for text-to-image generation that uses separate image and text token streams with modality-specific weights and bidirectional information flow, improving text comprehension, typography, and human preference ratings over UViT and DiT backbones.
  • Conducts a scaling study up to 8 billion parameters and 5 x 10^22 FLOPs, demonstrates predictable scaling trends, and shows that lower validation loss correlates with stronger results on T2I-CompBench, GenEval, and human evaluations. The largest models outperform SDXL, SDXL-Turbo, Pixart-α, and DALL-E 3.

Introduction

Diffusion models generate images and videos by reversing noise, and they have become a leading approach for high resolution text to image synthesis. This matters because these models can produce diverse, high quality media, but their iterative sampling can be slow and expensive, making more efficient formulations important.

Prior work faces two main limitations. First, the choice of forward path from data to noise affects both generation quality and sampling efficiency; straight-line rectified flow has appealing properties, but it had not been widely proven in large scale text-to-image settings. Second, common architectures often feed a fixed text representation into the image model through one-way mechanisms such as cross-attention, which can limit how text and image information interact during generation.

The authors address these gaps by introducing improved noise weighting and samplers for rectified flow models, and by proposing a multimodal transformer architecture with separate image and text token streams that allows bidirectional information flow. They then scale this combination up to an 8B parameter model with 5 x 10^22 training FLOPs, showing that lower validation loss tracks closely with better benchmark and human evaluations, and that their approach outperforms prior open and closed systems.

Dataset

  • The authors use a large-scale image dataset with existing human-written captions as the base data source.

  • To improve caption quality, they generate synthetic captions with the off-the-shelf vision-language model CogVLM.

  • They mix original captions and synthetic captions in a 50:50 ratio to preserve concepts that may be missing from synthetic-only captions.

  • They compare original-only captions and the 50:50 caption mix by training two d=15 MM-DiT models for 250k steps and evaluating them on GenEval.

  • The experiments show that the 50:50 original and synthetic caption mixture performs better, so this mixed-caption format is used for the rest of the model training.

Method

The authors leverage a simulation-free flow-matching formulation to train a conditional generative model without differentiable ODE solving during training. The model is defined through a time-dependent velocity field vΘ(yt,t)v_\Theta(y_t,t)vΘ​(yt​,t) that parameterizes an ODE

dyt=vΘ(yt,t) dt.dy_t = v_\Theta(y_t,t)\,dt .dyt​=vΘ​(yt​,t)dt.

Instead of integrating this ODE to obtain training targets, the authors construct a forward probability path between the data distribution p0p_0p0​ and a Gaussian noise distribution p1=N(0,1)p_1 = \mathcal{N}(0,1)p1​=N(0,1). For a clean sample x0x_0x0​ and Gaussian noise ϵ\epsilonϵ, the interpolated latent state is

zt=atx0+btϵ,ϵ∼N(0,I),z_t = a_t x_0 + b_t \epsilon , \qquad \epsilon \sim \mathcal{N}(0,I),zt​=at​x0​+bt​ϵ,ϵ∼N(0,I),

with boundary choices a0=1a_0=1a0​=1, b0=0b_0=0b0​=0, a1=0a_1=0a1​=0, and b1=1b_1=1b1​=1, so that z0z_0z0​ follows p0p_0p0​ and z1z_1z1​ follows p1p_1p1​. The conditional transport map is

ψt(x0∣ϵ)=atx0+btϵ,\psi_t(x_0|\epsilon) = a_t x_0 + b_t \epsilon ,ψt​(x0​∣ϵ)=at​x0​+bt​ϵ,

and its induced conditional vector field is

ut(z∣ϵ)=ψt′(ψt−1(z∣ϵ)∣ϵ).u_t(z|\epsilon) = \psi_t'(\psi_t^{-1}(z|\epsilon)|\epsilon).ut​(z∣ϵ)=ψt′​(ψt−1​(z∣ϵ)∣ϵ).

The marginal vector field that generates the marginal probability path pt(zt)p_t(z_t)pt​(zt​) would require expectation over ϵ\epsilonϵ, which is intractable in general. The method therefore optimizes a Conditional Flow Matching objective using conditional targets:

LCFM=Et,pt(z∣ϵ),p(ϵ)∥vΘ(z,t)−ut(z∣ϵ)∥22.\mathcal{L}_{\mathrm{CFM}} = \mathbb{E}_{t,p_t(z|\epsilon),p(\epsilon)} \left\| v_\Theta(z,t)-u_t(z|\epsilon) \right\|_2^2 .LCFM​=Et,pt​(z∣ϵ),p(ϵ)​∥vΘ​(z,t)−ut​(z∣ϵ)∥22​.

This objective has the same minimizer as the intractable marginal objective but remains tractable because ut(z∣ϵ)u_t(z|\epsilon)ut​(z∣ϵ) can be computed explicitly. For the linear interpolation class above, the conditional target can be rewritten as

ut(zt∣ϵ)=at′atzt−ϵbt(at′at−bt′bt).u_t(z_t|\epsilon) = \frac{a_t'}{a_t}z_t - \epsilon b_t \left( \frac{a_t'}{a_t} - \frac{b_t'}{b_t} \right).ut​(zt​∣ϵ)=at​at′​​zt​−ϵbt​(at​at′​​−bt​bt′​​).

Introducing the log signal-to-noise ratio

λt=log⁡at2bt2,λt′=2(at′at−bt′bt),\lambda_t = \log\frac{a_t^2}{b_t^2}, \qquad \lambda_t' = 2\left( \frac{a_t'}{a_t} - \frac{b_t'}{b_t} \right),λt​=logbt2​at2​​,λt′​=2(at​at′​​−bt​bt′​​),

the target becomes

ut(zt∣ϵ)=at′atzt−bt2λt′ϵ.u_t(z_t|\epsilon) = \frac{a_t'}{a_t}z_t - \frac{b_t}{2}\lambda_t'\epsilon .ut​(zt​∣ϵ)=at​at′​​zt​−2bt​​λt′​ϵ.

This reparameterization allows the flow objective to be expressed as a weighted noise-prediction loss. By defining

ϵΘ(z,t)=−2λt′bt(vΘ(z,t)−at′atz),\epsilon_\Theta(z,t) = \frac{-2}{\lambda_t'b_t} \left( v_\Theta(z,t) - \frac{a_t'}{a_t}z \right),ϵΘ​(z,t)=λt′​bt​−2​(vΘ​(z,t)−at​at′​​z),

the training objective can be written in a unified weighted form

Lw(x0)=−12Et∼U(0,1),ϵ∼N(0,I)[wtλt′∥ϵΘ(zt,t)−ϵ∥2].\mathcal{L}_w(x_0) = -\frac{1}{2} \mathbb{E}_{t\sim\mathcal{U}(0,1),\epsilon\sim\mathcal{N}(0,I)} \left[ w_t\lambda_t' \left\| \epsilon_\Theta(z_t,t)-\epsilon \right\|^2 \right].Lw​(x0​)=−21​Et∼U(0,1),ϵ∼N(0,I)​[wt​λt′​∥ϵΘ​(zt​,t)−ϵ∥2].

The original Conditional Flow Matching loss corresponds to the weighting

wt=−12λt′bt2.w_t = -\frac{1}{2}\lambda_t'b_t^2 .wt​=−21​λt′​bt2​.

The choice of trajectory ztz_tzt​ determines the weighting wtw_twt​ and the type of network prediction used during training. The method considers several probability paths. Rectified Flow defines straight-line interpolation

zt=(1−t)x0+tϵ,z_t = (1-t)x_0 + t\epsilon ,zt​=(1−t)x0​+tϵ,

which yields the weighting

wtRF=t1−tw_t^{\mathrm{RF}} = \frac{t}{1-t}wtRF​=1−tt​

and directly parameterizes velocity. EDM uses a variance-exploding style path

zt=x0+btϵ,z_t = x_0 + b_t\epsilon ,zt​=x0​+bt​ϵ,

with a log-normal noise distribution induced by the chosen scale schedule and a prediction target related to F-prediction. A cosine schedule defines

zt=cos⁡(π2t)x0+sin⁡(π2t)ϵ,z_t = \cos\left(\frac{\pi}{2}t\right)x_0 + \sin\left(\frac{\pi}{2}t\right)\epsilon ,zt​=cos(2π​t)x0​+sin(2π​t)ϵ,

and can be paired with either ϵ\epsilonϵ-prediction or vvv-prediction, giving different time-dependent weights. Latent diffusion variants also use variance-preserving schedules where bt=1−at2b_t=\sqrt{1-a_t^2}bt​=1−at2​​ and ata_tat​ is constructed from a discrete diffusion coefficient sequence βt\beta_tβt​, with different linearized or scaled schedules for βt\beta_tβt​.

Beyond choosing the trajectory, the authors tailor the distribution from which training timesteps are sampled. For Rectified Flow, uniform timestep sampling is equivalent to training velocity uniformly across all times. However, the prediction target ϵ−x0\epsilon-x_0ϵ−x0​ is often hardest in the middle of the trajectory, because the conditional mean changes rapidly around intermediate noise levels. Sampling ttt from a non-uniform density π(t)\pi(t)π(t) is equivalent to using a weighted loss with

wtπ=t1−tπ(t).w_t^\pi = \frac{t}{1-t}\pi(t).wtπ​=1−tt​π(t).

One proposed density is the logit-normal distribution

πln⁡(t;m,s)=1s2π1t(1−t)exp⁡(−(log⁡it(t)−m)22s2),\pi_{\ln}(t;m,s) = \frac{1}{s\sqrt{2\pi}} \frac{1}{t(1-t)} \exp \left( -\frac{(\log\mathrm{it}(t)-m)^2}{2s^2} \right),πln​(t;m,s)=s2π​1​t(1−t)1​exp(−2s2(logit(t)−m)2​),

where

log⁡it(t)=log⁡t1−t.\log\mathrm{it}(t)=\log\frac{t}{1-t}.logit(t)=log1−tt​.

In practice, a sample is generated by drawing u∼N(m,s)u\sim\mathcal{N}(m,s)u∼N(m,s) and mapping it through the logistic function. The location parameter mmm biases training toward either data-like or noise-like regions, while the scale parameter sss controls concentration around the chosen timestep region.

Because the logit-normal density vanishes at the endpoints, the authors also use a mode-sampling distribution with heavy tails. For a scale parameter sss, define

fmode(u;s)=1−u−s(cos⁡2(π2u)−1+u).f_{\mathrm{mode}}(u;s) = 1-u - s\left( \cos^2\left(\frac{\pi}{2}u\right)-1+u \right).fmode​(u;s)=1−u−s(cos2(2π​u)−1+u).

For a valid monotonic range of sss, this defines an invertible mapping, and the induced timestep density is

πmode(t;s)=∣ddtfmode−1(t)∣.\pi_{\mathrm{mode}}(t;s) = \left| \frac{d}{dt}f_{\mathrm{mode}}^{-1}(t) \right|.πmode​(t;s)=​dtd​fmode−1​(t)​.

Positive values of sss emphasize the middle of the trajectory, negative values emphasize endpoints, and s=0s=0s=0 recovers uniform sampling. Another variant, CosMap, constructs a time map from a uniform variable uuu so that the log-SNR matches the cosine schedule. It uses

t=f(u)=1−1tan⁡(π2u)+1,u∼U(0,1),t = f(u) = 1 - \frac{1}{\tan\left(\frac{\pi}{2}u\right)+1}, \qquad u\sim\mathcal{U}(0,1),t=f(u)=1−tan(2π​u)+11​,u∼U(0,1),

with density

πCosMap(t)=2π−2πt+2πt2.\pi_{\mathrm{CosMap}}(t) = \frac{2}{\pi-2\pi t+2\pi t^2}.πCosMap​(t)=π−2πt+2πt22​.

For text-conditional generation, the model operates in the latent space of a pretrained autoencoder. An input RGB image X∈RH×W×3X\in\mathbb{R}^{H\times W\times 3}X∈RH×W×3 is mapped by an encoder EEE into a lower-dimensional latent representation

x=E(X)∈Rh×w×d.x = E(X) \in \mathbb{R}^{h\times w\times d}.x=E(X)∈Rh×w×d.

Reconstruction quality of this autoencoder constrains the maximum achievable generated image quality, and the architecture chooses a latent width d=16d=16d=16 as a design point that balances reconstruction fidelity with diffusion-model learning capacity. Text conditioning is produced by frozen pretrained text encoders. The method combines coarse pooled text information with fine-grained token sequences. A pooled text vector cvecc_{\mathrm{vec}}cvec​ is used for global modulation, while a sequence representation cctxtc_{\mathrm{ctxt}}cctxt​ is supplied to the transformer backbone so that detailed phrase and word-level information is accessible during generation. Refer to the architecture overview:

The diffusion backbone is a multimodal transformer that operates on a sequence of latent image patches and text tokens. The noised latent is first patchified by flattening 2×22\times22×2 patches, producing a sequence of length

12h⋅12w.\frac{1}{2}h \cdot \frac{1}{2}w .21​h⋅21​w.

This patch sequence and the text-token sequence are embedded into a common dimensionality and concatenated. Each block contains modulated attention and MLP operations. For each modality, layer normalization is followed by a modulation path driven by the global conditioning vector. Conceptually, for modality m∈{c,x}m\in\{c,x\}m∈{c,x}, the pre-attention state can be written as

z~m=αm⊙LN(zm)+βm,\widetilde{z}_m = \alpha_m \odot \mathrm{LN}(z_m) + \beta_m ,zm​=αm​⊙LN(zm​)+βm​,

where αm\alpha_mαm​ and βm\beta_mβm​ are predicted from the conditioning vector. The text and image streams then produce modality-specific query, key, and value projections. These projections are concatenated so that attention is computed over the joint token sequence. This allows image tokens and text tokens to interact, while preserving separate learned transformations for each modality. Optional RMS normalization on queries and keys can be used to stabilize training. After attention, a residual branch applies a predicted scaling factor

zmatt=zm+γm⊙Attn(z~c,z~x).z_m^{\mathrm{att}} = z_m + \gamma_m \odot \mathrm{Attn}(\widetilde{z}_c,\widetilde{z}_x).zmatt​=zm​+γm​⊙Attn(zc​,zx​).

The MLP sublayer uses the same pattern, with additional modulation and scaling parameters for the feed-forward transformation. The network uses two sets of trainable parameters, one for the text stream and one for the image stream, while sharing the attention computation. This is equivalent to having two modality-specific transformer pathways that exchange information through joint attention, rather than using cross-attention from one fixed token sequence to another. The model is parameterized in terms of depth ddd, with hidden size 64d64d64d, MLP width 4⋅64d4\cdot64d4⋅64d, and number of attention heads equal to ddd.

During training, a clean latent sample and its text conditioning are encoded, a timestep is sampled from the selected density, noise is added according to the chosen forward process, and the network predicts either velocity, noise, or an equivalent target depending on the parameterization. The loss is a weighted prediction error evaluated on the concatenated text-image token sequence. During inference, noise is sampled from p1p_1p1​, the learned ODE is integrated forward in time to produce a latent sample, and the autoencoder decoder maps the latent back to image space.

When compared against transformer diffusion backbones under the same training setup, the two-weight multimodal backbone shows more favorable optimization than baseline architectures that use shared weights, cross-attention, or convolutional hybrid designs. The comparison also shows that increasing the number of separate parameter sets beyond two gives only a small gain relative to its additional parameter and memory cost. As shown in the figure below:

Experiment

Experiments evaluate training formulations for rectified flows under controlled comparisons on ImageNet and CC12M, then assess model components for text-to-image synthesis. The training comparison validates that nonuniform timestep sampling, especially a lognormal schedule emphasizing intermediate timesteps, improves robustness across metrics and sampler settings, while modified rectified-flow formulations can outperform established diffusion losses. Component studies further show that a higher-capacity latent autoencoder, mixed synthetic and original captions, and the proposed MM-DiT backbone each enhance generation quality and prompt fidelity. Finally, scaling to large image and video models shows steady validation-loss improvements with size and compute, with larger models achieving stronger benchmark and human-preference results while requiring fewer sampling steps.

Across the tested formulations, rectified-flow variants with lognormal timestep weighting place at or near the top of the global ranking when performance is averaged over weight types, datasets, and sampling settings. These variants remain broadly competitive, while individual settings show different strengths in fewer-step and many-step evaluations. The conventional epsilon prediction with a linear schedule is also strong but trails the leading lognormal variants overall. Lognormal RF weighting is consistently among the strongest overall variants. Some lognormal settings rank very well at 5 steps but differ at 50 steps. The mode-based RF variant is competitive but slightly behind the best lognormal variants. Epsilon prediction with a linear schedule remains a strong baseline.

Across the compared variants at 25 sampling steps, the rf/lognorm(0.50, 0.60) setting gives the strongest CLIP scores on both datasets, while edm(-1.20, 1.20) gives the best FID scores. This points to a tradeoff between text alignment and image fidelity. The other variants fall between these extremes, with v/cos performing especially well on FID among the v-prediction variants. rf/lognorm(0.50, 0.60) reaches the highest CLIP scores, indicating stronger alignment with text prompts. edm(-1.20, 1.20) obtains the lowest FID scores and remains competitive on CLIP, suggesting a strong balance of fidelity and alignment.

Increasing the number of latent channels from 4 to 16 while keeping the downsampling factor fixed at 8 consistently improves autoencoder reconstruction. The higher channel configurations show lower FID and perceptual similarity, along with higher SSIM and PSNR. This indicates that wider latent spaces provide a stronger reconstruction ceiling for latent diffusion models. More latent channels improve reconstruction quality across the reported metrics. The 16 channel configuration gives the best overall fidelity and similarity.

A 50/50 mix of synthetic and original captions improves text-to-image performance on GenEval compared with training on original captions only. The improvement is most visible in compositional tasks that require spatial placement, counting, attribute assignment, and two-object scenes, while simple object and color evaluations remain broadly high. Synthetic captions trained with original captions improve overall text-to-image prompt compliance. The mixed-caption setting gains most on harder compositional and spatial prompt categories. Original captions still perform strongly on simple object and color tasks.

Across GenEval, the largest trained model is reported to achieve the strongest overall prompt-comprehension performance, surpassing current open models and DALLE-3. The comparison shows that single-object generation is relatively strong across models, while counting, spatial placement, and attribute binding remain harder and tend to score lower. Scaling with improved methods and higher training resolution gives the biggest model the best overall result and strong performance in most categories. The largest model is reported to outperform current open models and DALLE-3 on overall GenEval performance Single-object generation is generally the strongest category across the compared models Counting, position, and color attribute binding remain challenging for many models

Experiments evaluate different timestep-weighted prediction formulations, latent capacity, caption mixing, and model scaling for diffusion-based image generation. Lognormal rectified-flow variants are overall strongest, while linear epsilon schedules remain competitive, and comparisons at fixed sampling steps reveal a tradeoff between text alignment and image fidelity. Wider latent spaces consistently improve reconstruction quality, and mixing synthetic captions with original captions enhances prompt compliance, especially on compositional and spatial tasks. Scaling to the largest trained model with higher resolution gives the best overall prompt comprehension, though counting, spatial placement, and attribute binding remain challenging.


Créer de l'IA avec l'IA

De l'idée au lancement — accélérez votre développement IA avec le co-codage IA gratuit, un environnement prêt à l'emploi et le meilleur prix pour les GPU.

Codage assisté par IA
GPU prêts à l’emploi
Tarifs les plus avantageux

HyperAI Newsletters

Abonnez-vous à nos dernières mises à jour
Nous vous enverrons les dernières mises à jour de la semaine dans votre boîte de réception à neuf heures chaque lundi matin
Propulsé par MailChimp