Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

Adding Conditional Control to Text-to-Image Diffusion Models

  • Problem Text prompts give coarse control over the spatial layout of a diffusion image, and training a new spatial condition end to end is hard because condition-specific datasets are much smaller than the data used to pretrain the model, so finetuning risks overfitting and forgetting.
  • Method Locks the encoder blocks of Stable Diffusion, trains a copy of them that receives the condition, and joins the two with zero-initialized 1×1 convolutions. At inference, the condition is added to the conditional branch only and its connections are weighted per block to reduce the guidance strength.
  • Results Reached 0.35 ± 0.14 IoU on ADE20K segmentation reconstruction, against 0.58 ± 0.10 for the ground truth, and an FID of 15.27 for segmentation-conditioned generation, lower than 17.92 for ControlNet-lite.

Why spatial conditions are hard to add

Text prompts give only coarse control over where objects sit in a generated image, because layout, pose and shape are hard to describe in words. Users often end up editing the prompt, checking the output and editing again until the picture matches what they had in mind. A natural alternative is to let users supply an extra image, such as an edge map, a pose skeleton or a depth map, that fixes the composition directly.

Learning such conditions end to end is difficult mainly because the data for one condition is small compared with general text-to-image training data. Finetuning a large pretrained model on such limited data can cause overfitting and catastrophic forgetting, and restricting the number or rank of trainable parameters is one known way to limit this.

The authors argue that in-the-wild conditions with complex shapes and high-level semantics may call for a deeper or more customized architecture than plain finetuning.

Locking a backbone and training a copy

ControlNet starts from a trained neural block F with parameters Θ that maps an input feature map x to an output feature map y. The block's parameters are locked, and a trainable copy with parameters Θc is cloned from it; the copy also takes an external conditioning vector c. Locking keeps the original model unchanged, while the copy starts from pretrained weights and so serves as a strong backbone for handling diverse inputs.

The copy is joined to the locked block through zero convolution layers, which are 1×1 convolutions whose weight and bias are both initialized to zero. ControlNet uses two of these layers, with parameters Θz1 and Θz2, and computes the block output as follows. \[ y_c = F(x;\Theta) + Z\big(F(x + Z(c;\Theta_{z1});\Theta_c);\Theta_{z2}\big) \] The first zero convolution maps the condition into the input of the copy, and the second maps the copy's output back to be added to the locked output.

At the first training step both zero convolutions output zero, so the ControlNet block output equals the locked block output, that is y_c = y. Because the added signal is zero at that point, no random noise reaches the hidden states of the copy when training starts. The copy still receives the input x, so it behaves like the pretrained block and can serve as a backbone for further learning.

The gradient calculation for the zero convolutions is given in the supplementary material rather than in the main text.

Applying the pattern to Stable Diffusion's U-Net

The full model has 25 blocks including the middle block; 8 of them are down-sampling or up-sampling convolution layers, and the other 17 are main blocks made of resnet layers and Vision Transformers. ControlNet creates a trainable copy of the 12 encoding blocks and the middle block, with the encoding blocks at four resolutions, 64×64, 32×32, 16×16 and 8×8, each replicated three times.

The outputs of the copy are added to the 12 skip connections and to the middle block of the U-Net.

Text prompts pass through the CLIP text encoder, and diffusion timesteps pass through a time encoder that uses positional encoding. Stable Diffusion works in a latent space, where a pre-processing step similar to VQ-GAN converts 512×512 pixel images into 64×64 latent images. The image-space condition is converted by a small encoder E of four convolution layers, each with 4×4 kernels and 2×2 strides, using 16, 32, 64 and 128 channels with ReLU activations.

The encoder maps the condition ci to the feature-space vector cf, written cf = E(ci), and its weights start from Gaussian initialization and are trained jointly with the full model.

Because the locked parameters are frozen, no gradient needs to be computed through the original encoder during finetuning, which saves time and memory. On a single NVIDIA A100 PCIE 40GB, optimizing Stable Diffusion with ControlNet needs about 23% more GPU memory and 34% more time per training iteration than optimizing Stable Diffusion without it.

Training objective and sudden convergence

Training uses the standard diffusion objective: a clean latent z0 is noised over t steps to give zt, and a network ϵθ predicts the noise from zt, t, the prompt ct and the condition feature cf. \[ \mathcal{L} = \mathbb{E}_{z_0,t,c_t,c_f,\epsilon\sim\mathcal{N}(0,1)}\big[\|\epsilon-\epsilon_\theta(z_t,t,c_t,c_f)\|_2^2\big] \] The loss is the squared error between the true noise and the predicted noise, and the same objective is used to finetune diffusion models with ControlNet.

During this training the trainable copy and the zero convolutions are updated, while the locked Stable Diffusion parameters stay fixed.

During training, 50% of the text prompts ct are replaced with empty strings. This forces the network to read the semantics of the condition image itself in cases where the prompt carries no content.

The authors observed that the model does not learn the control gradually; instead it abruptly starts following the input condition, usually in less than 10K optimization steps. They call this the sudden convergence phenomenon, and Figure 4 uses step 6133 as an example of the point where the behaviour changes. The predicted images stay high quality throughout training, which the authors attribute to the zero convolutions.

Weighting the condition in classifier-free guidance

Stable Diffusion relies on Classifier-Free Guidance, which combines an unconditional and a conditional output: \[ \epsilon_{prd} = \epsilon_{uc} + \beta_{cfg}(\epsilon_c - \epsilon_{uc}) \] where β_cfg is a user-specified weight. A conditioning image added through ControlNet can be placed in ϵuc and ϵc together, or only in ϵc. Adding it to both removes the guidance effect in hard cases such as having no prompt, while adding it only to ϵc makes the guidance very strong.

The authors' fix adds the condition to ϵc and then multiplies each connection between Stable Diffusion and ControlNet by a weight w_i = 64/h_i, where h_i is the size of the i-th block. Reducing the guidance strength this way gives the result in Figure 5d, which the authors call CFG Resolution Weighting.

To apply several conditions to one Stable Diffusion model, the outputs of the corresponding ControlNets are added directly to the model. No extra weighting or linear interpolation is used for this composition. Figure 6 shows the composition of pose and depth conditions to generate images of a boy and an astronaut.

What the outputs look like across conditions

With the empty string as the prompt, outputs follow sketches, normal maps, depth maps, Canny edges, M-LSD lines, HED edges, ADE20K segmentations and human poses, and the model has to recognize the semantic content of each condition to do so.

The authors report that training does not collapse with 1k images, and that the model learns to generate a recognizable lion as the training set grows to 50k and 3m images. This is shown in visual examples, without scores.

Figure 11 shows that when the input is ambiguous and the prompt names no object, the results appear to interpret the input shape.

Replacing zero convolutions and the lightweight variant

Two alternatives are compared: standard convolution layers initialized with Gaussian weights in place of the zero convolutions, and ControlNet-lite, which replaces each block's trainable copy with one single convolution layer. Four prompt settings are tested: no prompt, insufficient prompt, conflicting prompt and perfect prompt, with examples such as 'high-quality and detailed masterpiece', 'delicious cake' and 'a house, high-quality, extremely detailed, 4K, HQ'.

Figure 8 shows a sketch condition under each setting, with a random batch of 6 samples per setting and no cherry-picking.

The authors report that ControlNet-lite is not strong enough to interpret the condition and fails in the insufficient-prompt and no-prompt settings. When the zero convolutions are replaced, ControlNet drops to about the level of ControlNet-lite, which the authors read as the pretrained backbone of the trainable copy being damaged during finetuning.

These variants are judged in Figure 8; no score for the replaced-zero-convolution variant appears in the tables.

Segmentation fidelity and image statistics

Segmentation fidelity is tested on the ADE20K test set: images generated from ADE20K segmentations are segmented again by OneFormer, and the overlap with the ground truth is measured with IoU. OneFormer reaches 0.58 IoU on the ground-truth segmentations, which is the reference value of 0.58 ± 0.10 in the table.

ControlNet reaches 0.35 ± 0.14, ControlNet-lite 0.32 ± 0.12, LDM 0.31 ± 0.09, PITI 0.26 ± 0.16 and VQGAN 0.21 ± 0.15. The means of ControlNet and ControlNet-lite lie close together and their spreads overlap, so these values do not separate the two clearly.

LDM and VQGAN are marked as trained from scratch in that table. Stable Diffusion without segmentation conditions has FID 6.09, CLIP-score 0.26 and CLIP aesthetic score 6.32; ControlNet has CLIP-score 0.26 and CLIP aesthetic score 6.31.

Sketch user study

Twenty unseen hand-drawn sketches were each given to five methods: PITI's sketch model, Sketch-Guided Diffusion with β = 1.6 and with β = 3.2, ControlNet-lite and ControlNet. Twelve users ranked each of the 20 groups of five results on quality and on fidelity to the sketch, giving 100 rankings per criterion on a scale from 1 (worst) to 5 (best).

The preference metric is the Average Human Ranking, which Table 1 labels Average User Ranking.

ControlNet has the highest result quality at 4.22 ± 0.43, followed by ControlNet-lite at 3.93 ± 0.59 and Sketch-Guided Diffusion with β = 1.6 at 3.21 ± 0.62. On condition fidelity, ControlNet scores 4.28 ± 0.45, ControlNet-lite 4.09 ± 0.46 and Sketch-Guided Diffusion with β = 3.2 3.28 ± 0.72. PITI's sketch model ranks lowest on both criteria, at 1.10 ± 0.05 for quality and 1.02 ± 0.01 for fidelity.

Comparison with an industrial depth model

SDv2-D2I was trained on a large NVIDIA A100 cluster over thousands of GPU hours, with more than 12M training images. For the same depth condition, a ControlNet for SD V2 was trained with 200k training samples on one NVIDIA RTX 3090Ti over 5 days.

Users first studied 100 images from each method and were then shown 200 generated images and asked which model produced each one. Their average precision is 0.52 ± 0.17, which the authors read as the two methods giving almost indistinguishable results.

Limits of the evidence

The sketch user study covers 20 sketches and 12 users, so its rankings come from a small sample. Segmentation fidelity depends on OneFormer re-segmenting the generated images, so the IoU values reflect what that segmenter recovers. ControlNet and ControlNet-lite overlap within their reported spreads on IoU, so this measure does not separate them.

The industrial comparison covers one depth condition and one pair of models, and the ControlNet for SD V2 used 200k training samples, which is not a matched-data comparison with SDv2-D2I. The only measure reported for that pair is user discrimination, so no FID or CLIP score is given for it.

The authors state that the U-Net structure makes the design likely to apply to other models, but the experiments use Stable Diffusion as the backbone. Community models are shown as visual examples without scores, and other dataset sizes are likewise shown only visually.

Paper info

Authors
Lvmin Zhang, Anyi Rao, Maneesh Agrawala
Venue
arXiv · Preprint
First published
2023-2-10
Added
2026-10-20
Updated
2023-11-26
Version
v3
arXiv
2302.05543
Category
cs.CV · cs.AI · cs.GR · cs.HC · cs.MM
Original paper terms
arXiv non-exclusive 1.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Lvmin Zhang, Anyi Rao, Maneesh Agrawala (2023). Adding Conditional Control to Text-to-Image Diffusion Models. arXiv:2302.05543v3. https://arxiv.org/abs/2302.05543v3

BibTeX
@misc{zhang2023adding,
  title = {{Adding Conditional Control to Text-to-Image Diffusion Models}},
  author = {Lvmin Zhang and Anyi Rao and Maneesh Agrawala},
  year = {2023},
  eprint = {2302.05543},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2302.05543v3}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up